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

--- Comment #31 from LIU Hao <lh_mouse at 126 dot com> ---
(In reply to Andrew Pinski from comment #24)
> The warning is there for the above case really (and similar ones with struct
> offsets). Where you originally have a null pointer and have an offset from
> there; by the time the warning happens, the IR does not know if it was
> originally from an offset of a null pointer or if the value was written in.

I understand that completely, but it does not justify the confusion. Something
like 'warning: array subscript 0 is outside array bounds of' says nothing about
null pointers, and is thus misleading. It is addition of a non-zero offset to a
null pointer that the warning really belongs to.

Reply via email to