[LLVMbugs] [Bug 9755] New: miscompile of switch

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 19 15:56:19 PDT 2011


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

           Summary: miscompile of switch
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu


This testcase is reduced from gperf:

  #include <stdlib.h>
  #include <stdio.h>

  int main(int argc, char **argv) {
    int option_char = 'm';

    switch (option_char) {
      case 'm':
        printf("Z m\n");
        break;
      default:
       printf("nonsense\n");
       exit(1);
    }
    exit(0);
  }

When built with "clang++ switch.cc -o switch" (at r129824), the program always
runs the 'm' case:

nlewycky at ducttape:~$ ./switch a
Z m
nlewycky at ducttape:~$ ./switch m
Z m

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