aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr49309.C14
-rw-r--r--gcc/tree-mudflap.c2
4 files changed, 27 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a4a1a23..8a1bb94 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6201af5..3dfa812 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..6200763
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr49309.C
@@ -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()); }
+
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index bcd77e2..7b5ed4b 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -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;