aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2011-07-28 18:26:23 -0400
committerDJ Delorie <dj@gcc.gnu.org>2011-07-28 18:26:23 -0400
commit69135c94b33fe4e0eebe40072f327a4e769848e7 (patch)
tree15d7f3142f4aa87ddf7448e66576026bcf9e33bd /gcc/expr.c
parent13a234421d1a68af668600893b31034c36b0a6e4 (diff)
downloadgcc-69135c94b33fe4e0eebe40072f327a4e769848e7.zip
gcc-69135c94b33fe4e0eebe40072f327a4e769848e7.tar.gz
gcc-69135c94b33fe4e0eebe40072f327a4e769848e7.tar.bz2
expr.c (expand_expr_addr_expr_1): Detect a user request for a local frame in a naked function...
* 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. From-SVN: r176904
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 59a20b7..0d88a21 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? */