summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-20 19:10:44 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-20 19:10:44 +0000
commit73a991443f15b27ad2705034699beec4ff8106c6 (patch)
tree13704f74fe1fa61712fb5d3b304d3cde911db3ea
parentb11b935ef39cbade11a97718a79381786de2803f (diff)
downloadgcc-73a991443f15b27ad2705034699beec4ff8106c6.tar.gz
PR tree-optimization/23929
* tree-ssa-loop-niter.c (expand_simple_operations): Return immediately if expr is NULL. * gcc.c-torture/compile/pr23929.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104461 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr23929.c21
-rw-r--r--gcc/tree-ssa-loop-niter.c6
4 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3a6a8dd5cc9..f19cfdb44e2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2005-09-20 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/23929
+ * tree-ssa-loop-niter.c (expand_simple_operations): Return immediately
+ if expr is NULL.
+
PR tree-optimization/23818
* tree-stdarg.c (execute_optimize_stdarg): Call
calculate_dominance_info.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a70e415a738..382e26f5b54 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-09-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/23929
+ * gcc.c-torture/compile/pr23929.c: New test.
+
2005-09-20 Steve Ellcey <sje@cup.hp.com>
PR testsuite/23186
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23929.c b/gcc/testsuite/gcc.c-torture/compile/pr23929.c
new file mode 100644
index 00000000000..210bb585e06
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr23929.c
@@ -0,0 +1,21 @@
+/* PR tree-optimization/23929 */
+
+extern void bar (char *);
+
+void
+foo (int n, char *z)
+{
+ char b[2048];
+ int x, y;
+
+ bar (b);
+ for (y = 0; y < 60; y++)
+ if (n == 600)
+ for (x = 0; x < 320;)
+ {
+ *z++ = b[x];
+ x += 1;
+ *z++ = b[x];
+ x += 1;
+ }
+}
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 544ead2850a..b720e194201 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -634,11 +634,15 @@ expand_simple_operations (tree expr)
{
unsigned i, n;
tree ret = NULL_TREE, e, ee, stmt;
- enum tree_code code = TREE_CODE (expr);
+ enum tree_code code;
+
+ if (expr == NULL_TREE)
+ return expr;
if (is_gimple_min_invariant (expr))
return expr;
+ code = TREE_CODE (expr);
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
{
n = TREE_CODE_LENGTH (code);