diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-25 17:26:52 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-25 17:26:52 +0000 |
commit | 64df2c88f96ff10cc75d8e21121e72a020468a44 (patch) | |
tree | f4aabed9d6786dc267e9c2ce167b8defec608eb0 /gcc/c-objc-common.c | |
parent | b7151a8b8bbd798c9c62349baee6b4fef6eed770 (diff) | |
download | gcc-64df2c88f96ff10cc75d8e21121e72a020468a44.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58535 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-objc-common.c')
-rw-r--r-- | gcc/c-objc-common.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index e279911acc0..2d67b8f21c0 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; } |