If function name is C clang crashes at clang/lib/StaticAnalyzer/Core/ObjCMessage.cc line 164
| Bugzilla Link | 12905 |
| Resolution | FIXED |
| Resolved on | May 21, 2012 15:59 |
| Version | trunk |
| OS | Linux |
| Attachments | File with fix. |
| Reporter | LLVM Bugzilla Contributor |
| CC | @d0k,@dwblaikie,@AnnaZaks |
Extended Description
Add check for FName size on line 164:
if (FName.size()!=1 && FName[0] == 'C' && (FName[1] == 'F' || FName[1] == 'G'))
mentioned in issue llvm/llvm-bugzilla-archive#32342
I filed internal bug: radar://11498291 for the assertion.
It's a bit tricky most of the errors come from the fact that the preprocessed source was generated from c++11 code on a linux machine. The crasher is reproducible with
$ clang -cc1 -analyze -analyzer-checker=core clang_crash_0P9Ceh.ii -std=c++11 -fcxx-exceptions
The other assertion failure you're seeing is probably worth filing a bug for. Looks like a crash-on-invalid.
This is the crash I am getting: atal error: too many errors emitted, stopping now [-ferror-limit=] Assertion failed: (D->isCompleteDefinition() && "Cannot layout type before complete!"), function getASTRecordLayout, file /Users/zaks/workspace/llvmgit/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp, line 2386. 0 clang 0x000000010bf6eeee _ZL15PrintStackTracePv + 46 1 clang 0x000000010bf6f499 _ZL13SignalHandleri + 297 2 libsystem_c.dylib 0x00007fff89527cfa _sigtramp + 26 3 libsystem_c.dylib 0x000004000b027186 _sigtramp + 18446607736443499686 4 clang 0x000000010bf6f1bb raise + 27 5 clang 0x000000010bf6f272 abort + 18 6 clang 0x000000010bf6f251 __assert_rtn + 129 7 clang 0x000000010b1cac4c clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const + 332 8 clang 0x000000010b1d5f6d (anonymous namespace)::EmptySubobjectMap::ComputeEmptySubobjectSizes() + 557 9 clang 0x000000010b1d5d2d (anonymous namespace)::EmptySubobjectMap::EmptySubobjectMap(clang::ASTContext const&, clang::CXXRecordDecl const*) + 125 10 clang 0x000000010b1cb275 (anonymous namespace)::EmptySubobjectMap::EmptySubobjectMap(clang::ASTContext const&, clang::CXXRecordDecl const*) + 37 11 clang 0x000000010b1cacb9 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const + 441 12 clang 0x000000010b1d5de2 (anonymous namespace)::EmptySubobjectMap::ComputeEmptySubobjectSizes() + 162 13 clang 0x000000010b1d5d2d (anonymous namespace)::EmptySubobjectMap::EmptySubobjectMap(clang::ASTContext const&, clang::CXXRecordDecl const*) + 125 14 clang 0x000000010b1cb275 (anonymous namespace)::EmptySubobjectMap::EmptySubobjectMap(clang::ASTContext const&, clang::CXXRecordDecl const*) + 37 15 clang 0x000000010b1cacb9 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const + 441 16 clang 0x000000010b0064d4 clang::ASTContext::getTypeInfoImpl(clang::Type const*) const + 2612 17 clang 0x000000010b0059d7 clang::ASTContext::getTypeInfo(clang::Type const*) const + 183 18 clang 0x000000010b006568 clang::ASTContext::getTypeInfoImpl(clang::Type const*) const + 2760 19 clang 0x000000010b0059d7 clang::ASTContext::getTypeInfo(clang::Type const*) const + 183 20 clang 0x000000010b027209 clang::ASTContext::getTypeAlign(clang::Type const*) const + 25 21 clang 0x000000010b00574f clang::ASTContext::getPreferredTypeAlign(clang::Type const*) const + 47 22 clang 0x000000010a8a6edb clang::Sema::BuildCXXNew(clang::SourceLocation, bool, clang::SourceLocation, clang::ASTMultiPtrclang::Expr*, clang::SourceLocation, clang::SourceRange, clang::QualType, clang::TypeSourceInfo*, clang::Expr*, clang::SourceRange, clang::Expr*, bool) + 5691 23 clang 0x000000010a88d0eb clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::RebuildCXXNewExpr(clang::SourceLocation, bool, clang::SourceLocation, clang::ASTMultiPtrclang::Expr*, clang::SourceLocation, clang::SourceRange, clang::QualType, clang::TypeSourceInfo*, clang::Expr*, clang::SourceRange, clang::Expr*) + 427 24 clang 0x000000010a87d64f clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCXXNewExpr(clang::CXXNewExpr*) + 2431 25 clang 0x000000010a871676 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 966 26 clang
Benjamin, were you able to reproduce this?
I see a bunch of errors followed by a non-analyzer related crash: clang -syntax-only ~/Downloads/clang_crash_0P9Ceh.ii
Fixed in r157204.
I get several errors, hit the error limit, and then the compiler stops cleanly (doesn't appear to crash).
What exact command line (& platform, etc) are you running? (hmm - you're only seeing this in the Static Analyzer?)
Could you provide a test case (ideally, make a patch file with both the new test case and the fix that succeeds with that test case, and send that on to cfe-commits)?
assigned to @tkremenek