aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2009-09-16 09:26:55 -0700
committerRichard Henderson <rth@gcc.gnu.org>2009-09-16 09:26:55 -0700
commitfe663f4e45fc2041ede2b6011fa43b3bd621a70d (patch)
tree9c8b5d51425dfcd062aa4b34755ad43e82f11eb8 /gcc/tree-cfg.c
parent9b87db3c0fc95b7f76fcdc38e21371dff155ee4b (diff)
downloadgcc-fe663f4e45fc2041ede2b6011fa43b3bd621a70d.zip
gcc-fe663f4e45fc2041ede2b6011fa43b3bd621a70d.tar.gz
gcc-fe663f4e45fc2041ede2b6011fa43b3bd621a70d.tar.bz2
re PR target/41246 (should "sorry" when regparm=3 and nested functions are encountered)
PR target/41246 * tree-cfg.c (verify_gimple_call): Validate that * gimple_call_chain is set only if DECL_NO_STATIC_CHAIN is unset. * tree-nested.c (iter_nestinfo_start, iter_nestinfo_next): New. (FOR_EACH_NEST_INFO): New. (walk_all_functions): Use it. (finalize_nesting_tree): Likewise. (unnest_nesting_tree): Likewise. (free_nesting_tree): Use iter_nestinfo_start, iter_nestinfo_next. (get_chain_decl, get_chain_field): Reset DECL_NO_STATIC_CHAIN. (convert_gimple_call): Early out if gimple_call_chain already set. (convert_all_function_calls): Iterate until no new functions require a static chain. (finalize_nesting_tree_1): Assert DECL_NO_STATIC_CHAIN is unset when building a trampoline. Use dump_function_to_file instead of dump_function. (lower_nested_functions): Open dump_file. Validate that decls that have DECL_NO_STATIC_CHAIN from the front end don't have that bit reset by this pass. From-SVN: r151762
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index f596c75..ef5f322 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3573,6 +3573,25 @@ verify_gimple_call (gimple stmt)
return true;
}
+ /* If there is a static chain argument, this should not be an indirect
+ call, and the decl should not have DECL_NO_STATIC_CHAIN set. */
+ if (gimple_call_chain (stmt))
+ {
+ if (TREE_CODE (fn) != ADDR_EXPR
+ || TREE_CODE (TREE_OPERAND (fn, 0)) != FUNCTION_DECL)
+ {
+ error ("static chain in indirect gimple call");
+ return true;
+ }
+ fn = TREE_OPERAND (fn, 0);
+
+ if (DECL_NO_STATIC_CHAIN (fn))
+ {
+ error ("static chain with function that doesn't use one");
+ return true;
+ }
+ }
+
/* ??? The C frontend passes unpromoted arguments in case it
didn't see a function declaration before the call. So for now
leave the call arguments unverified. Once we gimplify