[LLVMbugs] [Bug 1219] NEW: switch lowering miscompiles a switch stmt

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Feb 23 17:28:50 PST 2007


           Summary: switch lowering miscompiles a switch stmt
           Product: libraries
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org

>From Anton: switch lowering is still broken somehow.

Consider the folowing code:

define i32 @main(i32 %argc, i8** %argv) {
        br label %cond_next
        %not.tmp14 = icmp slt i32 %argc, 11
        %hvar2 = zext i1 %not.tmp14 to i32
        switch i32 %hvar2, label %old_entry [
                 i32 -2, label %cond_true
                 i32 -1, label %cond_next
                 i32 0, label %cond_true15
                 i32 1, label %cond_next22
        ret i32 1
        ret i32 2
        ret i32 3
        ret i32 4

(Yes, I know, that cases -1 and -2 are really dead).

Resulting binary will always produce result code 4. Commenting out "-1" and "-2"
cases will fix the problem.

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the llvm-bugs mailing list