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

--- Comment #1 from Paul Eggert <eggert at cs dot ucla.edu> ---
Created attachment 55337
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55337&action=edit
Another illustration of the bug, taken from GNU tar

Here is another example of the bug, taken from GNU tar. Compile it with:

gcc -O2 -Wnull-dereference -S w.i

The output is:

w.i: In function ‘_write_volume_label.part.0’:
w.i:9290:30: warning: potential null pointer dereference [-Wnull-dereference]
 9290 |       label->header.typeflag = 'V';
      |       ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
w.i:9290:30: warning: potential null pointer dereference [-Wnull-dereference]

This is a false positive, since the local variable 'label' cannot be null in
line 9290, given that line 9284 has checked that it is not null. Also, the two
copies of the same diagnostic are suspicious.

Reply via email to