------- Comment #2 from rguenth at gcc dot gnu dot org 2010-01-08 16:21 ------- Confirmed on trunk. The return statement in bar() is not instrumented because it is turned into a goto to the merged return statement by gimple lowering and we are not good preserving gotos if they turn into fallthru edges later (which in this case happens during EH lowering).
We go from [t.c : 11:15] s.10 = <retval>; [t.c : 11:15] std::basic_string<char>::basic_string (s.10); [t.c : 13:11] try { [t.c : 12:14] D.12564 = foo (i); [t.c : 12:14] D.12565 = (int) D.12564; [t.c : 12:14] s.11 = <retval>; [t.c : 12:15] std::basic_string<char>::operator+= (s.11, D.12565); [t.c : 13:10] goto <D.12568>; } catch { [t.c : 11:15] s.12 = <retval>; [t.c : 11:15] std::basic_string<char>::~basic_string (s.12); } <D.12568>: return <retval>; to [t.c : 11:15] s.10 = <retval>; [t.c : 11:15] std::basic_string<char>::basic_string (s.10); [t.c : 12:14] D.12564 = foo (i); [t.c : 12:14] D.12565 = (int) D.12564; [t.c : 12:14] s.11 = <retval>; [t.c : 12:15] std::basic_string<char>::operator+= (s.11, D.12565); [t.c : 13:10] goto <D.12568>; <D.12568>: return <retval>; <D.12569>: [t.c : 11:15] s.12 = <retval>; [t.c : 11:15] std::basic_string<char>::~basic_string (s.12); resx 1 to <bb 2>: [t.c : 11:15] s.10 = <retval>; [t.c : 11:15] std::basic_string<char>::basic_string (s.10); [t.c : 12:14] D.12564 = foo (i); [t.c : 12:14] D.12565 = (int) D.12564; [t.c : 12:14] s.11 = <retval>; [t.c : 12:15] std::basic_string<char>::operator+= (s.11, D.12565); <bb 3>: return <retval>; <L1>: [t.c : 11:15] s.12 = <retval>; [t.c : 11:15] std::basic_string<char>::~basic_string (s.12); resx 1 We could special-case this particular case of CFG construction of a fallthru to the return block with just a single predecessor to copy the location from the fallthru goto, but ... that looks like a hack. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2010-01-08 16:21:48 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42660