[llvm-bugs] [Bug 28609] New: Crash in CodeGen when processing default switch statement

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 18 20:33:38 PDT 2016


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: unassignedclangbugs at nondot.org
          Reporter: rtrieu at google.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160719/3c50616a/attachment.html>


More information about the llvm-bugs mailing list