Re: cc1plus: note: source object is likely at address zero

Jonathan Grant <[email protected]> Thu, 5 Mar 2026 13:41:20 +0000
Newsgroups gmane.comp.gcc.help
Message-ID <[email protected]>

On 05/03/2026 13:31, Arsen Arsenović wrote:
> Jonny Grant <[email protected]> writes:
> 
>> Is there a way to make these "notes" appear as warnings? That can then
>> be upgraded to errors by -Werror
>> [...]
>> <source>: In function 'int main()':
>> <source>:18:11: warning: 'int __builtin_puts(const char*)' reading 1 or more bytes from a region of size 0 [-Wstringop-overread]
> 
> ^ That part is the actual warning, so you want
> -Werror=stringop-overread.
> 
> The note is just added context for the warning (as per the usual - notes
> serve to specify more info about diagnostics).

Hello Arsen, Andrew

Many thanks for pointing out it's the -Wstringop-overread that causes the warning.
Maybe "from a region of size 0" is a little unclear, perahps it could be "from a region starting at address 0x0 (NULL)" Would that be a useful PR to raise?

BTW, Does --param=min-pagesize=N still work? I couldn't get it to output in a recent test. It lets us et under 0x4000 as invalid addresses.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106699#c1

Regards
Jonathan