From cb3d2e3327e9901d85095799343fad46e0588594 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 3 Aug 2011 20:49:40 +0200 Subject: [PATCH] re PR tree-optimization/49948 (ICE with -ftree-parallelize-loops: "address taken, but ADDRESSABLE bit not set") 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 | 5 +++++ gcc/gimple.c | 14 ++++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr49948.c | 22 ++++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr49948.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63aef194f90..2b707389247 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-08-03 Jakub Jelinek + + PR tree-optimization/49948 + * gimple.c (walk_stmt_load_store_addr_ops): Walk CONSTRUCTOR elements. + 2011-08-03 Anatoly Sokolov * config/m32c/m32c.c (class_sizes): Remove. diff --git a/gcc/gimple.c b/gcc/gimple.c index af23c6a3fc9..561e41e4582 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7578370b1d1..92b1b8d5c45 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-08-03 Jakub Jelinek + + PR tree-optimization/49948 + * gcc.dg/pr49948.c: New test. + 2011-08-03 H.J. Lu PR middle-end/47383 diff --git a/gcc/testsuite/gcc.dg/pr49948.c b/gcc/testsuite/gcc.dg/pr49948.c new file mode 100644 index 00000000000..f7423938053 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr49948.c @@ -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; +} -- 2.30.2