re PR tree-optimization/49309 (ICE with -fmudflap: verify_stmts failed: type mismatch...
authorAndrew Pinski <pinskia@gmail.com>
Thu, 14 Jul 2011 20:23:36 +0000 (13:23 -0700)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Thu, 14 Jul 2011 20:23:36 +0000 (13:23 -0700)
2011-07-14  Andrew Pinski  <pinskia@gmail.com>

PR tree-opt/49309
* tree-mudflap.c (mf_xform_derefs_1 <case MEM_REF>):
Use fold_build2_loc instead of build2.
Use the correct type for the new tree.

2011-07-14  Andrew Pinski  <pinskia@gmail.com>

PR tree-opt/49309
* g++.dg/torture/pr49309.C: New testcase.

From-SVN: r176281

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr49309.C [new file with mode: 0644]
gcc/tree-mudflap.c

index a4a1a23d3f4758738877086ba56fb75a55863cd2..8a1bb94b5f2e5c84a1c1a20685ca5c0330f8a193 100644 (file)
@@ -1,3 +1,10 @@
+2011-07-14  Andrew Pinski  <pinskia@gmail.com>
+
+       PR tree-opt/49309
+       * tree-mudflap.c (mf_xform_derefs_1 <case MEM_REF>):
+       Use fold_build2_loc instead of build2.
+       Use the correct type for the new tree.
+
 2011-07-14  Bernd Schmidt  <bernds@codesourcery.com>
 
        PR rtl-optimization/11320
index 6201af5dd6c6744fb797fd67a756feeff3dddcb0..3dfa8126c88411407efc87c3159da4f1763dea35 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-14  Andrew Pinski  <pinskia@gmail.com>
+
+       PR tree-opt/49309
+       * g++.dg/torture/pr49309.C: New testcase.
+
 2011-07-14  Bernd Schmidt  <bernds@codesourcery.com>
 
        * gcc.dg/pr48770.c: Add dg-require-effective-target fpic.
diff --git a/gcc/testsuite/g++.dg/torture/pr49309.C b/gcc/testsuite/g++.dg/torture/pr49309.C
new file mode 100644 (file)
index 0000000..6200763
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fmudflap"  } */
+struct A
+{
+  int i;
+
+  A();
+  A(const A&);
+};
+
+inline void foo(A a) { a = A(); }
+
+void bar() { foo(A()); }
+
index bcd77e27bd9a7ba2bea509c35587232eabdcbda7..7b5ed4b70a91efeb45fc386cfb8f95f18b515df1 100644 (file)
@@ -869,7 +869,7 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
       break;
 
     case MEM_REF:
-      addr = build2 (POINTER_PLUS_EXPR, TREE_TYPE (TREE_OPERAND (t, 1)),
+      addr = fold_build2_loc (location, POINTER_PLUS_EXPR, TREE_TYPE (TREE_OPERAND (t, 0)),
                     TREE_OPERAND (t, 0),
                     fold_convert (sizetype, TREE_OPERAND (t, 1)));
       base = addr;