[llvm-bugs] [Bug 46485] New: Clang crash in clang/include/clang/AST/Type.h:7223: const T *clang::Type::castAs() const [T = clang::TagType]: Assertion `isa<T>(CanonicalType)' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 27 19:05:47 PDT 2020


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

            Bug ID: 46485
           Summary: Clang crash in clang/include/clang/AST/Type.h:7223:
                    const T *clang::Type::castAs() const [T =
                    clang::TagType]: Assertion `isa<T>(CanonicalType)'
                    failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: haoxintu at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

This code, bug.cc, reduced by C-Reduce, makes Clang crashed.

$cat bug.cc
a ( ( throw ) -> b <


$clang++ bug.cc
bug.cc:1:1: error: C++ requires a type specifier for all declarations
a ( ( throw ) -> b <
^
clang-11:
/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master-assert/clang/include/clang/AST/Type.h:7223:
const T *clang::Type::castAs() const [T = clang::TagType]: Assertion
`isa<T>(CanonicalType)' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments:
/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name bug.cc -mrelocation-model static -mframe-pointer=all
-fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining
-debugger-tuning=gdb -resource-dir
/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/lib/clang/11.0.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/lib/clang/11.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/haoxin/compilers/new-scg/new-scg-build/map_test/clang-test/creduce
-ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions
-fcolor-diagnostics -faddrsig -o /tmp/bug-eb19a7.o -x c++ bug.cc 
1.      bug.cc:1:18: current parser token 'b'
 #0 0x00000000026e32c4 PrintStackTraceSignalHandler(void*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x26e32c4)
 #1 0x00000000026e0eae llvm::sys::RunSignalHandlers()
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x26e0eae)
 #2 0x00000000026e35e5 SignalHandler(int)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x26e35e5)
 #3 0x00007f1daf6f3390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #4 0x00007f1dae25d428 raise
/build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #5 0x00007f1dae25f02a abort /build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0
 #6 0x00007f1dae255bd7 __assert_fail_base
/build/glibc-LK5gWL/glibc-2.23/assert/assert.c:92:0
 #7 0x00007f1dae255c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
 #8 0x00000000044e64c1 clang::TagType const*
clang::Type::castAs<clang::TagType>() const
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x44e64c1)
 #9 0x00000000044e4473 clang::Sema::LookupTemplateName(clang::LookupResult&,
clang::Scope*, clang::CXXScopeSpec&, clang::QualType, bool, bool&,
clang::Sema::RequiredTemplateKind, clang::Sema::AssumedTemplateKind*, bool)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x44e4473)
#10 0x00000000044e4023 clang::Sema::isTemplateName(clang::Scope*,
clang::CXXScopeSpec&, bool, clang::UnqualifiedId const&,
clang::OpaquePtr<clang::QualType>, bool,
clang::OpaquePtr<clang::TemplateName>&, bool&, bool)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x44e4023)
#11 0x0000000003e2d363
clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&,
clang::OpaquePtr<clang::QualType>, bool, bool, bool*, bool,
clang::IdentifierInfo**, bool, bool)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3e2d363)
#12 0x0000000003e1d563
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3e1d563)
#13 0x0000000003e20116
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3e20116)
#14 0x0000000003e1ab29
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3e1ab29)
#15 0x0000000003e2958a
clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&,
llvm::SmallVectorImpl<clang::SourceLocation>&, llvm::function_ref<void ()>)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3e2958a)
#16 0x0000000003df28a7
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3df28a7)
#17 0x0000000003df081e clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3df081e)
#18 0x0000000003dd4f2c
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3dd4f2c)
#19 0x0000000003dd49c5
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3dd49c5)
#20 0x0000000003dd37f3
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3dd37f3)
#21 0x0000000003dd183d
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3dd183d)
#22 0x0000000003dd1087
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3dd1087)
#23 0x0000000003dccb4e clang::ParseAST(clang::Sema&, bool, bool)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3dccb4e)
#24 0x0000000002ea0873 clang::FrontendAction::Execute()
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x2ea0873)
#25 0x0000000002e3b0c3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x2e3b0c3)
#26 0x0000000002f4a672
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x2f4a672)
#27 0x0000000000956798 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x956798)
#28 0x0000000000954cac ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x954cac)
#29 0x0000000000954958 main
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x954958)
#30 0x00007f1dae248830 __libc_start_main
/build/glibc-LK5gWL/glibc-2.23/csu/../csu/libc-start.c:325:0
#31 0x00000000009519a9 _start
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x9519a9)
clang-11: error: unable to execute command: Aborted (core dumped)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin
clang-11: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/bug-4fb253.cpp
clang-11: note: diagnostic msg: /tmp/bug-4fb253.sh
clang-11: note: diagnostic msg: 

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


$clang++ --version
clang version 11.0.0 
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin

-- 
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/20200628/6b8a6870/attachment-0001.html>


More information about the llvm-bugs mailing list