http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53844
--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> 2012-07-04 13:47:09 UTC --- On Wed, 4 Jul 2012, ed at edrosten dot com wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53844 > > Edward Rosten <ed at edrosten dot com> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Component|tree-optimization |middle-end > > --- Comment #8 from Edward Rosten <ed at edrosten dot com> 2012-07-04 > 13:36:28 UTC --- > (In reply to comment #7) > > Fixed on trunk sofar, watching for fallout. > > I pulled the latest change from SVN and tried it on the test code, with > success. > > I'm using the shortened test function: > > > void test(const Vector<>& in, Vector<>& out, int i) > { > out = in*1*1*1*1; > } > > If I change the test function to: > > > void test(const Vector<>& in, Vector<>& out, int i) > { > const > Vector<ScalarMulExpr<ScalarMulExpr<ScalarMulExpr<ScalarMulExpr<VBase> > > > > >& v = in*1*1*1*1; > out = v; > } I can at least see that you are using no longer live variables: <bb 2>: D.2391 ={v} {CLOBBER}; D.2396 ={v} {CLOBBER}; <bb 3>: # i_36 = PHI <i_35(3), 0(2)> D.2928_28 = MEM[(struct VBase *)out_3(D)].my_data; D.2929_30 = (long unsigned int) i_36; D.2930_31 = D.2929_30 * 8; D.2927_32 = D.2928_28 + D.2930_31; D.2948_44 = MEM[(const struct ScalarMulExpr *)&D.2391].vec; here D.2391 is already dead. So possibly you are returning references to temporaries somewhere.