re PR tree-optimization/50622 (ICE: verify_gimple failed for std::complex<double>)
authorMartin Jambor <mjambor@suse.cz>
Fri, 2 Dec 2011 12:53:03 +0000 (13:53 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Fri, 2 Dec 2011 12:53:03 +0000 (13:53 +0100)
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.

From-SVN: r181908

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/pr50622.C [new file with mode: 0644]
gcc/tree-sra.c

index 0a15c03..5e55919 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2011-12-01  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        PR target/50814.
index cd9e27e..2d3dc33 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-02  Martin Jambor  <mjambor@suse.cz>
+
+       PR tree-optimization/50622
+       * g++.dg/tree-ssa/pr50622.C: New test.
+
 2011-12-01  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/cpp0x/initlist61.C: New.
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr50622.C b/gcc/testsuite/g++.dg/tree-ssa/pr50622.C
new file mode 100644 (file)
index 0000000..d7f4fa7
--- /dev/null
@@ -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;
+}
index 472ad5d..dec5316 100644 (file)
@@ -2692,6 +2692,10 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc,
              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
            {