diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-25 22:42:49 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-25 22:42:49 +0000 |
commit | 939e9bf1bf48c73472583b60cb57cb962b617274 (patch) | |
tree | 1a3f8d2557f13dd05aa93e2ca0e800b6a5a115c6 /gcc/varasm.c | |
parent | c50688b2bac252df730e3c3af294ec1a82453e2e (diff) | |
download | gcc-939e9bf1bf48c73472583b60cb57cb962b617274.tar.gz |
* tree-nested.c (convert_tramp_reference) <ADDR_EXPR>: Do not
build a trampoline if we don't want one.
* varasm.c (initializer_constant_valid_p) <ADDR_EXPR>: Do not
return zero for nested functions if we don't want a trampoline.
ada/
* trans.c (Attribute_to_gnu) <Code_Address>: Set TREE_NO_TRAMPOLINE
instead of TREE_STATIC on the ADDR_EXPR.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135884 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index d9468c4997d..2202ce11098 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4099,25 +4099,29 @@ initializer_constant_valid_p (tree value, tree endtype) case ADDR_EXPR: case FDESC_EXPR: - value = staticp (TREE_OPERAND (value, 0)); - if (value) - { - /* "&(*a).f" is like unto pointer arithmetic. If "a" turns out to - be a constant, this is old-skool offsetof-like nonsense. */ - if (TREE_CODE (value) == INDIRECT_REF - && TREE_CONSTANT (TREE_OPERAND (value, 0))) - return null_pointer_node; - /* Taking the address of a nested function involves a trampoline. */ - if (TREE_CODE (value) == FUNCTION_DECL - && decl_function_context (value) - && !DECL_NO_STATIC_CHAIN (value)) - return NULL_TREE; - /* "&{...}" requires a temporary to hold the constructed - object. */ - if (TREE_CODE (value) == CONSTRUCTOR) - return NULL_TREE; - } - return value; + { + tree op0 = staticp (TREE_OPERAND (value, 0)); + if (op0) + { + /* "&(*a).f" is like unto pointer arithmetic. If "a" turns out + to be a constant, this is old-skool offsetof-like nonsense. */ + if (TREE_CODE (op0) == INDIRECT_REF + && TREE_CONSTANT (TREE_OPERAND (op0, 0))) + return null_pointer_node; + /* Taking the address of a nested function involves a trampoline, + unless we don't need or want one. */ + if (TREE_CODE (op0) == FUNCTION_DECL + && decl_function_context (op0) + && !DECL_NO_STATIC_CHAIN (op0) + && !TREE_NO_TRAMPOLINE (value)) + return NULL_TREE; + /* "&{...}" requires a temporary to hold the constructed + object. */ + if (TREE_CODE (op0) == CONSTRUCTOR) + return NULL_TREE; + } + return op0; + } case VIEW_CONVERT_EXPR: case NON_LVALUE_EXPR: |