[Bug debug/88882] gcc generates wrong debug information at -O1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=2 Bug 2 depends on bug 89892, which changed state. Bug 89892 Summary: gcc generates wrong debug information at -O2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89892 What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED
[Bug debug/88882] gcc generates wrong debug information at -O1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=2 Richard Biener changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |DUPLICATE --- Comment #4 from Richard Biener --- . *** This bug has been marked as a duplicate of bug 89892 ***
[Bug debug/88882] gcc generates wrong debug information at -O1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=2 Richard Biener changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
[Bug debug/88882] gcc generates wrong debug information at -O1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=2 Richard Biener changed: What|Removed |Added Depends on||89892 --- Comment #3 from Richard Biener --- Really a duplicate as well. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89892 [Bug 89892] gcc generates wrong debug information at -O2
[Bug debug/88882] gcc generates wrong debug information at -O1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=2 --- Comment #2 from Qirun Zhang --- Bisection points to r216247.
[Bug debug/88882] gcc generates wrong debug information at -O1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=2 Richard Biener 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 --- 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; : # DEBUG BEGIN_STMT @@ -19,35 +19,27 @@ if (b.0_1 != 0) goto ; [INV] else -goto ; [INV] +goto ; [INV] : # DEBUG BEGIN_STMT - l_7 = 2; - # DEBUG l => l_7 - # DEBUG BEGIN_STMT - goto ; [INV] - - : - # DEBUG BEGIN_STMT optimize_me_not (); Or rather it is likely CFG cleanup which is faced with : # DEBUG BEGIN_STMT b.0_1 = b; if (b.0_1 != 0) goto ; [INV] else goto ; [INV] : # DEBUG BEGIN_STMT # DEBUG l => 2 # DEBUG BEGIN_STMT goto ; [INV] : c.2_4 = c; if (c.2_4 <= 1) goto ; [INV] else goto ; [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 ;)