https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105346
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r11-5732-gdce6c58db87ebf7f4477bd3126228e73e4eeee97
The IL at -O0 -Wall looks during waccess pass like:
void foo ()
{
char * bufp;
char buf[20];
<bb 2> :
bufp_2 = &buf;
if (&buf != bufp_2)
goto <bb 3>; [INV]
else
goto <bb 4>; [INV]
<bb 3> :
__builtin_free (bufp_2);
<bb 4> :
buf ={v} {CLOBBER(eol)};
return;
}
So, I think the waccess pass must be walking SSA_NAME_DEF_STMT to figure out it
is a free of non-heap. Either it shouldn't do that at -O0, or it should only
walk them when they are in the same bb as the free call, or it needs to be able
to detect also conditionals like the above.