Commit fe663f4e by Richard Henderson Committed by Richard Henderson

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
parent 9b87db3c
2009-09-16 Richard Henderson <rth@redhat.com>
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.
2009-09-16 Michael Matz <matz@suse.de>
PR fortran/41212
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment