aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-01-12 12:11:40 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2009-01-12 12:11:40 +0100
commitc2152239ace246c45e1ec2b50af196762d18782a (patch)
tree203935620a9c02e05010b2cbf1b3c8f3d04c7d50 /gcc
parent0e510b3e4e3a6998f65b33b7f5b238abed2587d1 (diff)
downloadgcc-c2152239ace246c45e1ec2b50af196762d18782a.zip
gcc-c2152239ace246c45e1ec2b50af196762d18782a.tar.gz
gcc-c2152239ace246c45e1ec2b50af196762d18782a.tar.bz2
re PR tree-optimization/38807 (ice: gimple check: expected gimple_assign(error_mark), have gimple_phi())
PR tree-optimization/38807 * tree-ssa-reassoc.c (remove_visited_stmt_chain): Don't look at gimple_visited_p unless stmt is GIMPLE_ASSIGN. * gcc.c-torture/compile/pr38807.c: New test. From-SVN: r143289
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr38807.c23
-rw-r--r--gcc/tree-ssa-reassoc.c5
4 files changed, 37 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ba53e7d..715cbfb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/38807
+ * tree-ssa-reassoc.c (remove_visited_stmt_chain): Don't look at
+ gimple_visited_p unless stmt is GIMPLE_ASSIGN.
+
2009-01-11 Adam Nemet <anemet@caviumnetworks.com>
* expmed.c (store_bit_field_1): Properly truncate the paradoxical
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 41f53a9..260504a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/38807
+ * gcc.c-torture/compile/pr38807.c: New test.
+
2009-01-11 Adam Nemet <anemet@caviumnetworks.com>
* gcc.target/mips/ins-2.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38807.c b/gcc/testsuite/gcc.c-torture/compile/pr38807.c
new file mode 100644
index 0000000..8b05d08
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr38807.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/38807 */
+
+int
+baz (short x)
+{
+ return x;
+}
+
+int a, b;
+
+int
+bar (int x)
+{
+ if (baz (a ^ x ^ a))
+ return b;
+ return 0;
+}
+
+int
+foo (void)
+{
+ return bar (a == 0 || 1 == 1 - a) ? 1 : bar (1 && a);
+}
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index d539398..d28e1b6 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1,5 +1,5 @@
/* Reassociation for trees.
- Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dan@dberlin.org>
This file is part of GCC.
@@ -1279,7 +1279,8 @@ remove_visited_stmt_chain (tree var)
if (TREE_CODE (var) != SSA_NAME || !has_zero_uses (var))
return;
stmt = SSA_NAME_DEF_STMT (var);
- if (!gimple_visited_p (stmt))
+ if (!is_gimple_assign (stmt)
+ || !gimple_visited_p (stmt))
return;
var = gimple_assign_rhs1 (stmt);
gsi = gsi_for_stmt (stmt);