[LLVMbugs] [Bug 671] NEW: switch statement miscompilation

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Nov 28 16:50:33 PST 2005


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=671

           Summary: switch statement miscompilation
           Product: libraries
           Version: 1.6
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Miscellaneous Instrumentation passes
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: markus at oberhumer.com


llvm 1.6 miscompiles the switch statement below. Looking at the C output it does
incorrectly cast v to unsigned.

~Markus


#include <stdio.h>

int foo(long long v) {
    switch (v) {
    case 0:
        return 1;
    case -1:
        return 2;
    }
    return 0;
}

int main() {
    int r = foo(4294967295LL);
    printf("foo = %d\n", r);
    return r;
}



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