http://llvm.org/bugs/show_bug.cgi?id=22115

Marcus Comstedt <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #5 from Marcus Comstedt <[email protected]> ---
Hi.

Thanks.  I tried the fix, but it doesn't seem quite correct yet.

r30 is now saved in the stack frame, but the size of the stack frame is not
increased, so the saved value now overlaps another value?!

The code generated for foo() is now:

foo:
    mflr 0
    stw 31, -4(1)
    stw 30, -8(1)
    stw 0, 4(1)
    stwu 1, -16(1)
    mr 31, 1
    bl .L0$pb
.L0$pb:
    mflr 30
    lwz 3, .L0$poff-.L0$pb(30)
    add 30, 3, 30
    lwz 3, .LC1-.L.TOC.(30)
    lwz 3, 0(3)
    lwz 4, .LC3-.L.TOC.(30)
    crxor 6, 6, 6
    bl fprintf@PLT
    li 4, 0
    stw 3, 8(31)
    mr 3, 4
    addi 1, 1, 16
    lwz 0, 4(1)
    lwz 31, -4(1)
    lwz 30, -8(1)
    mtlr 0
    blr

So r30 is saved at -8(1), which is 8(31).  But this is also where the return
value of fprintf() is stored!  So on return r30 will have the value 4 (giving
a segfault)...

Am I missing something here?  I was only able to apply the patch to
PPCFrameLowering.cpp because the change to PPCISelDAGToDAG.cpp concerns small
pic which is not included in 3.5.0...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to