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

--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this bug.

As far as I can tell, the aliasing implementation gets confused at:

1313 |           x_hdrs[num_x_hdrs++] = strdup(line);
     |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~

for the case where x_hdrs is NULL (which -fanalyzer does seem to complain
about) and considers that the write to NULL[0] could modify file's buffer
(which it clearly can't, or at least, it's clear to a human that it can't).

I think it's fixable by making the -fanalyzer's aliasing code consider that
writes through NULL don't alias anything.

Reply via email to