Assertion in tools/clang/include/clang/Serialization/ASTReader.h:1428 Funny thing: making the names shorter makes the assertion go away. % head ww.cc ww.h ==> ww.cc <== static zzzzzzzzzzzzzzzzzzzzzzzzzzzz const& b() { return a; } ==> ww.h <== static inline void xxxxxxxxxxxxxxxxxxxx(const char *file, int line) __attribute__((exclusive_lock_function("*"))) {} % clang -x c++-header ww.h -o ww.h.pch % clang -fsyntax-only -x c++ -include ww.h ww.cc clang-3.2: /home/kcc/llvm/tools/clang/include/clang/Serialization/ASTReader.h:1428: clang::Stmt* clang::ASTReader::ReadSubStmt(): Assertion `ReadingKind == Read_Stmt && "Should be called only during statement reading!"' failed. 0 clang-3.2 0x000000000128a49f 1 clang-3.2 0x000000000128c27a 2 libpthread.so.0 0x00007f10abaa08f0 3 libc.so.6 0x00007f10aaf93a75 gsignal + 53 4 libc.so.6 0x00007f10aaf975c0 abort + 384 5 libc.so.6 0x00007f10aaf8c941 __assert_fail + 241 6 clang-3.2 0x0000000001b8ea10 7 clang-3.2 0x0000000001b80a39 clang::ASTReader::ReadSubExpr() + 9 8 clang-3.2 0x0000000001b6dbae clang::ASTReader::ReadAttributes(clang::serialization::ModuleFile&, llvm::SmallVector<clang::Attr*, 2u>&, llvm::SmallVector<unsigned long, 64u> const&, unsigned int&) + 8110 9 clang-3.2 0x0000000001b7311d clang::ASTDeclReader::VisitDecl(clang::Decl*) + 1373 10 clang-3.2 0x0000000001b74359 clang::ASTDeclReader::VisitNamedDecl(clang::NamedDecl*) + 25 11 clang-3.2 0x0000000001b769fe clang::ASTDeclReader::VisitValueDecl(clang::ValueDecl*) + 30 12 clang-3.2 0x0000000001b76c33 clang::ASTDeclReader::VisitDeclaratorDecl(clang::DeclaratorDecl*) + 35 13 clang-3.2 0x0000000001b7a06b clang::ASTDeclReader::VisitFunctionDecl(clang::FunctionDecl*) + 219 14 clang-3.2 0x0000000001b7bb00 clang::ASTDeclReader::Visit(clang::Decl*) + 32 15 clang-3.2 0x0000000001b7c650 clang::ASTReader::ReadDeclRecord(unsigned int) + 960 16 clang-3.2 0x0000000001b32885 clang::ASTReader::GetDecl(unsigned int) + 101 17 clang-3.2 0x0000000001b3d69a clang::ASTReader::SetGloballyVisibleDecls(clang::IdentifierInfo*, llvm::SmallVectorImpl<unsigned int> const&, bool) + 170 18 clang-3.2 0x0000000001b43f15 clang::serialization::reader::ASTIdentifierLookupTrait::ReadData(std::pair<char const*, unsigned int> const&, unsigned char const*, unsigned int) + 869 19 clang-3.2 0x0000000001b444c0 20 clang-3.2 0x0000000001bd47a2 clang::serialization::ModuleManager::visit(bool (*)(clang::serialization::ModuleFile&, void*), void*) + 738 21 clang-3.2 0x0000000001b3eb9e clang::ASTReader::get(char const*, char const*) + 62 22 clang-3.2 0x00000000019a74a5 23 clang-3.2 0x00000000019b043d clang::Sema::CorrectTypo(clang::DeclarationNameInfo const&, clang::Sema::LookupNameKind, clang::Scope*, clang::CXXScopeSpec*, clang::CorrectionCandidateCallback&, clang::DeclContext*, bool, clang::ObjCObjectPointerType const*) + 4029 24 clang-3.2 0x000000000186a6e4 clang::Sema::DiagnoseUnknownTypeName(clang::IdentifierInfo*&, clang::SourceLocation, clang::Scope*, clang::CXXScopeSpec*, clang::OpaquePtr<clang::QualType>&) + 260 25 clang-3.2 0x000000000157cd1c clang::Parser::ParseImplicitInt(clang::DeclSpec&, clang::CXXScopeSpec*, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext) + 300 26 clang-3.2 0x0000000001571f1c clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, llvm::SmallVector<clang::Parser::LateParsedAttribute*, 2u>*) + 7884 27 clang-3.2 0x0000000001563218 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) + 104 28 clang-3.2 0x0000000001564a36 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) + 1046 29 clang-3.2 0x0000000001565be4 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 1908 30 clang-3.2 0x0000000001566172 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 194 31 clang-3.2 0x000000000155cb30 clang::ParseAST(clang::Sema&, bool, bool) + 304 32 clang-3.2 0x00000000014a83b1 clang::FrontendAction::Execute() + 145 33 clang-3.2 0x0000000001482bf9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 329 34 clang-3.2 0x000000000128e9e4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1700 35 clang-3.2 0x000000000066bd50 cc1_main(char const**, char const**, char const*, void*) + 944 36 clang-3.2 0x0000000000668411 main + 7393 37 libc.so.6 0x00007f10aaf7ec4d __libc_start_main + 253 38 clang-3.2 0x0000000000665029 Stack dump: 0. Program arguments: /usr/local/google/kcc/llvm_cmake/bin/clang-3.2 -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name ww.cc -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -resource-dir /usr/local/google/kcc/llvm_cmake/bin/../lib/clang/3.2 -include-pch ww.h.pch -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/x86_64-linux-gnu -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/backward -internal-isystem /usr/local/include -internal-isystem /usr/local/google/kcc/llvm_cmake/bin/../lib/clang/3.2/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/kcc/tmp/alexvod -ferror-limit 19 -fmessage-length 284 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -x c++ ww.cc 1. ww.cc:1:8: current parser token 'zzzzzzzzzzzzzzzzzzzzzzzzzzzz'
cloned to <rdar://problem/12584141>
Apparently we have no test reading the thread safety attributes from a PCH.
Fixed in r168017.