This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
arm-elf bad code generation
- To: richard dot earnshaw at arm dot com, nickc at cygnus dot com
- Subject: arm-elf bad code generation
- From: Philip Blundell <pb at futuretv dot com>
- Date: Tue, 22 Aug 2000 15:44:54 +0100
- Cc: gcc-bugs at gcc dot gnu dot org
The current version of GCC produces this assembler output for the attached
testcase (with -O2 -march=armv4 -fno-omit-frame-pointer) on arm-elf:
tcp_send:
@ args = 12, pretend = 0, frame = 32
@ frame_needed = 1, current_function_anonymous_args = 0
mov ip, sp
stmfd sp!, {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
sub fp, ip, #4
ldr ip, [fp, #12]
str r1, [fp, #-44]
mov r5, r0
mov r1, #20
str ip, [fp, #-56]
sub sp, sp, #32
strb r1, [r5, #48]
[...]
The decrement of SP has been moved quite a long way down the function. As a
result, there is a time during which arguments are stored on the stack at
locations below the current stack pointer. A signal (or in my case interrupt,
since this testcase is derived from kernel code) corrupts this part of the
stack frame and hence the locals end up with the wrong value.
p.
tcp.i.bz2