summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authordj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-28 22:26:23 +0000
committerdj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-28 22:26:23 +0000
commit5b9418fd3ffd035203553fcd4fb316fe16521767 (patch)
tree15d7f3142f4aa87ddf7448e66576026bcf9e33bd /gcc/expr.c
parent5a4f6e8c9b6ba00b14b100f689886706c125eb36 (diff)
downloadgcc-5b9418fd3ffd035203553fcd4fb316fe16521767.tar.gz
* expr.c (expand_expr_addr_expr_1): Detect a user request for a
local frame in a naked function, and produce a suitable error for that specific case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176904 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 59a20b79edf..0d88a21fded 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7088,7 +7088,16 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
/* If the DECL isn't in memory, then the DECL wasn't properly
marked TREE_ADDRESSABLE, which will be either a front-end
or a tree optimizer bug. */
- gcc_assert (MEM_P (result));
+
+ if (TREE_ADDRESSABLE (exp)
+ && ! MEM_P (result)
+ && ! targetm.calls.allocate_stack_slots_for_args())
+ {
+ error ("local frame unavailable (naked function?)");
+ return result;
+ }
+ else
+ gcc_assert (MEM_P (result));
result = XEXP (result, 0);
/* ??? Is this needed anymore? */