aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-objc-common.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2002-10-25 17:26:52 +0000
committerZack Weinberg <zack@gcc.gnu.org>2002-10-25 17:26:52 +0000
commitf3763a442e854320fd233fd63b7871f301f723be (patch)
treef4aabed9d6786dc267e9c2ce167b8defec608eb0 /gcc/c-objc-common.c
parent6eb359685e52f13a7c6236184300b43e5a4d7ca6 (diff)
downloadgcc-f3763a442e854320fd233fd63b7871f301f723be.zip
gcc-f3763a442e854320fd233fd63b7871f301f723be.tar.gz
gcc-f3763a442e854320fd233fd63b7871f301f723be.tar.bz2
re PR c++/6994 (ICE in find_function_data)
PR middle-end/6994 * c-objc-common.c (inline_forbidden_p): Can not inline functions containing structures or unions containing VLAs. * tree-inline.c (walk_tree): For all class 't' nodes, walk TYPE_SIZE and TYPE_SIZE_UNIT. (copy_tree_r): Copy types if they are variably modified. * g++.dg/ext/vla1.C, gcc.dg/vla-2.c: New tests. From-SVN: r58535
Diffstat (limited to 'gcc/c-objc-common.c')
-rw-r--r--gcc/c-objc-common.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c
index e279911..2d67b8f 100644
--- a/gcc/c-objc-common.c
+++ b/gcc/c-objc-common.c
@@ -133,6 +133,22 @@ inline_forbidden_p (nodep, walk_subtrees, fn)
break;
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ /* We cannot inline a function of the form
+
+ void F (int i) { struct S { int ar[i]; } s; }
+
+ Attempting to do so produces a catch-22 in tree-inline.c.
+ If walk_tree examines the TYPE_FIELDS chain of RECORD_TYPE/
+ UNION_TYPE nodes, then it goes into infinite recursion on a
+ structure containing a pointer to its own type. If it doesn't,
+ then the type node for S doesn't get adjusted properly when
+ F is inlined, and we abort in find_function_data. */
+ for (t = TYPE_FIELDS (node); t; t = TREE_CHAIN (t))
+ if (variably_modified_type_p (TREE_TYPE (t)))
+ return node;
+
default:
break;
}