[LLVMbugs] [Bug 7041] New: Crash without assert on invalid code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 4 08:29:26 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7041

           Summary: Crash without assert on invalid code
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chris at bubblescope.net
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=4820)
 --> (http://llvm.org/bugs/attachment.cgi?id=4820)
Crashing testcase

The attached test case crashes clang++. It came from reducing boost test cases,
but I am unsure if it would actually fix any boost problems.

/temp$ clang++ ~/Dropbox/crash_without_assert.cpp 
/Users/caj/Dropbox/crash_without_assert.cpp:2:1: error: expected unqualified-id
}
^
/Users/caj/Dropbox/crash_without_assert.cpp:2:1: error: expected external
declaration
/Users/caj/Dropbox/crash_without_assert.cpp:9:7: error: field has incomplete
type 'mutex' (aka 'posix_mutex')
mutex mutex_
      ^
/Users/caj/Dropbox/crash_without_assert.cpp:1:8: note: forward declaration of
'posix_mutex'
struct posix_mutex
       ^
/Users/caj/Dropbox/crash_without_assert.cpp:9:13: error: expected ';' at end of
declaration list
mutex mutex_
            ^
            ;
/Users/caj/Dropbox/crash_without_assert.cpp:9:13: error: expected '}'
/Users/caj/Dropbox/crash_without_assert.cpp:5:1: note: to match this '{'
{
^
0  clang             0x00f542d5 PrintStackTrace(void*) + 45
1  clang             0x00f5481f SignalHandler(int) + 374
2  libSystem.B.dylib 0x91cc842b _sigtramp + 43
3  libSystem.B.dylib 0xffffffff _sigtramp + 1848867839
4  clang             0x003228a7
clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity
const&, clang::InitializationKind const&,
clang::ASTMultiPtr<&(clang::ActionBase::DeleteExpr(void*))>, clang::QualType*)
+ 101
5  clang             0x002b0522 BuildImplicitMemberInitializer(clang::Sema&,
clang::CXXConstructorDecl*, ImplicitInitializerKind, clang::FieldDecl*,
clang::CXXBaseOrMemberInitializer*&) + 430
6  clang             0x002bd09d
clang::Sema::SetBaseOrMemberInitializers(clang::CXXConstructorDecl*,
clang::CXXBaseOrMemberInitializer**, unsigned int, bool) + 1543
7  clang             0x002bd75c
clang::Sema::ActOnDefaultCtorInitializers(clang::OpaquePtr<0>) + 100
8  clang             0x005c83ea
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 1284
9  clang             0x005dd01a
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int,
clang::OpaquePtr<0>) + 1534
10 clang             0x005de384
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool) + 4786
11 clang             0x005d1670
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 6508
12 clang             0x006103ab
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AttributeList*, clang::AccessSpecifier) + 85
13 clang             0x0061078c
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::AttributeList*,
clang::AccessSpecifier) + 66
14 clang             0x00612504
clang::Parser::ParseExternalDeclaration(clang::CXX0XAttributeList) + 2222
15 clang             0x0061264a
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<1>&) + 268
16 clang             0x0023ece9 clang::ParseAST(clang::Preprocessor&,
clang::ASTConsumer*, clang::ASTContext&, bool, bool,
clang::CodeCompleteConsumer*) + 426
17 clang             0x0006333b clang::ASTFrontendAction::ExecuteAction() + 269
18 clang             0x00063458 clang::FrontendAction::Execute() + 278
19 clang             0x000472eb
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 879
20 clang             0x0002a13b cc1_main(char const**, char const**, char
const*, void*) + 1979
21 clang             0x0002e03b main + 272
22 clang             0x00028e79 start + 53
Stack dump:
0.    Program arguments: /usr/local/bin/clang -cc1 -triple
i386-apple-darwin10.0.0 -S -disable-free -main-file-name
crash_without_assert.cpp -pic-level 1 -mdisable-fp-elim -target-cpu yonah
-resource-dir /usr/local/lib/clang/2.0 -ferror-limit 19
-ftemplate-backtrace-limit 10 -fmessage-length 133 -stack-protector 1 -fblocks
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/M8/M86fCFVgGQ0r-V2oY5lLC++++TI/-Tmp-/cc-j6zcE4.s -x c++
/Users/caj/Dropbox/crash_without_assert.cpp 
1.    /Users/caj/Dropbox/crash_without_assert.cpp:7:1: current parser token '{'
2.    /Users/caj/Dropbox/crash_without_assert.cpp:4:1: parsing
struct/union/class body 'descriptor_state'
clang: error: compiler command failed due to signal 10 (use -v to see
invocation)
~/temp$

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list