]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/23929 (segfault in expand_simple_operations, tree-ssa-loop...
authorJakub Jelinek <jakub@redhat.com>
Tue, 20 Sep 2005 19:10:44 +0000 (21:10 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 20 Sep 2005 19:10:44 +0000 (21:10 +0200)
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.

From-SVN: r104461

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr23929.c [new file with mode: 0644]
gcc/tree-ssa-loop-niter.c

index 3a6a8dd5cc939e2e95a3dd6dae2ce84627819f51..f19cfdb44e2566c8a157a7a980b1336883148d8c 100644 (file)
@@ -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.
index a70e415a7384676f71c32d82d3bc7f7423b04341..382e26f5b54c157b7fa7ab3ddcad979b2fd7bf5c 100644 (file)
@@ -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 (file)
index 0000000..210bb58
--- /dev/null
@@ -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;
+       }
+}
index 544ead2850a6abde03dc4f789e8c0c9761d3f494..b720e1942014c417a93142f8705e9d2bb4cef327 100644 (file)
@@ -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);