[llvm-bugs] [Bug 28864] New: crash on invalid C++ code on x86_64-linux-gnu (Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 5 01:36:46 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28864

            Bug ID: 28864
           Summary: crash on invalid C++ code on x86_64-linux-gnu
                    (Assertion `!isNull() && "Cannot retrieve a NULL type
                    pointer"' failed.)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ clang++-trunk -v
clang version 4.0.0 (trunk 277732)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.1.1
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang++-trunk small.C
small.C:6:8: error: cannot initialize a variable of type 'S *' with an lvalue
of type 'void () __attribute__((noreturn)) throw()'
    S *s = abort S[n];
       ^   ~~~~~
small.C:6:17: error: expected ';' at end of declaration
    S *s = abort S[n];
                ^
                ;
small.C:6:19: warning: decomposition declarations are a C++1z extension
[-Wc++1z-extensions]
    S *s = abort S[n];
                  ^~~
small.C:6:19: error: decomposition declaration cannot be declared with type
'S'; declared type must be 'auto' or reference to 'auto'
clang-4.0:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/include/clang/AST/Type.h:612:
const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const:
Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.
#0 0x0000000001b7d425 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1b7d425)
#1 0x0000000001b7b14e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1b7b14e)
#2 0x0000000001b7b2b2 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1b7b2b2)
#3 0x00007f81b414ded0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10ed0)
#4 0x00007f81b2ce21c8 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x331c8)
#5 0x00007f81b2ce364a abort (/lib/x86_64-linux-gnu/libc.so.6+0x3464a)
#6 0x00007f81b2cdb107 (/lib/x86_64-linux-gnu/libc.so.6+0x2c107)
#7 0x00007f81b2cdb1b2 (/lib/x86_64-linux-gnu/libc.so.6+0x2c1b2)
#8 0x0000000001d26c25 (/usr/local/clang-trunk/bin/clang-4.0+0x1d26c25)
#9 0x000000000296fdec clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec
const&, clang::DeclarationNameInfo const&, clang::NamedDecl*,
clang::NamedDecl*, clang::TemplateArgumentListInfo const*, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x296fdec)
#10 0x000000000297031e
clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&,
clang::LookupResult&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x297031e)
#11 0x00000000028a5d63 clang::Sema::ClassifyName(clang::Scope*,
clang::CXXScopeSpec&, clang::IdentifierInfo*&, clang::SourceLocation,
clang::Token const&, bool, std::unique_ptr<clang::CorrectionCandidateCallback,
std::default_delete<clang::CorrectionCandidateCallback> >)
(/usr/local/clang-trunk/bin/clang-4.0+0x28a5d63)
#12 0x00000000025f3abe clang::Parser::TryAnnotateName(bool,
std::unique_ptr<clang::CorrectionCandidateCallback,
std::default_delete<clang::CorrectionCandidateCallback> >)
(/usr/local/clang-trunk/bin/clang-4.0+0x25f3abe)
#13 0x000000000266e3cb
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-4.0+0x266e3cb)
#14 0x000000000266e65e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/local/clang-trunk/bin/clang-4.0+0x266e65e)
#15 0x0000000002671ac7 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2671ac7)
#16 0x0000000002671e95 clang::Parser::ParseCompoundStatement(bool, unsigned
int) (/usr/local/clang-trunk/bin/clang-4.0+0x2671e95)
#17 0x0000000002671ee2 clang::Parser::ParseCompoundStatement(bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2671ee2)
#18 0x000000000266e24a
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-4.0+0x266e24a)
#19 0x000000000266e65e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/local/clang-trunk/bin/clang-4.0+0x266e65e)
#20 0x0000000002671ac7 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2671ac7)
#21 0x0000000002673e09 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/local/clang-trunk/bin/clang-4.0+0x2673e09)
#22 0x00000000025f90a8
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-4.0+0x25f90a8)
#23 0x0000000002616926 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2616926)
#24 0x00000000025f5162
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-4.0+0x25f5162)
#25 0x00000000025f5821
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.158] [clone
.constprop.181] (/usr/local/clang-trunk/bin/clang-4.0+0x25f5821)
#26 0x00000000025f586f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-4.0+0x25f586f)
#27 0x00000000025fac0f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-4.0+0x25fac0f)
#28 0x00000000025fb549
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x25fb549)
#29 0x00000000025f0d0b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x25f0d0b)
#30 0x00000000022d9667 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x22d9667)
#31 0x0000000001fff7a6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x1fff7a6)
#32 0x0000000001fd3836
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1fd3836)
#33 0x0000000002083f47
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2083f47)
#34 0x0000000000941778 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0x941778)
#35 0x00000000008deb60 main (/usr/local/clang-trunk/bin/clang-4.0+0x8deb60)
#36 0x00007f81b2ccf730 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20730)
#37 0x000000000093dff9 _start (/usr/local/clang-trunk/bin/clang-4.0+0x93dff9)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-4.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.C -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/4.0.0 -c-isystem .
-c-isystem /usr/local/include/csmith -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1/../../../../include/c++/6.1.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1/../../../../include/x86_64-linux-gnu/c++/6.1.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1/../../../../include/x86_64-linux-gnu/c++/6.1.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/4.0.0/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/cnsun/workspace/meta-compiler/error-fuzzer/exp-runs/crash/20160729-clang++-trunk--O3-c-Weverything-std=c++14-build-141725
-ferror-limit 19 -fmessage-length 135 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/small-a0e0e1.o -x c++ small.C
1.    small.C:7:5: current parser token 'n'
2.    small.C:3:26: parsing function body '__attribute__doit'
3.    small.C:3:26: in compound statement ('{}')
4.    small.C:5:3: in compound statement ('{}')
clang-4.0: error: unable to execute command: Aborted
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 277732)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-4.0: 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-4.0: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /tmp/small-980b40.cpp
clang-4.0: note: diagnostic msg: /tmp/small-980b40.sh
clang-4.0: note: diagnostic msg:

********************
$
$ cat small.c
cat: small.c: No such file or directory
$ cat small.C
void abort() throw() __attribute__((__noreturn__));
struct S {};
void __attribute__doit() {
  int n;
  {
    S *s = abort S[n];
    n;
  }
}
$

-- 
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/20160805/07097eb1/attachment-0001.html>


More information about the llvm-bugs mailing list