https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82090
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2017-09-04 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed (at -O1 even). We fail to jump-thread oldmem_5(D) == 0 and get <bb 2> [100.00%]: if (oldmem_5(D) == 0B) goto <bb 3>; [4.07%] else goto <bb 7>; [95.93%] <bb 7> [95.93%]: goto <bb 4>; [100.00%] <bb 3> [4.07%]: <bb 4> [100.00%]: # magic_p_17 = PHI <magic_p_18(D)(3), oldmem_5(D)(7)> __asm__ __volatile__("cmpl $0, __libc_multiple_threads(%%rip) ... if (oldmem_5(D) == 0B) goto <bb 5>; [0.04%] else goto <bb 6>; [99.96%] <bb 5> [0.04%]: malloc_printerr ("realloc(): invalid pointer"); <bb 6> [99.96%]: _2 = *magic_p_17; _3 = ~_2; *magic_p_17 = _3; return oldmem_5(D); and the late uninit pass is not able to "prove" we're not using magic_p_18(D). Jump threading probably gives up because of the asm ().