aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-01-27 16:09:23 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2010-01-27 16:09:23 +0100
commitc6d99cad129c1d038c2b7d33e93e08dd36d4de87 (patch)
treea360ac6bb7bb20f7bf2e6d6f8310b464cb87507a /gcc/tree-inline.c
parent990dc016001e1b6b3fbd1d15a82d6054f5a7de38 (diff)
downloadgcc-c6d99cad129c1d038c2b7d33e93e08dd36d4de87.zip
gcc-c6d99cad129c1d038c2b7d33e93e08dd36d4de87.tar.gz
gcc-c6d99cad129c1d038c2b7d33e93e08dd36d4de87.tar.bz2
re PR middle-end/42874 (Error on correct code: sorry, unimplemented: function ‘foo’ can never be copied because it uses)
PR middle-end/42874 * tree-inline.c (cannot_copy_type_1): Removed. (copy_forbidden): Don't forbid copying of functions containing records/unions with variable length fields. * gcc.dg/vla-22.c: New test. From-SVN: r156287
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index e08842c..815d88a 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2730,39 +2730,6 @@ has_label_address_in_static_1 (tree *nodep, int *walk_subtrees, void *fnp)
return NULL_TREE;
}
-/* Callback through walk_tree. Determine if we've got an aggregate
- type that we can't support; return non-null if so. */
-
-static tree
-cannot_copy_type_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED)
-{
- tree t, node = *nodep;
-
- if (TREE_CODE (node) == RECORD_TYPE || TREE_CODE (node) == 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.
- 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.
-
- ??? This is likely no longer true, but it's too late in the 4.0
- cycle to try to find out. This should be checked for 4.1. */
- for (t = TYPE_FIELDS (node); t; t = TREE_CHAIN (t))
- if (variably_modified_type_p (TREE_TYPE (t), NULL))
- return node;
- }
-
- return NULL_TREE;
-}
-
-
/* Determine if the function can be copied. If so return NULL. If
not return a string describng the reason for failure. */
@@ -2805,16 +2772,6 @@ copy_forbidden (struct function *fun, tree fndecl)
"address of local label in a static variable");
goto fail;
}
-
- if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl)
- && variably_modified_type_p (TREE_TYPE (decl), NULL)
- && walk_tree_without_duplicates (&TREE_TYPE (decl),
- cannot_copy_type_1, NULL))
- {
- reason = G_("function %q+F can never be copied "
- "because it uses variable sized variables");
- goto fail;
- }
}
fail: