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/65455] typeof _Atomic fails


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65455

--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Tue, 17 Mar 2015, jens.gustedt at inria dot fr wrote:

> Eliminating qualifiers in expressions is easy for arithmetic types at least,
> something like
> 
> __typeof__((a)+0) b;

No, that would not work for the uses in stdatomic.h.  The temporary must 
have the unqualified, non-atomic type when a is, for example, _Atomic 
char; there can't be any promotions as otherwise the type would be wrong 
when the address of the temporary is taken.

> (and BTW, the current version of stdatomic.h uses __auto_type, which makes it
> incompatible with clang.)

Well, GCC's stdatomic.h only ever needs to be compatible with the same 
version of GCC it ships with.  __auto_type is to avoid duplicate 
evaluations of side-effects in operands with variably modified types (a 
variably modified argument to typeof is evaluated, unlike a non-VM 
argument); see gcc.dg/atomic/stdatomic-vm.c.


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