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

            Bug ID: 117236
           Summary: -Wnull-dereference false positive in GNU tar
                    (regression from GCC 12)
           Product: gcc
           Version: 14.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eggert at cs dot ucla.edu
  Target Milestone: ---

[Sam James asked me in Bug 109856, Comment 4 to file a separate bug report for
this test case.]

This is gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3) on x86-64. Compile
attachment 55337 with:

gcc -O2 -S -Wnull-dereference 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. I don't see the false positive when compiling with
GCC 12; it appears that it was introduced in GCC 13.

Reply via email to