On 06/01/2015 04:12 AM, Alexander Basov wrote:
Hi,
this patch fixes ICE when compiling naked functions for arm targets.
It prevents register allocation for non-register things like volatile,
float, BLKMode vars.
Tested on trunk with arm-v7ar-linux-gnueabi on qemu vexpress board.
-- Alexander
pr64744.patch
2015-06-01 Alexander Basov<coo...@gmail.com>
PR middle-end/64744
PR middle-end/48470
PR middle-end/43404
* gcc/cfgexpand.c (expand_one_var): Add check if stack is going to
be used in naked function.
* gcc/expr.c (expand_expr_addr_expr_1): Remove exscess checking
whether expression should not reside in MEM.
* gcc/function.c (use_register_for_decl): Do not use registers for
non-register things (volatile, float, BLKMode) in naked functions.
Lose the "gcc/" prefix on these entries as there's a ChangeLog in the
gcc/ subdirectory.
* gcc/testsuite/gcc.target/arm/pr43404.c : New testcase.
* gcc/testsuite/gcc.target/arm/pr48470.c : New testcase.
* gcc/testsuite/gcc.target/arm/pr64744-1.c : New testcase.
* gcc/testsuite/gcc.target/arm/pr64744-2.c : New testcase.
Similarly, lose the gcc/testsuite prefix on these entries as this will
be installed in gcc/testsuite/ChangeLog. However, do copy the PR markers.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index b190f91..c6db8a9 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1382,7 +1382,15 @@ expand_one_var (tree var, bool toplevel, bool
really_expand)
else
{
if (really_expand)
- expand_one_stack_var (origvar);
+ {
+ if (!targetm.calls.allocate_stack_slots_for_args ())
+ error ("cannot allocate stack for variable %q+D, naked function.",
+ var);
+
+ expand_one_stack_var (origvar);
+ }
So how do you know ORIGVAR is an argument here before issuing the error?
ie, shouldn't you verify that the underlying object is a PARM_DECL?
If there's some way we already know we're dealing with a PARM_DECL, then
just say so.
I'd rewrite the user_register_for_decl ChangeLog entry to
* function.c (use_register_for_decl): Correct location
of allocate_stack_slot_for_args test.
With those changes this should be ready to go, please make the updates
and repost.
Thanks,
jeff