http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56094
Bug #: 56094 Summary: Invalid line number info generated with tree-level ivopts Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: josh.m.con...@gmail.com The attached code has a number of instructions that are associated with the head of the function. This was showing up when setting a breakpoint on the function itself and gdb was setting several - not a problem in general, except that the statements were more appropriately correlated with intra-loop calculations instead of anything to do with the prologue. To reproduce, compile the attached file with -g -O2, and notice the statements associated with line 83. These lines are in fact statements that are generated during tree-level induction variable optimization, but which aren't getting their location data copied over from the gimple statement and so they default to the start of the function (sorry for being a bit vague, but it's been a while since I looked into the mechanics of this and I don't recall the details). The fix I have implemented in our local tree is in rewrite_use_nonlinear_expr, where after generating the computation (comp) I verify that it has a location associated with it - if it doesn't but the use stmt (use->stmt) does have a location, I copy the location from the use->stmt over to comp.