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

--- Comment #7 from Niall Douglas <s_gccbugzilla at nedprod dot com> ---
(In reply to Andrew Pinski from comment #4)
> (In reply to Niall Douglas from comment #3) 
> > You may be interested in reading https://reviews.llvm.org/D110069. It wanted
> > to have LLVM generate a 128 bit AArch64 CAS for atomics. LLVM merged that
> > change, it'll be in the next release.
> 
> Using CAS for atomic load is not valid thing to do ...
> Because atomic load from constant rodata needs to work.
> LLVM breaks this case as they don't care about it. GCC does though.

I've heard that argument before, and I've always wondered why _Atomic128 types
couldn't have an attribute which applies attribute section to their static
const variable incarnations to force them into r/w memory. That would also
solve the LLVM issue. Said attribute is not unuseful in general actually, it
would help avoid having to mess with mprotect to apply copy on write perms on
regions in .rodata when you need to modify static const variable values.

I don't think that the standard *guarantees* that static const variables go
into read only memory, and besides, before C23 128 bit integers weren't
supported anyway so one could argue as a proprietary extension (__int128) you
get proprietary special casing.

Niall

Reply via email to