https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105868
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Looks like the warning happens before the jump threading of: <bb 11> [local count: 80530636]: # buffer_57 = PHI <buffer_31(7), &_buffer(15)> if (&_buffer == buffer_57) goto <bb 12>; [98.77%] else goto <bb 13>; [1.23%] <bb 12> [local count: 79540110]: buffer_26 = __builtin_strdup (&_buffer); <bb 13> [local count: 746791736]: # _9 = PHI <0B(10), buffer_26(12), buffer_57(11), buffer_18(D)(14)> _buffer ={v} {CLOBBER(eol)}; alloc_size ={v} {CLOBBER(eol)}; return _9; Happens. In optimized, the threading happens and there is no reference to &_buffer in the PHI for the retun.