[LLVMbugs] [Bug 9796] New: no lines for empty case statement

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 25 16:22:51 PDT 2011


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

           Summary: no lines for empty case statement
           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: dpatel at apple.com, llvmbugs at cs.uiuc.edu


Consider this small C program:

  #include <stdlib.h>

  int main(int argc, char**argv) {
    int x = atoi(argv[1]);

    switch(x) {
      case 1:
        break;
    }

    return 0;
  }

When you build this and step through it with a debugger (pass "1" in argv[1]),
you'll find that you go straight from "switch(x) {" to "return 0;".

Fixing this is complicated because clang doesn't generate a distinct block in
LLVM IR for this, it's actually creating a switch with default block ->
%sw.epilog and i32 1 -> %sw.epilog.

(As a related issue, "case X:" and "default:" lines never get any debug info
associated with them either. I'm not sure whether that's intentional or not.)

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