[llvm-bugs] [Bug 37026] New: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 5 20:19:37 PDT 2018


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

            Bug ID: 37026
           Summary: Assertion `isa<X>(Val) && "cast<Ty>() argument of
                    incompatible type!"' failed.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: regehr at cs.utah.edu
                CC: llvm-bugs at lists.llvm.org

regehr at john-home:~/reduce/1/creduce_extra_00001$ clang++ -v
clang version 7.0.0 (trunk 329206)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/regehr/llvm-install/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.3.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/7.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.4
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.5
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.4
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.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.2.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

regehr at john-home:~/reduce/1/creduce_extra_00001$ cat hello.cpp
typedef a() throw typedef a b;
template <typename> class c { b d } c<char>::

regehr at john-home:~/reduce/1/creduce_extra_00001$ clang++ hello.cpp -w
hello.cpp:1:19: error: expected '(' after 'throw'
typedef a() throw typedef a b;
                  ^
hello.cpp:1:9: error: C++ requires a type specifier for all declarations
typedef a() throw typedef a b;
~~~~~~~ ^
hello.cpp:1:13: error: exception specifications are not allowed in typedefs
typedef a() throw typedef a b;
            ^
hello.cpp:1:18: error: expected ';' after top level declarator
typedef a() throw typedef a b;
                 ^
                 ;
hello.cpp:2:34: error: expected ';' at end of declaration list
template <typename> class c { b d } c<char>::
                                 ^
                                 ;
hello.cpp:2:36: error: expected ';' after class
template <typename> class c { b d } c<char>::
                                   ^
                                   ;
clang-7: ../include/llvm/Support/Casting.h:248: typename cast_retty<X,
Y>::ret_type llvm::cast(Y &) [X = clang::FunctionProtoType, Y =
clang::QualType]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
#0 0x0000000001433ed4 PrintStackTraceSignalHandler(void*)
(/home/regehr/llvm-install/bin/clang-7+0x1433ed4)
#1 0x0000000001434236 SignalHandler(int)
(/home/regehr/llvm-install/bin/clang-7+0x1434236)
#2 0x00007fe0bd0f6390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#3 0x00007fe0bbc59428 gsignal
/build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#4 0x00007fe0bbc5b02a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
#5 0x00007fe0bbc51bd7 __assert_fail_base
/build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92:0
#6 0x00007fe0bbc51c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#7 0x0000000002fd2a80
clang::ASTContext::getFunctionTypeWithExceptionSpec(clang::QualType,
clang::FunctionProtoType::ExceptionSpecInfo const&)
(/home/regehr/llvm-install/bin/clang-7+0x2fd2a80)
#8 0x0000000002fd2fac
clang::ASTContext::adjustExceptionSpec(clang::FunctionDecl*,
clang::FunctionProtoType::ExceptionSpecInfo const&, bool)
(/home/regehr/llvm-install/bin/clang-7+0x2fd2fac)
#9 0x0000000002b240b1 clang::Sema::UpdateExceptionSpec(clang::FunctionDecl*,
clang::FunctionProtoType::ExceptionSpecInfo const&)
(/home/regehr/llvm-install/bin/clang-7+0x2b240b1)
#10 0x0000000002e4e178 clang::Sema::SubstExceptionSpec(clang::FunctionDecl*,
clang::FunctionProtoType const*, clang::MultiLevelTemplateArgumentList const&)
(/home/regehr/llvm-install/bin/clang-7+0x2e4e178)
#11 0x0000000002e8639e
clang::TemplateDeclInstantiator::InitFunctionInstantiation(clang::FunctionDecl*,
clang::FunctionDecl*) (/home/regehr/llvm-install/bin/clang-7+0x2e8639e)
#12 0x0000000002e83af4
clang::TemplateDeclInstantiator::VisitCXXMethodDecl(clang::CXXMethodDecl*,
clang::TemplateParameterList*, bool)
(/home/regehr/llvm-install/bin/clang-7+0x2e83af4)
#13 0x0000000002e50fb3 clang::Sema::InstantiateClass(clang::SourceLocation,
clang::CXXRecordDecl*, clang::CXXRecordDecl*,
clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind, bool)
(/home/regehr/llvm-install/bin/clang-7+0x2e50fb3)
#14 0x0000000002e531d6
clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind,
bool) (/home/regehr/llvm-install/bin/clang-7+0x2e531d6)
#15 0x0000000002ec4ec8
clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType,
clang::Sema::TypeDiagnoser*) (/home/regehr/llvm-install/bin/clang-7+0x2ec4ec8)
#16 0x0000000002ec4c40 clang::Sema::RequireCompleteType(clang::SourceLocation,
clang::QualType, clang::Sema::TypeDiagnoser&)
(/home/regehr/llvm-install/bin/clang-7+0x2ec4c40)
#17 0x00000000028def8b
clang::Sema::RequireCompleteDeclContext(clang::CXXScopeSpec&,
clang::DeclContext*) (/home/regehr/llvm-install/bin/clang-7+0x28def8b)
#18 0x00000000028e3fcd clang::Sema::ActOnCXXEnterDeclaratorScope(clang::Scope*,
clang::CXXScopeSpec&) (/home/regehr/llvm-install/bin/clang-7+0x28e3fcd)
#19 0x000000000266995a clang::Parser::ParseDirectDeclarator(clang::Declarator&)
(/home/regehr/llvm-install/bin/clang-7+0x266995a)
#20 0x000000000266903f
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&))
(/home/regehr/llvm-install/bin/clang-7+0x266903f)
#21 0x000000000265f0a6 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/home/regehr/llvm-install/bin/clang-7+0x265f0a6)
#22 0x0000000002647f2b
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/regehr/llvm-install/bin/clang-7+0x2647f2b)
#23 0x0000000002647881
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/home/regehr/llvm-install/bin/clang-7+0x2647881)
#24 0x0000000002646203
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/home/regehr/llvm-install/bin/clang-7+0x2646203)
#25 0x00000000026456a8
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/home/regehr/llvm-install/bin/clang-7+0x26456a8)
#26 0x0000000002641647 clang::ParseAST(clang::Sema&, bool, bool)
(/home/regehr/llvm-install/bin/clang-7+0x2641647)
#27 0x0000000001a5e480 clang::FrontendAction::Execute()
(/home/regehr/llvm-install/bin/clang-7+0x1a5e480)
#28 0x0000000001a0b131
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/regehr/llvm-install/bin/clang-7+0x1a0b131)
#29 0x0000000001af7db6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/regehr/llvm-install/bin/clang-7+0x1af7db6)
#30 0x00000000007b5f53 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/regehr/llvm-install/bin/clang-7+0x7b5f53)
#31 0x00000000007b40c0 main (/home/regehr/llvm-install/bin/clang-7+0x7b40c0)
#32 0x00007fe0bbc44830 __libc_start_main
/build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:325:0
#33 0x00000000007b1329 _start (/home/regehr/llvm-install/bin/clang-7+0x7b1329)
Stack dump:
0.      Program arguments: /home/regehr/llvm-install/bin/clang-7 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
hello.cpp -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 /home/regehr/llvm-install/lib/clang/7.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/x86_64-linux-gnu/c++/7.2.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/x86_64-linux-gnu/c++/7.2.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/regehr/llvm-install/lib/clang/7.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -w -fdeprecated-macro
-fdebug-compilation-dir /home/regehr/reduce/1/creduce_extra_00001 -ferror-limit
19 -fmessage-length 100 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-53a3e5.o -x c++
hello.cpp 
1.      <eof> parser at end of file
2.      hello.cpp:2:27: instantiating class definition 'c<char>'
clang-7: error: unable to execute command: Aborted
clang-7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (trunk 329206)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/regehr/llvm-install/bin
clang-7: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-7: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-7: note: diagnostic msg: /tmp/hello-a7c71e.cpp
clang-7: note: diagnostic msg: /tmp/hello-a7c71e.sh
clang-7: 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/20180406/c65e644e/attachment-0001.html>


More information about the llvm-bugs mailing list