This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/65455] typeof _Atomic fails
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 17 Mar 2015 22:02:32 +0000
- Subject: [Bug c/65455] typeof _Atomic fails
- Auto-submitted: auto-generated
- References: <bug-65455-4 at http dot gcc dot gnu dot org/bugzilla/>
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.