This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/69404] atomic builtins accept incompatible pointers
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 21 Jan 2016 02:22:18 +0000
- Subject: [Bug c/69404] atomic builtins accept incompatible pointers
- Auto-submitted: auto-generated
- References: <bug-69404-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69404
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #1)
> Actually, with more testing I see the builtins do even more than that: they
> silently convert between pointers to types of the same size. (Clang
> diagnoses those as well.)
>
> $ cat z.c && /home/msebor/build/gcc-trunk-git/gcc/xgcc
> -B/home/msebor/build/gcc-trunk-git/gcc -S -Wall -Wextra -Wpedantic
> -o/dev/null z.c
> int* foo (void (*p)(void))
> {
> int *q;
> __atomic_load (&p, &q, 0);
> return q;
> }
Most likely because it treats it as void* :).
Since this is an GCC extension, GCC can define the behavior any which way it
wants. If clang is not compatible is not GCC's fault.
Does stdatomic.h defines have the same issue then there is a problem there.