[Bug c/69002] C front end should warn about undefined access to atomic structure or union
fw at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 21 16:48:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69002
--- Comment #2 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #1)
> I actually wouldn't want to see GCC start issuing warnings for this code
> because it has well-defined semantics there.
Unfortunately, the generated code is truly abysmal, for example:
read1:
pushq %rbp
movq %rsp, %rbp
movl %edi, -32(%rbp)
movl -32(%rbp), %eax
movl %eax, -4(%rbp)
movl -4(%rbp), %eax
popq %rbp
ret
read2:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -24(%rbp)
movq -24(%rbp), %rax
movl (%rax), %eax
movl %eax, -4(%rbp)
movl -4(%rbp), %eax
popq %rbp
ret
> initialized using one of the ATOMIC_VAR_INIT() or atomic_init() macros
I don't see this qualification in 6.5.2.3/5. I don't think this issue is
touched in your blog post at all.
More information about the Gcc-bugs
mailing list