http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49951
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2011.08.03 09:34:43 Target Milestone|--- |4.5.4 Summary|Debug stepping behavior |[4.5/4.6/4.7 Regression] |regarding g++ Class |Debug stepping behavior |destructor has changed for |regarding g++ Class |the worse starting at gcc |destructor has changed for |4.5.0 |the worse starting at gcc | |4.5.0 Ever Confirmed|0 |1 Known to fail| |4.5.3, 4.6.1, 4.7.0 --- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-08-03 09:34:43 UTC --- Confirmed. The destruction is implemented via a try {} finally where the finally block seems to get the source location of the construction of the object rather than the source location of it going out of scope: int main(int, char**) (int argc, char * * argv) { int D.2623; [t.C : 19:5] { int i; struct MyClass m; [t.C : 13:11] i = 1; [t.C : 14:11] MyClass::MyClass ([t.C : 14] &m); [t.C : 19:5] try { [t.C : 16:3] if (i == 1) goto <D.2620>; else goto <D.2621>; <D.2620>: [t.C : 18:37] printf ("Hello world %d\n", i); goto <D.2622>; <D.2621>: <D.2622>: } finally { [t.C : 14:11] MyClass::~MyClass ([t.C : 14] &m); } } [t.C : 0:0] D.2623 = 0; [t.C : 0:0] return D.2623; } With 4.4 we still had int main(int, char**) (int argc, char * * argv) { int D.2628; [t.C : 19] { int i; struct MyClass m; [t.C : 13] i = 1; [t.C : 14] __comp_ctor ([t.C : 14] &m); [t.C : 19] try { [t.C : 16] if (i == 1) goto <D.2625>; else goto <D.2626>; <D.2625>: [t.C : 18] printf (&"Hello world %d\n"[0], i); goto <D.2627>; <D.2626>: <D.2627>: } finally { [t.C : 19] __comp_dtor ([t.C : 19] &m); } } [t.C : 0] D.2628 = 0; [t.C : 0] return D.2628; } So the finally block stmts inherit the try/finally location. Might be a gimplification or frontend issue.