Commit 38ee6ed9 by Jason Merrill

(expand_expr, case *_DECL): If we make a non-local reference from a function…

(expand_expr, case *_DECL): If we make a non-local reference from a function with DECL_NO_STATIC_CHAIN set, abort.

(expand_expr, case *_DECL): If we make a non-local
        reference from a function with DECL_NO_STATIC_CHAIN set, abort.
        (expand_expr, case ADDR_EXPR): We don't need a trampoline for a
        function with DECL_NO_STATIC_CHAIN set.

From-SVN: r11461
parent e115e436
...@@ -4678,6 +4678,8 @@ expand_expr (exp, target, tmode, modifier) ...@@ -4678,6 +4678,8 @@ expand_expr (exp, target, tmode, modifier)
/* Mark as non-local and addressable. */ /* Mark as non-local and addressable. */
DECL_NONLOCAL (exp) = 1; DECL_NONLOCAL (exp) = 1;
if (DECL_NO_STATIC_CHAIN (current_function_decl))
abort ();
mark_addressable (exp); mark_addressable (exp);
if (GET_CODE (DECL_RTL (exp)) != MEM) if (GET_CODE (DECL_RTL (exp)) != MEM)
abort (); abort ();
...@@ -6770,7 +6772,8 @@ expand_expr (exp, target, tmode, modifier) ...@@ -6770,7 +6772,8 @@ expand_expr (exp, target, tmode, modifier)
/* Are we taking the address of a nested function? */ /* Are we taking the address of a nested function? */
if (TREE_CODE (TREE_OPERAND (exp, 0)) == FUNCTION_DECL if (TREE_CODE (TREE_OPERAND (exp, 0)) == FUNCTION_DECL
&& decl_function_context (TREE_OPERAND (exp, 0)) != 0) && decl_function_context (TREE_OPERAND (exp, 0)) != 0
&& ! DECL_NO_STATIC_CHAIN (TREE_OPERAND (exp, 0)))
{ {
op0 = trampoline_address (TREE_OPERAND (exp, 0)); op0 = trampoline_address (TREE_OPERAND (exp, 0));
op0 = force_operand (op0, target); op0 = force_operand (op0, target);
......
...@@ -4379,9 +4379,10 @@ lookup_static_chain (decl) ...@@ -4379,9 +4379,10 @@ lookup_static_chain (decl)
tree context = decl_function_context (decl); tree context = decl_function_context (decl);
tree link; tree link;
if (context == 0) if (context == 0
|| (TREE_CODE (decl) == FUNCTION_DECL && DECL_NO_STATIC_CHAIN (decl)))
return 0; return 0;
/* We treat inline_function_decl as an alias for the current function /* We treat inline_function_decl as an alias for the current function
because that is the inline function whose vars, types, etc. because that is the inline function whose vars, types, etc.
are being merged into the current function. are being merged into the current function.
...@@ -4851,7 +4852,8 @@ init_function_start (subr, filename, line) ...@@ -4851,7 +4852,8 @@ init_function_start (subr, filename, line)
/* Nonzero if this is a nested function that uses a static chain. */ /* Nonzero if this is a nested function that uses a static chain. */
current_function_needs_context current_function_needs_context
= (decl_function_context (current_function_decl) != 0); = (decl_function_context (current_function_decl) != 0
&& ! DECL_NO_STATIC_CHAIN (current_function_decl));
/* Set if a call to setjmp is seen. */ /* Set if a call to setjmp is seen. */
current_function_calls_setjmp = 0; current_function_calls_setjmp = 0;
......
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