Thanks to recent code refactoring in GCC 12, -Warray-bounds has started to diagnose accesses to constant addresses just like many other flow based warnings do (e.g., -Wstringop-overflow). The warnings are meant to help detect accesses resulting from invalid arithmetic on null pointers. There may be a better way to detect them but GCC doesn't have the detection yet. This warning change has in turn exposed Glibc's uses of this trick in the implementation of the THREAD_SELF macro. I have tried a few approaches to avoid the warning but none worked or seemed satisfactory: 1) Using #pragma GCC diagnostic doesn't work in macros. 2) Using _Pragma doesn't work there either due to a GCC limitation. 3) Declaring the pointer volatile works but prevents accesses to it from being eliminated when the result isn't used (something Glibc apparently cares about). 4) Defining a simple static inline function to wrap the code and the #pragmas doesn't work because the header is #included in files where struct pthread isn't defined. 5) Introducing a global variable with the address and initializing it in some .c file seems too heavy-weight. 6) Falling back on the pre-GCC 6 asm would be safer but seems like a step back. Finally I have come up with the attached solution that combines (4) and (1). If (6) is preferable I'm happy to go that route. If there are other alternatives I'd be glad to consider them as well. Thanks Martin