This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/69404] atomic builtins accept incompatible pointers


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]