[Bug analyzer/107225] FP with -Wanalyzer-mismatching-deallocation

2022-10-12 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107225

--- Comment #2 from David Malcolm  ---
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.

[Bug analyzer/107225] FP with -Wanalyzer-mismatching-deallocation

2022-10-11 Thread urs at akk dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107225

--- Comment #1 from urs at akk dot org ---
Created attachment 53694
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53694=edit
reduced test case for FP with -fanalyzer (-Wanalyzer-mismatching-deallocation,
-Wanalyzer-file-leak)