aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2011-01-11 07:10:54 -0700
committerJeff Law <law@gcc.gnu.org>2011-01-11 07:10:54 -0700
commit9f9ca914cc827c34816c71afb04e920ad5243156 (patch)
tree7d96c9b801698d379786ad586c07da8c7dc931f8 /gcc
parenta67e7daab5abd73d150874c62812ae94f093fbe3 (diff)
downloadgcc-9f9ca914cc827c34816c71afb04e920ad5243156.zip
gcc-9f9ca914cc827c34816c71afb04e920ad5243156.tar.gz
gcc-9f9ca914cc827c34816c71afb04e920ad5243156.tar.bz2
re PR tree-optimization/47086 (ICE: verify_flow_info failed: BB 3 can not throw but has an EH edge with -O -fexceptions -fnon-call-exceptions -ftrapv)
* PR tree-optimization/47086 * tree-ssa-loop-ivopts.c (find_givs_in_stmt_scev): Do not record IVs from statements that might throw. * PR tree-optimization/47086 * gcc.dg/pr47086.c: New test. From-SVN: r168659
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr47086.c14
-rw-r--r--gcc/tree-ssa-loop-ivopts.c8
4 files changed, 32 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e565b2e..b372b6c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-11 Jeff Law <law@redhat.com>
+
+ * PR tree-optimization/47086
+ * tree-ssa-loop-ivopts.c (find_givs_in_stmt_scev): Do not record
+ IVs from statements that might throw.
+
2011-01-10 Jan Hubicka <jh@suse.cz>
PR lto/45375
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 64f7ad0..710431c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-11 Jeff Law <law@redhat.com>
+
+ * PR tree-optimization/47086
+ * gcc.dg/pr47086.c: New test.
+
2011-01-11 Jason Merrill <jason@redhat.com>
PR c++/46658
diff --git a/gcc/testsuite/gcc.dg/pr47086.c b/gcc/testsuite/gcc.dg/pr47086.c
new file mode 100644
index 0000000..71743fe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr47086.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fexceptions -fnon-call-exceptions -ftrapv" } */
+
+void
+foo ()
+{
+ int n = 0;
+ while (1)
+ {
+ int i[n % 1];
+ n++;
+ }
+}
+
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 59e2fef..479b46f 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1,5 +1,5 @@
/* Induction variable optimizations.
- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GCC.
@@ -1102,6 +1102,12 @@ find_givs_in_stmt_scev (struct ivopts_data *data, gimple stmt, affine_iv *iv)
|| contains_abnormal_ssa_name_p (iv->step))
return false;
+ /* If STMT could throw, then do not consider STMT as defining a GIV.
+ While this will suppress optimizations, we can not safely delete this
+ GIV and associated statements, even if it appears it is not used. */
+ if (stmt_could_throw_p (stmt))
+ return false;
+
return true;
}