Hi, PR 50622 is an omission in load_assign_lhs_subreplacements, which should force a gimple operand on a RHS of a gimple assignment if both sides are new replacements of scalar types which are not gimple registers, because they are partially modified (which can happen to complex numbers and bit-fields).
Fixed with the patch below. It passes bootstrap and testsuite on x86_64-linux, I am about to do the same on the 4.6 branch because I'd like to commit it there as well. OK for trunk and the 4.6 branch? Thanks, Martin 2011-12-01 Martin Jambor <mjam...@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. Index: src/gcc/tree-sra.c =================================================================== --- src.orig/gcc/tree-sra.c +++ src/gcc/tree-sra.c @@ -2692,6 +2692,10 @@ load_assign_lhs_subreplacements (struct rhs = get_access_replacement (racc); if (!useless_type_conversion_p (lacc->type, racc->type)) rhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR, lacc->type, rhs); + + if (racc->grp_partial_lhs && lacc->grp_partial_lhs) + rhs = force_gimple_operand_gsi (old_gsi, rhs, true, NULL_TREE, + true, GSI_SAME_STMT); } else { Index: src/gcc/testsuite/g++.dg/tree-ssa/pr50622.C =================================================================== --- /dev/null +++ src/gcc/testsuite/g++.dg/tree-ssa/pr50622.C @@ -0,0 +1,30 @@ +// { dg-do compile } +// { dg-options "-O2" } + +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; +}