[LLVMbugs] [Bug 14750] New: libgcc unwind code leads to "Using an undefined physical register"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Dec 29 15:03:37 PST 2012


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

             Bug #: 14750
           Summary: libgcc unwind code leads to "Using an undefined
                    physical register"
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Reduced testcase (with help from Joerg Sonnenberger, thanks):

========================================================================
a, b;
_Unwind_Resume_or_Rethrow ()
{
    if (b)
        return 0;
    a = _Unwind_ForcedUnwind_Phase2 ();
    a ? abort () : 0;
    __builtin_eh_return (0, 0);
}
========================================================================

compiling this with clang trunk r171006 at -O2 leads to:

========================================================================
# Machine code for function _Unwind_Resume_or_Rethrow: Post SSA
Function Live Outs: %EAX

BB#0: derived from LLVM BB %entry
        CMP32mi8 %noreg, 1, %noreg, <ga:@b>, %noreg, 0, %EFLAGS<imp-def>;
mem:LD4[@b](tbaa=!"int")
        JE_4 <BB#2>, %EFLAGS<imp-use,kill>
        JMP_4 <BB#1>
    Successors according to CFG: BB#2(1) BB#1(1048575)

BB#1: derived from LLVM BB %if.then
    Predecessors according to CFG: BB#0
        %EAX<def> = MOV32r0 %EFLAGS<imp-def,dead>
        RET %EAX<imp-use,kill>

BB#2: derived from LLVM BB %if.end
    Predecessors according to CFG: BB#0
        ADJCALLSTACKDOWN32 0, %ESP<imp-def>, %EFLAGS<imp-def,dead>,
%ESP<imp-use>
        CALLpcrel32 <ga:@_Unwind_ForcedUnwind_Phase2>, <regmask>,
%ESP<imp-use>, %ESP<imp-def>, %EAX<imp-def>
        ADJCALLSTACKUP32 0, 0, %ESP<imp-def>, %EFLAGS<imp-def,dead>,
%ESP<imp-use>
        %vreg1<def> = COPY %EAX; GR32:%vreg1
        MOV32mr %noreg, 1, %noreg, <ga:@a>, %noreg, %vreg1;
mem:ST4[@a](tbaa=!"int") GR32:%vreg1
        TEST32rr %vreg1<kill>, %vreg1, %EFLAGS<imp-def>; GR32:%vreg1
        JE_4 <BB#4>, %EFLAGS<imp-use,kill>
        JMP_4 <BB#3>
    Successors according to CFG: BB#4(1) BB#3(1)

BB#3: derived from LLVM BB %cond.true
    Predecessors according to CFG: BB#2
        ADJCALLSTACKDOWN32 0, %ESP<imp-def>, %EFLAGS<imp-def,dead>,
%ESP<imp-use>
        CALLpcrel32 <ga:@abort>, <regmask>, %ESP<imp-use>, %ESP<imp-def>
        ADJCALLSTACKUP32 0, 0, %ESP<imp-def>, %EFLAGS<imp-def,dead>,
%ESP<imp-use>

BB#4: derived from LLVM BB %cond.end
    Predecessors according to CFG: BB#2
        MOV32mi %EBP, 1, %noreg, 4, %noreg, 0; mem:ST4[<unknown>]
        %vreg3<def> = LEA32r %EBP, 1, %noreg, 4, %noreg; GR32:%vreg3
        %ECX<def> = COPY %vreg3<kill>; GR32:%vreg3
        EH_RETURN %ECX<kill>, %EAX<imp-use>

# End machine code for function _Unwind_Resume_or_Rethrow.

*** Bad machine code: Using an undefined physical register ***
- function:    _Unwind_Resume_or_Rethrow
- basic block: BB#4 cond.end (0x2a50d3e8)
- instruction: EH_RETURN %ECX<kill>, %EAX<imp-use>
- operand 1:   %EAX<imp-use>
fatal error: error in backend: Found 1 machine code errors.
========================================================================

-- 
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