glibc 2.21 - Master is frozen solid at -26 degC.
David Miller
davem@davemloft.net
Wed Jan 28 21:30:00 GMT 2015
From: Roland McGrath <roland@hack.frob.com>
Date: Wed, 28 Jan 2015 11:08:12 -0800 (PST)
>> nptl-init.c: In function sighandler_setxid :
>> nptl-init.c:242:1: error: optimization may eliminate reads and/or writes to register variables [-Werror=volatile-register-var]
>> nptl-init.c:242:1: error: optimization may eliminate reads and/or writes to register variables [-Werror=volatile-register-var]
>>
>> I get these all over the NPTL code, and every instance points to the
>> function's declaration rather than at any code within the function, which
>> makes tracking down what it's unhappy about not so easy.
>>
>> I'll keep digging into this.
>
> In the GCC source, that message is only for global register variables
> declared as volatile AFAIK. I expect it's for the __thread_self global in
> sysdeps/sparc/nptl/tls.h but there is no volatile there, so I don't know
> how it would come about.
It's happening indirectly via typeof(), for example in sighandler_setxid() we
have:
if (atomic_decrement_val (&__xidcmd->cntr) == 0)
'cntr' is volatile, and then to get the types right the non-v9 32-bit sparc
macros for atomics do things like:
register __typeof (*(mem)) __acev_tmp __asm ("%g6"); \
register __typeof (mem) __acev_mem __asm ("%g1") = (mem); \
register __typeof (*(mem)) __acev_oldval __asm ("%g5"); \
and that's where the warnings come from. I fixed it just like MIPS did
by using a union.
This has allowed me to start working on the semaphore bits.
More information about the Libc-alpha
mailing list