https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104269
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2022-01-28 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Since the warning runs after uncprop, it is the diagnostics are all wrong. Before uncprop: if (_6 == 0B) goto <bb 5>; [15.47%] else goto <bb 3>; [84.53%] <bb 5> [local count: 166107864]: goto <bb 4>; [100.00%] <bb 3> [local count: 907633961]: ret_buf_8 = malloc (0); <bb 4> [local count: 1073741824]: # ret_buf_2 = PHI <ret_buf_8(3), 0B(5)> out: free (_6); dirent1.0_1 = dirent1; free (dirent1.0_1); dirent1 ={v} {CLOBBER}; return ret_buf_2; After: # ret_buf_2 = PHI <ret_buf_8(3), _6(5)> The warning is still not flow sensitive enough to know that _6 from bb5 will be 0B. and that doing free(0) does not matter.