aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr47743.c22
-rw-r--r--gcc/tree-ssa-pre.c6
4 files changed, 39 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 600f680..c360d46 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-15 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/47743
+ * tree-ssa-pre.c (phi_translate_1): If we didn't get a value-number
+ for a non-type-compatible VN lookup bail out.
+
2011-02-15 Nathan Froyd <froydnj@codesourcery.com>
* config/fr30/constraints.md: New file.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1c15f63..e60f6db 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-15 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/47743
+ * gcc.dg/torture/pr47743.c: New testcase.
+
2011-02-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/47581
diff --git a/gcc/testsuite/gcc.dg/torture/pr47743.c b/gcc/testsuite/gcc.dg/torture/pr47743.c
new file mode 100644
index 0000000..1930e94
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr47743.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+
+int
+foo (void *x, int y)
+{
+ long long a = 1, *b;
+ double *c;
+ if (y)
+ {
+ b = (long long *) x;
+ while (b)
+ a *= *b++;
+ }
+ else
+ {
+ c = (double *) x;
+ while (c)
+ a *= *c++;
+ }
+ return a;
+}
+
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 3056723..f246643 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -1691,6 +1691,12 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
result = fold_build1 (VIEW_CONVERT_EXPR, ref->type, result);
converted = true;
}
+ else if (!result && newref
+ && !useless_type_conversion_p (ref->type, newref->type))
+ {
+ VEC_free (vn_reference_op_s, heap, newoperands);
+ return NULL;
+ }
if (result && is_gimple_min_invariant (result))
{