https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88882
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-debug Status|UNCONFIRMED |NEW Last reconfirmed| |2019-01-17 Version|unknown |9.0 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- The fact that l == 2 initially has been completely elided in the IL without retaining a # DEBUG l = NULL. CCP does this when the basic-block containing the debug stmts is elided. +Removing basic block 4 main () { int l; @@ -8,7 +9,6 @@ int c.1_2; int _3; int c.2_4; - int _11; <bb 2> : # DEBUG BEGIN_STMT @@ -19,35 +19,27 @@ if (b.0_1 != 0) goto <bb 3>; [INV] else - goto <bb 4>; [INV] + goto <bb 5>; [INV] <bb 4> : # DEBUG BEGIN_STMT - l_7 = 2; - # DEBUG l => l_7 - # DEBUG BEGIN_STMT - goto <bb 6>; [INV] - - <bb 5> : - # DEBUG BEGIN_STMT optimize_me_not (); Or rather it is likely CFG cleanup which is faced with <bb 3> : # DEBUG BEGIN_STMT b.0_1 = b; if (b.0_1 != 0) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 4> : # DEBUG BEGIN_STMT # DEBUG l => 2 # DEBUG BEGIN_STMT goto <bb 6>; [INV] <bb 6> : c.2_4 = c; if (c.2_4 <= 1) goto <bb 5>; [INV] else goto <bb 7>; [INV] note how it cannot move the debug stmts to neither the predecessor nor the successor but it has to elide the forwarder for compare-debug reasons. If we knew that l didn't have a value before we could have moved it to the predecessor though. Hard one. Well - allow DEBUG stmts on edges ;)