[LLVMbugs] [Bug 6696] New: ebp wrongly clobbered - causes SingleSource/Regression/C/casts.c to crash

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 24 14:42:40 PDT 2010


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

           Summary: ebp wrongly clobbered - causes
                    SingleSource/Regression/C/casts.c to crash
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: baldrick at free.fr
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=4583)
 --> (http://llvm.org/bugs/attachment.cgi?id=4583)
testcase .ll

On x86-32 linux, SingleSource/Regression/C/casts.c crashes with a segmentation
fault.  This blocks the 2.7 release, since it is a regression from 2.6.
Reduced testcase attached.

The problem seems to be as follows (assembler generated by: llc
mulches_ebp.bc):

At the start of "main" the stack pointer is saved in ebp:

main:                                   # @main
# BB#0:                                 # %entry
        pushl   %ebp
        movl    %esp, %ebp

Somewhere in the middle of the function ebp is used as a scratch register,
clobbering the original value:

        call    printf
        movswl  %bx, %ebp
        movl    %ebp, 8(%esp)

At the end of the function esp is restored from ebp, but gets the wrong
value because ebp was clobbered.

        movl    %ebp, %esp
        popl    %ebp
        ret
        .size   main, .-main

This causes a prompt crash.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list