https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109571
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |tree-optimization
Keywords| |diagnostic
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>so I'd like to understand what's actually causing this warning, so I can avoid
>it.
It comes from jump threading.
Considering -Wnull-dereference is not turned on via either -Wextra or -Wall.
Just turn off the warning.
Basically when the front-end expands does:
B *tmp;
A *a = tmp;
It expands it as:
if (D.30650 != 0B)
goto <bb 4>; [INV]
else
goto <bb 5>; [INV]
<bb 4> :
iftmp.0 = &D.30650->D.28785;
goto <bb 6>; [INV]
<bb 5> :
iftmp.0 = 0B;
<bb 6> :
a = iftmp.0;
And then there is a jump threading with the check of the null pointer and then
propagating the null pointer into the deference.