Poor code for alloca
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro GCC |
Invalid
|
Undecided
|
Unassigned |
Bug Description
#include <alloca.h>
extern void bar(void *);
int foo(int i)
{
bar(alloca(i));
return 0;
}
$ arm-none-
arm-none-
$arm-none-
FSF GCC trunk generate codes:
foo:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
add r0, r0, #14
bic r0, r0, #7
stmfd sp!, {fp, lr}
add fp, sp, #4
sub sp, sp, r0
mov r0, sp
bl bar
mov r0, #0
sub sp, fp, #4
ldmfd sp!, {fp, pc}
The instructions for alignment are not necessary.
[CodeSourcery #1675]
tags: | added: size task |
Changed in gcc-linaro: | |
status: | New → Confirmed |
Changed in gcc-linaro: | |
status: | Confirmed → Invalid |
Code size will be reduced once this bug is fixed.