NOTE; ok with -std=gnu++0x cat ice47.cc #include <complex> template <typename Value> struct LorentzVector { template <typename ValueB> LorentzVector<Value> & operator+=(const LorentzVector<ValueB> & a) { theX += a.theX; theY += a.theY; theZ += a.theZ; theT += a.theT; return *this; } Value theX; Value theY; Value theZ; Value theT; }; template <typename ValueA, typename ValueB> inline LorentzVector<ValueA> operator+(LorentzVector<ValueA> a, const LorentzVector<ValueB> & b) { return a += b; } std::complex<double> evaluate() { LorentzVector<std::complex<double> > v1; LorentzVector<std::complex<double> > veca = v1 + v1; return veca.theT; } Macintosh-203:ctest innocent$ c++ -O2 -c ice47.cc ice47.cc: In function ‘std::complex<double> evaluate()’: ice47.cc:26:22: error: invalid rhs for gimple memory store a$_M_value v1$_M_value # .MEM_14 = VDEF <.MEM_12> a$_M_value = v1$_M_value; ice47.cc:26:22: error: invalid rhs for gimple memory store a$16$_M_value v1$theY$_M_value # .MEM_15 = VDEF <.MEM_14> a$16$_M_value = v1$theY$_M_value; ice47.cc:26:22: error: invalid rhs for gimple memory store a$32$_M_value v1$32$_M_value # .MEM_16 = VDEF <.MEM_15> a$32$_M_value = v1$32$_M_value; ice47.cc:26:22: error: invalid rhs for gimple memory store a$48$_M_value v1$theT$_M_value # .MEM_17 = VDEF <.MEM_16> a$48$_M_value = v1$theT$_M_value; ice47.cc:26:22: internal compiler error: verify_gimple failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Macintosh-203:ctest innocent$ c++ -O2 -c ice47.cc -std=gnu++0x Macintosh-203:ctest innocent$
*** Bug 50623 has been marked as a duplicate of this bug. ***
Confirmed.
Offending pass is late SRA.
reduced to this (no std) typedef __complex__ double Value; struct LorentzVector { LorentzVector & operator+=(const LorentzVector & a) { theX += a.theX; theY += a.theY; theZ += a.theZ; theT += a.theT; return *this; } Value theX; Value theY; Value theZ; Value theT; }; inline LorentzVector operator+(LorentzVector a, const LorentzVector & b) { return a += b; } Value ex, et; LorentzVector sum() { LorentzVector v1; v1.theX =ex; v1.theY =ex+et; v1.theZ =ex-et; v1.theT =et; return v1+v1; } c++ -O2 -c ice47c.cc ice47c.cc: In function ‘LorentzVector sum()’: ice47c.cc:24:15: error: invalid rhs for gimple memory store a$theX v1$theX # .MEM_53 = VDEF <.MEM_13> a$theX = v1$theX; ice47c.cc:24:15: error: invalid rhs for gimple memory store a$theY v1$theY # .MEM_54 = VDEF <.MEM_53> a$theY = v1$theY; ice47c.cc:24:15: error: invalid rhs for gimple memory store a$theZ v1$theZ # .MEM_55 = VDEF <.MEM_54> a$theZ = v1$theZ; ice47c.cc:24:15: error: invalid rhs for gimple memory store a$theT v1$theT # .MEM_56 = VDEF <.MEM_55> a$theT = v1$theT; ice47c.cc:24:15: internal compiler error: verify_gimple failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
Thanks Vincenzo. Doesn't happen for __complex__ float, doesn't happen for < 4 components, thus seems related to the size of the struct.
This ICE is still present with revision 181800. It does block our tests and validation of 4.7
Mine. At the first glance it seems that load_assign_lhs_subreplacements cannot create assignment statements with grp_partial_lhs replacements on both sides.
Created attachment 25959 [details] Untested fix An untested fix. I will run it through bootstrap tomorrow and proceed to submit it if it passes. Sorry for the delay, I'm a bit busy lately.
Patch posted to mailing list: http://gcc.gnu.org/ml/gcc-patches/2011-12/msg00080.html
Author: jamborm Date: Fri Dec 2 12:53:03 2011 New Revision: 181908 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181908 Log: 2011-12-02 Martin Jambor <mjambor@suse.cz> PR tree-optimization/50622 * tree-sra.c (load_assign_lhs_subreplacements): Force gimple operand if both lacc and racc are grp_partial_lhs. * testsuite/g++.dg/tree-ssa/pr50622.C: New test. Added: trunk/gcc/testsuite/g++.dg/tree-ssa/pr50622.C Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-sra.c
Fixed.
Author: jamborm Date: Tue Dec 6 17:16:19 2011 New Revision: 182057 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182057 Log: 2011-12-06 Martin Jambor <mjambor@suse.cz> PR tree-optimization/50622 * tree-sra.c (load_assign_lhs_subreplacements): Force gimple operand if both lacc and racc are grp_partial_lhs. * testsuite/g++.dg/tree-ssa/pr50622.C: New test. Added: branches/gcc-4_6-branch/gcc/testsuite/g++.dg/tree-ssa/pr50622.C Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/testsuite/ChangeLog branches/gcc-4_6-branch/gcc/tree-sra.c