From: DJ Delorie Date: Thu, 28 Jul 2011 22:26:23 +0000 (-0400) Subject: expr.c (expand_expr_addr_expr_1): Detect a user request for a local frame in a naked... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=69135c94b33fe4e0eebe40072f327a4e769848e7;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 371128808b3..015724c506d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2011-07-28 DJ Delorie + * 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. + * config/m32c/m32c.c (m32c_secondary_reload_class): Allow PSI registers to be reloaded in HI classes when the target is HI. 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? */