Created attachment 8469 [details] Source-file for generating the ast-file Emitting an ast-file by compiling the attached "test.m"-file clang -emit-ast test.m Compile the art-file clang -c test.ast Results in ---------------------------------------- Assertion failed: (SwitchCaseStmts[ID] == 0 && "Already have a SwitchCase with this ID"), function RecordSwitchCaseID, file /Users/raiserescue/develop/tmp/llvm/tools/clang/lib/Serialization/ASTReader.cpp, line 6231. 0 clang 0x00000001092b7ffe _ZL15PrintStackTracePv + 46 1 clang 0x00000001092b85a9 _ZL13SignalHandleri + 297 2 libsystem_c.dylib 0x00007fff9352ecfa _sigtramp + 26 3 libsystem_c.dylib 0x000004000d403a60 _sigtramp + 18446607736313302400 4 clang 0x00000001092b82cb raise + 27 5 clang 0x00000001092b8382 abort + 18 6 clang 0x00000001092b8361 __assert_rtn + 129 7 clang 0x000000010744a963 clang::ASTReader::RecordSwitchCaseID(clang::SwitchCase*, unsigned int) + 131 8 clang 0x00000001074ac400 clang::ASTStmtReader::VisitSwitchCase(clang::SwitchCase*) + 128 9 clang 0x00000001074ac43f clang::ASTStmtReader::VisitCaseStmt(clang::CaseStmt*) + 47 10 clang 0x00000001074c0809 clang::StmtVisitorBase<clang::make_ptr, clang::ASTStmtReader, void>::Visit(clang::Stmt*) + 4345 11 clang 0x00000001074ba175 clang::ASTReader::ReadStmtFromStream(clang::serialization::ModuleFile&) + 17973 12 clang 0x00000001074b5afd clang::ASTReader::ReadStmt(clang::serialization::ModuleFile&) + 77 13 clang 0x000000010748fa0e clang::ASTDeclReader::VisitObjCMethodDecl(clang::ObjCMethodDecl*) + 142 14 clang 0x0000000107499cee clang::DeclVisitor<clang::ASTDeclReader, void>::Visit(clang::Decl*) + 494 15 clang 0x00000001074854ca clang::ASTDeclReader::Visit(clang::Decl*) + 42 16 clang 0x0000000107497f9f clang::ASTReader::ReadDeclRecord(unsigned int) + 2495 17 clang 0x000000010743c27c clang::ASTReader::GetDecl(unsigned int) + 396 18 clang 0x0000000107478890 clang::ASTReader::GetLocalDecl(clang::serialization::ModuleFile&, unsigned int) + 64 19 clang 0x00000001074448c6 (anonymous namespace)::FindExternalLexicalDeclsVisitor::visit(clang::serialization::ModuleFile&, bool, void*) + 374 20 clang 0x000000010751b6a0 _ZL15visitDepthFirstRN5clang13serialization10ModuleFileEPFbS2_bPvES3_RN4llvm11SmallPtrSetIPS1_Lj4EEE + 272 21 clang 0x000000010751b52a clang::serialization::ModuleManager::visitDepthFirst(bool (*)(clang::serialization::ModuleFile&, bool, void*), void*) + 154 22 clang 0x00000001074446e7 clang::ASTReader::FindExternalLexicalDecls(clang::DeclContext const*, bool (*)(clang::Decl::Kind), llvm::SmallVectorImpl<clang::Decl*>&) + 103 23 clang 0x000000010744497f non-virtual thunk to clang::ASTReader::FindExternalLexicalDecls(clang::DeclContext const*, bool (*)(clang::Decl::Kind), llvm::SmallVectorImpl<clang::Decl*>&) + 63 24 clang 0x00000001083d00cc clang::ExternalASTSource::FindExternalLexicalDecls(clang::DeclContext const*, llvm::SmallVectorImpl<clang::Decl*>&) + 76 25 clang 0x00000001083cce4f clang::DeclContext::LoadLexicalDeclsFromExternalStorage() const + 239 26 clang 0x00000001083cd45f clang::DeclContext::decls_begin() const + 47 27 clang 0x000000010747c2ec clang::ObjCContainerDecl::meth_begin() const + 28 28 clang 0x0000000107445ef8 _ZL26PassObjCImplDeclToConsumerPN5clang12ObjCImplDeclEPNS_11ASTConsumerE + 120 29 clang 0x0000000107445e3a clang::ASTReader::PassInterestingDeclToConsumer(clang::Decl*) + 74 30 clang 0x000000010744b3ce clang::ASTReader::FinishedDeserializing() + 334 31 clang 0x000000010744b40c non-virtual thunk to clang::ASTReader::FinishedDeserializing() + 28 32 clang 0x000000010747e4f9 clang::ExternalASTSource::Deserializing::~Deserializing() + 25 33 clang 0x0000000107454c45 clang::ExternalASTSource::Deserializing::~Deserializing() + 21 34 clang 0x00000001074983af clang::ASTReader::ReadDeclRecord(unsigned int) + 3535 35 clang 0x000000010743c27c clang::ASTReader::GetDecl(unsigned int) + 396 36 clang 0x0000000107446033 clang::ASTReader::StartTranslationUnit(clang::ASTConsumer*) + 131 37 clang 0x000000010744609f non-virtual thunk to clang::ASTReader::StartTranslationUnit(clang::ASTConsumer*) + 47 38 clang 0x00000001076d3546 clang::ParseAST(clang::Sema&, bool, bool) + 310 39 clang 0x0000000107387dd8 clang::ASTFrontendAction::ExecuteAction() + 312 40 clang 0x0000000107667922 clang::CodeGenAction::ExecuteAction() + 1266 41 clang 0x00000001073879ec clang::FrontendAction::Execute() + 236 42 clang 0x00000001073521ca clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 890 43 clang 0x0000000107324f41 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 961 44 clang 0x000000010730e929 cc1_main(char const**, char const**, char const*, void*) + 969 45 clang 0x000000010731ecf9 main + 473 46 clang 0x000000010730e534 start + 52 47 clang 0x000000000000002b start + 18446744069293939499 Stack dump: 0. Program arguments: /Users/raiserescue/develop/tmp/build-llvm/Debug+Asserts/bin/clang -cc1 -triple x86_64-apple-macosx10.7.0 -emit-obj -mrelax-all -disable-free -main-file-name test.ast -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 127.2 -coverage-file test.o -resource-dir /Users/raiserescue/develop/tmp/build-llvm/Debug+Asserts/bin/../lib/clang/3.2 -fdebug-compilation-dir /Users/raiserescue/develop/tmp -ferror-limit 19 -fmessage-length 212 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fdiagnostics-show-option -fcolor-diagnostics -o test.o -x ast test.ast 1. <eof> parser at end of file clang: error: unable to execute command: Illegal instruction: 4 clang: error: clang frontend command failed due to signal (use -v to see invocation) clang: note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/ and include command line arguments and all diagnostic information. clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs. ---------------------------------------- Curiously i can't reproduce it with ast-files generated from C/C++-code.
Fixed in r156056.
The patch causes a bug in an other situation - should i post it within this report and append another test-file, or should i open a new report?
If it is related to switch/case post it here.
Created attachment 8487 [details] Second testfile - after patch Emitting the ast-file and compiling it like the first test file, it fails with Assertion failed: (SwitchCaseStmts[ID] != 0 && "No SwitchCase with this ID"), function getSwitchCaseWithID, file /Users/raiserescue/develop/thirdparty/llvm/tools/clang/lib/Serialization/ASTReader.cpp It only occurs if in the first case is an objc-method is called which is not declared within the interface/extension of the class.
Thanks for the test cases! Fixed in r156145.