[LLVMbugs] [Bug 20110] New: Some C++11 source code that makes clang choke.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 23 16:52:39 PDT 2014


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

            Bug ID: 20110
           Summary: Some C++11 source code that makes clang choke.
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: brent at brainiumstudios.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12697
  --> http://llvm.org/bugs/attachment.cgi?id=12697&action=edit
The files given in the crash log

This simple bit of (incorrect) code causes a crash.

template<char const * p> class c { char const * get_p() { return *p; } };

Brents-iMac:bin brent$ ./clang++ --std=c++11 ~/test.cpp 
Assertion failed: ((E->getType()->isAnyPointerType() ||
E->getType()->isBlockPointerType() || E->getType()->isObjCQualifiedIdType()) &&
"EvalAddr only works on pointers"), function EvalAddr, file
/Users/brent/llvm/tools/clang/lib/Sema/SemaChecking.cpp, line 4492.
0  clang                    0x00000001084c56ee
llvm::sys::PrintStackTrace(__sFILE*) + 46
1  clang                    0x00000001084c59fb
PrintStackTraceSignalHandler(void*) + 27
2  clang                    0x00000001084c5d8c SignalHandler(int) + 412
3  libsystem_platform.dylib 0x00007fff8b4015aa _sigtramp + 26
4  clang                    0x0000000104935f4c
llvm::StringMapIterator<clang::IdentifierInfo*>::StringMapIterator(llvm::StringMapEntryBase**,
bool) + 44
5  clang                    0x00000001084c5a2b raise + 27
6  clang                    0x00000001084c5ae2 abort + 18
7  clang                    0x00000001084c5ac1 __assert_rtn + 129
8  clang                    0x00000001050d1681 EvalAddr(clang::Expr*,
llvm::SmallVectorImpl<clang::DeclRefExpr*>&, clang::Decl*) + 257
9  clang                    0x00000001050d1c00 EvalAddr(clang::Expr*,
llvm::SmallVectorImpl<clang::DeclRefExpr*>&, clang::Decl*) + 1664
10 clang                    0x00000001050ba488
CheckReturnStackAddr(clang::Sema&, clang::Expr*, clang::QualType,
clang::SourceLocation) + 184
11 clang                    0x00000001050ba1cb
clang::Sema::CheckReturnValExpr(clang::Expr*, clang::QualType,
clang::SourceLocation, bool, llvm::SmallVector<clang::Attr*, 2u> const*,
clang::FunctionDecl const*) + 107
12 clang                    0x00000001054b24f2
clang::Sema::BuildReturnStmt(clang::SourceLocation, clang::Expr*) + 3954
13 clang                    0x00000001054b14fd
clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*,
clang::Scope*) + 45
14 clang                    0x0000000104f9eb21
clang::Parser::ParseReturnStatement() + 721
15 clang                    0x0000000104f99ae5
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2181
16 clang                    0x0000000104f99115
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 133
17 clang                    0x0000000104f9fbf7
clang::Parser::ParseCompoundStatementBody(bool) + 1399
18 clang                    0x0000000104fa0b98
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 328
19 clang                    0x0000000104f23c4f
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) + 1663
20 clang                    0x0000000104f235c4
clang::Parser::LexedMethod::ParseLexedMethodDefs() + 36
21 clang                    0x0000000104f22d41
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 321
22 clang                    0x0000000104f4c368
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) + 4616
23 clang                    0x0000000104f4acfc
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 9404
24 clang                    0x0000000104f2f636
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 10566
25 clang                    0x0000000104fa964a
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 490
26 clang                    0x0000000104fa91b7
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 1271
27 clang                    0x0000000104fa8b77
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 215
28 clang                    0x0000000104f2c7e0
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 464
29 clang                    0x0000000104fb9933
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2435
30 clang                    0x0000000104fb8f3f
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 703
31 clang                    0x0000000104f1f15b clang::ParseAST(clang::Sema&,
bool, bool) + 731
32 clang                    0x000000010498abfa
clang::ASTFrontendAction::ExecuteAction() + 522
33 clang                    0x0000000104e0565a
clang::CodeGenAction::ExecuteAction() + 3322
34 clang                    0x000000010498a668 clang::FrontendAction::Execute()
+ 120
35 clang                    0x000000010492694e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 990
36 clang                    0x0000000104864930
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3200
37 clang                    0x0000000104847560 cc1_main(char const**, char
const**, char const*, void*) + 2368
38 clang                    0x000000010485a7fa main + 858
39 libdyld.dylib            0x00007fff85cb55fd start + 1
Stack dump:
0.    Program arguments: /Users/brent/build/Debug+Asserts/bin/clang -cc1
-triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free
-main-file-name test.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim
-masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.4
-resource-dir /Users/brent/build/Debug+Asserts/bin/../lib/clang/3.5.0
-stdlib=libc++ --std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/Users/brent/build/Debug+Asserts/bin -ferror-limit 19 -fmessage-length 265
-stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0
-fencode-extended-block-signature -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/cj/rbdy34zs4c9dqm550sk2wf8r0000gn/T/test-a7acfa.o -x c++
/Users/brent/test.cpp 
1.    /Users/brent/test.cpp:1:68: current parser token ';'
2.    /Users/brent/test.cpp:1:26: parsing struct/union/class body 'c'
3.    /Users/brent/test.cpp:1:57: parsing function body 'get_p'
4.    /Users/brent/test.cpp:1:57: in compound statement ('{}')
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (trunk 211541)
Target: x86_64-apple-darwin13.2.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg:
/var/folders/cj/rbdy34zs4c9dqm550sk2wf8r0000gn/T/test-89b714.ii
clang: note: diagnostic msg:
/var/folders/cj/rbdy34zs4c9dqm550sk2wf8r0000gn/T/test-89b714.sh
clang: note: diagnostic msg: 

********************

-- 
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/20140623/15a8fee8/attachment.html>


More information about the llvm-bugs mailing list