[LLVMbugs] [Bug 14449] New: !isNull() && "Cannot retrieve a NULL type pointer"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 28 14:39:51 PST 2012


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

             Bug #: 14449
           Summary: !isNull() && "Cannot retrieve a NULL type pointer"
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: snubdodecahedron at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


clang++ crashes when compiling the following program:

template<class T> struct A {};
template<class T> struct B:public A<T> {};
template<class T> void f(B<const T> p);
void g() {f(B<int>());}

How to compile: clang++ -c prog.cpp

$ clang++ -v
clang version 3.2 (trunk 156016) (llvm/trunk 156015)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Diagnostics:
prog.cpp:4:11: error: no matching function for call to 'f'
void g() {f(B<int>());}
          ^
clang:
/home/craig/llvm/projects/llvm/tools/clang/lib/Sema/../../include/clang/AST/Type.h:505:
const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const:
Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.
0  clang           0x0000000001f3feef
1  clang           0x0000000001f40a2a
2  libpthread.so.0 0x00007f50b4810cb0
3  libc.so.6       0x00007f50b3a62425 gsignal + 53
4  libc.so.6       0x00007f50b3a65b8b abort + 379
5  libc.so.6       0x00007f50b3a5b0ee
6  libc.so.6       0x00007f50b3a5b192
7  clang           0x0000000000b85142
8  clang           0x0000000000ba3ca0
9  clang           0x0000000000ba571f
clang::OverloadCandidateSet::NoteCandidates(clang::Sema&,
clang::OverloadCandidateDisplayKind, llvm::ArrayRef<clang::Expr*>, char const*,
clang::SourceLocation) + 431
10 clang           0x0000000000baafea
clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*,
clang::UnresolvedLookupExpr*, clang::SourceLocation, clang::Expr**, unsigned
int, clang::SourceLocation, clang::Expr*, bool) + 1722
11 clang           0x0000000000af5124 clang::Sema::ActOnCallExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, clang::ASTMultiPtr<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool) + 1412
12 clang           0x00000000009305bd
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 2717
13 clang           0x000000000092832b clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 203
14 clang           0x000000000092b7cd clang::Parser::ParseCastExpression(bool,
bool, clang::Parser::TypeCastState) + 29
15 clang           0x000000000092cb8f
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 31
16 clang           0x000000000092dba9
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 9
17 clang           0x0000000000966255 clang::Parser::ParseExprStatement() + 69
18 clang           0x0000000000960ef3
clang::Parser::ParseStatementOrDeclarationAfterAttributes(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 1075
19 clang           0x0000000000961b1e
clang::Parser::ParseStatementOrDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 142
20 clang           0x000000000095da2c
clang::Parser::ParseCompoundStatementBody(bool) + 524
21 clang           0x000000000095e85d
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 141
22 clang           0x00000000009005a0
clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&,
llvm::SmallVector<clang::Parser::LateParsedAttribute*, 2u>*) + 1680
23 clang           0x000000000090c5cf
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2623
24 clang           0x00000000008fafd8
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 152
25 clang           0x00000000008fb7ae
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 798
26 clang           0x00000000008fed48
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 3080
27 clang           0x00000000008ff304
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 180
28 clang           0x00000000008f3efd clang::ParseAST(clang::Sema&, bool, bool)
+ 205
29 clang           0x0000000000784c24 clang::CodeGenAction::ExecuteAction() +
68
30 clang           0x0000000000639cd4
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 340
31 clang           0x000000000061ed18
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1240
32 clang           0x00000000006147c9 cc1_main(char const**, char const**, char
const*, void*) + 6905
33 clang           0x000000000061db83 main + 7539
34 libc.so.6       0x00007f50b3a4d76d __libc_start_main + 237
35 clang           0x0000000000612139
Stack dump:
0.    Program arguments: /home/craig/bin/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
prog.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.21.0.20110327 -momit-leaf-frame-pointer -coverage-file prog.o -resource-dir
/home/craig/bin/bin/../lib/clang/3.2 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem /usr/local/include -internal-isystem
/home/craig/bin/bin/../lib/clang/3.2/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home/craig/cc -ferror-limit 19 -fmessage-length 159
-mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-fragile-abi -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o prog.o -x c++ prog.cpp 
1.    prog.cpp:4:21: current parser token ')'
2.    prog.cpp:4:10: parsing function body 'g'
3.    prog.cpp:4:10: in compound statement ('{}')
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)

-- 
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