[llvm-bugs] [Bug 44735] New: Assertion `Val & & "isa<> used on a null pointer"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 31 10:39:58 PST 2020


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

            Bug ID: 44735
           Summary: Assertion `Val & & "isa<> used on a null pointer"'
                    failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: changochen1 at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Preprocess file:
---
# 1 "<built-in>"
# 1 "test1.c"
a() {
  struct b {
    struct b;
  } struct b {
---


Run script:(clang -x c -o poc poc.c)
---
# Crash reproducer for clang version 11.0.0
(https://github.com/llvm/llvm-project.git
56b7f595d2b402ff177ca42214325c8fdea10fb0)
# Driver args: "-x" "c" "test1.c" "-o" "test"
# Original command:  "/home/rxz226/llvm-project/bld_instru/bin/clang-11" "-cc1"
"-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test1.c" "-mrelocation-model" "static" "-mthread-model"
"posix" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math"
"-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"x86-64" "-dwarf-column-info" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-resource-dir"
"/home/rxz226/llvm-project/bld_instru/lib/clang/11.0.0" "-internal-isystem"
"/usr/local/include" "-internal-isystem"
"/home/rxz226/llvm-project/bld_instru/lib/clang/11.0.0/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-fdebug-compilation-dir" "/home/rxz226/fuzz_clang1/hangs/test"
"-ferror-limit" "19" "-fmessage-length" "0" "-fgnuc-version=4.2.1"
"-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics"
"-faddrsig" "-o" "/tmp/test1-83ca24.o" "-x" "c" "test1.c"
 "/home/rxz226/llvm-project/bld_instru/bin/clang-11" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test1.c" "-mrelocation-model" "static" "-mthread-model"
"posix" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math"
"-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"x86-64" "-dwarf-column-info" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-ferror-limit" "19" "-fmessage-length" "0"
"-fgnuc-version=4.2.1" "-fobjc-runtime=gcc" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-faddrsig" "-x" "c" "test1-3c73df.c"
---


Stack dump:
---
 #0 0x000000000681faf6 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:560:7
 #1 0x000000000681ac5e llvm::sys::RunSignalHandlers()
/home/rxz226/llvm-project/llvm/lib/Support/Signals.cpp:69:18
 #2 0x000000000681dd30 llvm::sys::CleanupOnSignal(unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:361:3
 #3 0x000000000662a5aa (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:80:5
 #4 0x000000000662a9e6
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:361:51
 #5 0x00007f0447486390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #6 0x00007f0445ff0428 raise
/build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #7 0x00007f0445ff202a abort /build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0
 #8 0x00007f0445fe8bd7 __assert_fail_base
/build/glibc-LK5gWL/glibc-2.23/assert/assert.c:92:0
 #9 0x00007f0445fe8c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#10 0x0000000008254861
(/home/rxz226/llvm-project/bld_instru/bin/clang+0x8254861)
#11 0x000000000c1a0139 llvm::isa_impl_wrap<clang::TagDecl, clang::Decl* const,
clang::Decl const*>::doit(clang::Decl* const&)
/home/rxz226/llvm-project/llvm/include/llvm/Support/Casting.h:122:12
#12 0x000000000c1a0139 bool llvm::isa<clang::TagDecl,
clang::Decl*>(clang::Decl* const&)
/home/rxz226/llvm-project/llvm/include/llvm/Support/Casting.h:142:0
#13 0x000000000c1a0139 llvm::cast_retty<clang::TagDecl, clang::Decl*>::ret_type
llvm::cast<clang::TagDecl, clang::Decl>(clang::Decl*)
/home/rxz226/llvm-project/llvm/include/llvm/Support/Casting.h:264:0
#14 0x000000000c1a0139 clang::Sema::ActOnTagStartDefinition(clang::Scope*,
clang::Decl*) /home/rxz226/llvm-project/clang/lib/Sema/SemaDecl.cpp:15784:0
#15 0x000000000bc2122a llvm::SmallVector<clang::Decl*, 32u>::SmallVector()
/home/rxz226/llvm-project/llvm/include/llvm/ADT/SmallVector.h:0:0
#16 0x000000000bc2122a
clang::Parser::ParseStructUnionBody(clang::SourceLocation,
clang::TypeSpecifierType, clang::Decl*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.cpp:4222:0
#17 0x000000000bc60e0d
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, c$
ang::Parser::ParsedAttributesWithRange&)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:1966:20
#18 0x000000000bc04059 clang::ParsedAttributesView::empty() const
/home/rxz226/llvm-project/clang/include/clang/Sema/ParsedAttr.h:0:0
#19 0x000000000bc04059
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) /home/rxz2$
6/llvm-project/clang/lib/Parse/ParseDecl.cpp:3939:0
#20 0x000000000bc03127
clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool,
clang::Parser::ForRangeInit*, clang::SourceLocation*) /home/rxz226/$
lvm-project/clang/lib/Parse/ParseDecl.cpp:1823:10
#21 0x000000000bc02cbd
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.cpp$
0:12
#22 0x000000000bd8bba6
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&) /home/$
xz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:0:13
#23 0x000000000bd8aff1 clang::ParsedAttributesView::empty() const
/home/rxz226/llvm-project/clang/include/clang/Sema/ParsedAttr.h:0:0
#24 0x000000000bd8aff1
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:109:0
#25 0x000000000bd9f27e clang::Parser::ParseCompoundStatementBody(bool)
/home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:1079:11
#26 0x000000000bda2138 clang::ActionResult<clang::Stmt*, true>::isInvalid()
const /home/rxz226/llvm-project/clang/include/clang/Sema/Ownership.h:0:0
#27 0x000000000bda2138 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
/home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:2207:0
#28 0x000000000bbc17c5
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:1349:10
#29 0x000000000bc11c0c clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.cpp:2069:16
#30 0x000000000bbbe8b9
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:0:10
#31 0x000000000bbbcfe9
clang::Parser::ObjCDeclContextSwitch::~ObjCDeclContextSwitch()
/home/rxz226/llvm-project/clang/include/clang/Parse/Parser.h:0:0
#32 0x000000000bbbcfe9
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:1126:0
#33 0x000000000bbbae53
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:945:12
#33 0x000000000bbbae53
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:945:12
#34 0x000000000bbb658c
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:696:10
#35 0x000000000bbb537c
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:564:26
#36 0x000000000bbaba50 clang::ParseAST(clang::Sema&, bool, bool)
/home/rxz226/llvm-project/clang/lib/Parse/ParseAST.cpp:157:15
#37 0x0000000007dff26a clang::ASTFrontendAction::ExecuteAction()
/home/rxz226/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1045:1
#38 0x000000000911b260 clang::CodeGenAction::ExecuteAction()
/home/rxz226/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1176:28
#39 0x0000000007dfd6b9 clang::FrontendAction::Execute()
/home/rxz226/llvm-project/clang/lib/Frontend/FrontendAction.cpp:940:10
#40 0x0000000007d39f27 llvm::Error::operator bool()
/home/rxz226/llvm-project/llvm/include/llvm/Support/Error.h:0:0
#41 0x0000000007d39f27
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/rxz226/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:965:0
#42 0x00000000080c5534 clang::CompilerInstance::getFrontendOpts()
/home/rxz226/llvm-project/clang/include/clang/Frontend/CompilerInstance.h:0:0
#43 0x00000000080c5534
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/rxz226/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:291:0
#44 0x0000000000a7ac38 llvm::TimeTraceScope::~TimeTraceScope()
/home/rxz226/llvm-project/llvm/include/llvm/Support/TimeProfiler.h:0:0
#45 0x0000000000a7ac38 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/rxz226/llvm-project/clang/tools/driver/cc1_main.cpp:240:0
#46 0x0000000000a6c1fb ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/home/rxz226/llvm-project/clang/tools/driver/driver.cpp:328:12
#47 0x0000000007acd530
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1::operator()() const
/home/rxz226/llvm-project/clang/lib/Driver/Job.cpp:402:30
...
---

-- 
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/20200131/62f15c0f/attachment.html>


More information about the llvm-bugs mailing list