[RFC patch] avoid warning on accesses to hardwired address

Martin Sebor msebor@gmail.com
Wed Jul 21 16:17:51 GMT 2021


On 7/21/21 7:06 AM, Florian Weimer wrote:
> * Florian Weimer:
> 
>> * Martin Sebor via Libc-alpha:
>>
>>> 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.
>>
>> The warning needs to be disabled in GCC for named address spaces.  Null
>> pointers are not special for them.
> 
> Is there already a GCC PR for this warning regression?

Not one about null pointers and named address spaces.  If you could
open one and point to where the spec allows null pointers to be 
dereferenced that would be helpful.

Thanks
Martin


More information about the Libc-alpha mailing list