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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-Wnull-dereference error    |-Wnull-dereference
                   |indicator in the wrong      |Warray-bounds warnings
                   |place.                      |seems to point to the wrong
                   |                            |location

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Oskars Putans from comment #6)
> (In reply to Andrew Pinski from comment #5)
> > That is ok because the underlying issue is the same though. Only the line
> > info for the `var = a;` assignment is there.
> 
> Could I get confirmation of Wnull-dereference happening with the latter
> version? Because otherwise the title and blocks should probably be changed.

```
In member function 'void T2::setVar(int)',
    inlined from 'int main()' at <source>:14:20:
<source>:4:28: warning: null pointer dereference [-Wnull-dereference]
    4 |   void setVar(int a) { var = a; }
      |                        ~~~~^~~
```

```
  [/app/example.cpp:4:28] [/app/example.cpp:4:24] MEM[(struct T2 *)0B].var = 5;
```

And yes line 4 is only left in the IR at the point of the warning.

Updated the summary to mention both.

Reply via email to