This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

arm-elf bad code generation


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]