re PR tree-optimization/49948 (ICE with -ftree-parallelize-loops: "address taken...
authorJakub Jelinek <jakub@redhat.com>
Wed, 3 Aug 2011 18:49:40 +0000 (20:49 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 3 Aug 2011 18:49:40 +0000 (20:49 +0200)
PR tree-optimization/49948
* gimple.c (walk_stmt_load_store_addr_ops): Walk CONSTRUCTOR elements.

* gcc.dg/pr49948.c: New test.

From-SVN: r177291

gcc/ChangeLog
gcc/gimple.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr49948.c [new file with mode: 0644]

index 63aef194f90acdf58b7d5a890a240f4f573cff01..2b7073892475f450a303fa80630c889712a48654 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/49948
+       * gimple.c (walk_stmt_load_store_addr_ops): Walk CONSTRUCTOR elements.
+
 2011-08-03  Anatoly Sokolov  <aesok@post.ru>
 
        * config/m32c/m32c.c (class_sizes): Remove.
index af23c6a3fc987867911bdd0f3883664141ca0d7e..561e41e45826d351992b9c74f0dd2afdc15d8f3c 100644 (file)
@@ -5259,6 +5259,20 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
                   && TREE_CODE (OBJ_TYPE_REF_OBJECT (rhs)) == ADDR_EXPR)
            ret |= visit_addr (stmt, TREE_OPERAND (OBJ_TYPE_REF_OBJECT (rhs),
                                                   0), data);
+         else if (TREE_CODE (rhs) == CONSTRUCTOR)
+           {
+             unsigned int ix;
+             tree val;
+
+             FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (rhs), ix, val)
+               if (TREE_CODE (val) == ADDR_EXPR)
+                 ret |= visit_addr (stmt, TREE_OPERAND (val, 0), data);
+               else if (TREE_CODE (val) == OBJ_TYPE_REF
+                        && TREE_CODE (OBJ_TYPE_REF_OBJECT (val)) == ADDR_EXPR)
+                 ret |= visit_addr (stmt,
+                                    TREE_OPERAND (OBJ_TYPE_REF_OBJECT (val),
+                                                  0), data);
+           }
           lhs = gimple_assign_lhs (stmt);
          if (TREE_CODE (lhs) == TARGET_MEM_REF
               && TREE_CODE (TMR_BASE (lhs)) == ADDR_EXPR)
index 7578370b1d15768bc517afb48b3817f6a0bc9592..92b1b8d5c45bc9ad3953ac2e0a063dede982c3d0 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/49948
+       * gcc.dg/pr49948.c: New test.
+
 2011-08-03  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR middle-end/47383
diff --git a/gcc/testsuite/gcc.dg/pr49948.c b/gcc/testsuite/gcc.dg/pr49948.c
new file mode 100644 (file)
index 0000000..f742393
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR tree-optimization/49948 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -ftree-parallelize-loops=2" } */
+
+extern int a, *b;
+int
+foo (void)
+{
+  int c, d = 8, *e[8], i;
+  if (a <= 7)
+    {
+      for (i = 0; i < 8; ++i)
+       e[i] = &c;
+      while (--d)
+       {
+         a = 0;
+         b = e[0];
+       }
+      return 0;
+    }
+  return b == &d;
+}