------- Comment #3 from rguenth at gcc dot gnu dot org 2009-12-31 15:57 ------- -O1 -fipa-sra shows the problem as well. We can see wrong (or rather missing) cloning of static initializers:
;; Function void Foo< <template-parameter-1-1> >::exec2() [with <template-parameter-1-1> = int] (_ZN3FooIiE5exec2Ev) void Foo< <template-parameter-1-1> >::exec2() [with <template-parameter-1-1> = int] (struct FooD.1756 * const thisD.1781) { voidD.35 * gotovar.1D.1832; boolD.1631 D.1831; static voidD.35 * tableD.1795[2] = {&beginL.0, &endL.4}; <bb 2>: gotovar.1D.1832_1 = tableD.1795[0]; goto gotovar.1D.1832_1; beginL.0: endL.4: return; } ;; Function void Foo< <template-parameter-1-1> >::execute() [with <template-parameter-1-1> = int] (_ZN3FooIiE7executeEv) void Foo< <template-parameter-1-1> >::execute() [with <template-parameter-1-1> = int] (struct FooD.1756 * const thisD.1783) { static voidD.35 * tableD.1795[2] = {&beginL.0, &endL.4}; voidD.35 * gotovar.1D.1845; static voidD.35 * tableD.1795[2] = {&beginL.0, &endL.4}; <bb 2>: gotovar.1D.1845_5 = tableD.1795[0]; goto gotovar.1D.1845_5; beginL.1: endL.2: goto <bb 2>; } Hm. Honza? This looks like an issue with non-localized vars? -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jamborm at gcc dot gnu dot | |org, hubicka at gcc dot gnu | |dot org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |wrong-code Last reconfirmed|0000-00-00 00:00:00 |2009-12-31 15:57:11 date| | Summary|wrong-code with computed- |[4.5 Regression] wrong-code |goto |with computed-goto Target Milestone|--- |4.5.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42462