https://llvm.org/bugs/show_bug.cgi?id=28609

            Bug ID: 28609
           Summary: Crash in CodeGen when processing default switch
                    statement
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangb...@nondot.org
          Reporter: rtr...@google.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

$ cat small.c
void fn1() {
  switch (0)
  case 0:
  do {
  default:
  ;
  } while (0)
    ;
}
$ clang small.c
1.    <eof> parser at end of file
2.    small.c:1:6: LLVM IR generation of declaration 'fn1'
3.    small.c:1:6: Generating code for declaration 'fn1'
4.    small.c:4:6: LLVM IR generation of compound statement ('{}')

Backtrace:
#3 clang::CodeGen::CodeGenFunction::EmitDefaultStmt(clang::DefaultStmt const&)
#4 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*)
#5 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*)
#6
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
#7 clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
#8 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*)
#9 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*)

It looks like Clang was attempting to run CodeGen on a default statement.  But
when it attempted to find the related switch statement, it got a null pointer
instead and segfaulted.  Located at #3, CGStmt.cpp:1264, SwitchInsn is null.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to