diff options
| author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-14 08:03:20 +0000 |
|---|---|---|
| committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-14 08:03:20 +0000 |
| commit | e67eeb37f0348526e45884ba9d4bc20e7d777537 (patch) | |
| tree | e6852849268e281a533559c3020d30399dfee543 /gcc/varasm.c | |
| parent | f932adc1c137c00970a94d039adfdffaf0373222 (diff) | |
| download | ppe42-gcc-e67eeb37f0348526e45884ba9d4bc20e7d777537.tar.gz ppe42-gcc-e67eeb37f0348526e45884ba9d4bc20e7d777537.zip | |
PR middle-end/18820
* varasm.c (initializer_constant_valid_p) <ADDR_EXPR>: Return
zero for nested functions needing a static chain or functions
with a non-constant address.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@93633 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
| -rw-r--r-- | gcc/varasm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index ba0aab553ed..8252f0e123f 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -3501,6 +3501,12 @@ initializer_constant_valid_p (tree value, tree endtype) && 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 (value + && TREE_CODE (value) == FUNCTION_DECL + && ((decl_function_context (value) && !DECL_NO_STATIC_CHAIN (value)) + || DECL_NON_ADDR_CONST_P (value))) + return NULL_TREE; return value; case VIEW_CONVERT_EXPR: |

