[llvm-bugs] [Bug 46487] New: Clang crash inclang/lib/Sema/SemaOverload.cpp:5702: clang::ExprResult clang::Sema::CheckConvertedConstantExpression(): Assertion `T->isIntegralOrEnumerationType() && "unexpected converted const type"' failed
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Jun 27 20:35:46 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46487
Bug ID: 46487
Summary: Clang crash inclang/lib/Sema/SemaOverload.cpp:5702:
clang::ExprResult
clang::Sema::CheckConvertedConstantExpression():
Assertion `T->isIntegralOrEnumerationType() &&
"unexpected converted const type"' failed
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
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-trunk crashed.
$cat bug.cc
bool g_var_bool char g_volatile_char enum :
decltype((g_var_long = throw))::a {
b = g_volatile_uchar
$clang++ bug.cc
bug.cc:1:16: error: expected ';' after top level declarator
bool g_var_bool char g_volatile_char enum :
^
;
bug.cc:1:37: error: expected ';' after top level declarator
bool g_var_bool char g_volatile_char enum :
^
;
bug.cc:2:11: error: use of undeclared identifier 'g_var_long'; did you mean
'g_var_bool'?
decltype((g_var_long = throw))::a {
^~~~~~~~~~
g_var_bool
bug.cc:1:6: note: 'g_var_bool' declared here
bool g_var_bool char g_volatile_char enum :
^
bug.cc:2:24: error: assigning to 'bool' from incompatible type 'void'
decltype((g_var_long = throw))::a {
^~~~~
bug.cc:2:1: error: missing 'typename' prior to dependent type name
'decltype((<recovery-expr>(g_var_bool, throw)))::a'
decltype((g_var_long = throw))::a {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
typename
bug.cc:3:7: error: use of undeclared identifier 'g_volatile_uchar'; did you
mean 'g_volatile_char'?
b = g_volatile_uchar
^~~~~~~~~~~~~~~~
g_volatile_char
bug.cc:1:22: note: 'g_volatile_char' declared here
bool g_var_bool char g_volatile_char enum :
^
clang-11:
/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master-assert/clang/lib/Sema/SemaOverload.cpp:5702:
clang::ExprResult clang::Sema::CheckConvertedConstantExpression(clang::Expr *,
clang::QualType, llvm::APSInt &, clang::Sema::CCEKind): Assertion
`T->isIntegralOrEnumerationType() && "unexpected converted const type"' 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-20b5d0.o -x c++ bug.cc
1. <eof> parser at end of file
#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 0x00007f062f35e390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007f062dec8428 raise
/build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007f062deca02a abort /build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007f062dec0bd7 __assert_fail_base
/build/glibc-LK5gWL/glibc-2.23/assert/assert.c:92:0
#7 0x00007f062dec0c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x0000000004459cfd
clang::Sema::CheckConvertedConstantExpression(clang::Expr*, clang::QualType,
llvm::APSInt&, clang::Sema::CCEKind)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x4459cfd)
#9 0x000000000403df3c clang::Sema::CheckEnumConstant(clang::EnumDecl*,
clang::EnumConstantDecl*, clang::SourceLocation, clang::IdentifierInfo*,
clang::Expr*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x403df3c)
#10 0x000000000403f5f5 clang::Sema::ActOnEnumConstant(clang::Scope*,
clang::Decl*, clang::Decl*, clang::SourceLocation, clang::IdentifierInfo*,
clang::ParsedAttributesView const&, clang::SourceLocation, clang::Expr*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x403f5f5)
#11 0x0000000003df8f70 clang::Parser::ParseEnumBody(clang::SourceLocation,
clang::Decl*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3df8f70)
#12 0x0000000003df5c5f clang::Parser::ParseEnumSpecifier(clang::SourceLocation,
clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&,
clang::AccessSpecifier, clang::Parser::DeclSpecContext)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3df5c5f)
#13 0x0000000003ded00d
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3ded00d)
#14 0x0000000003dd4c9a
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3dd4c9a)
#15 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)
#16 0x0000000003dd37f3
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3dd37f3)
#17 0x0000000003dd183d
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3dd183d)
#18 0x0000000003dccb6d clang::ParseAST(clang::Sema&, bool, bool)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x3dccb6d)
#19 0x0000000002ea0873 clang::FrontendAction::Execute()
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x2ea0873)
#20 0x0000000002e3b0c3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x2e3b0c3)
#21 0x0000000002f4a672
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x2f4a672)
#22 0x0000000000956798 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x956798)
#23 0x0000000000954cac ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x954cac)
#24 0x0000000000954958 main
(/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master/build/bin/clang-11+0x954958)
#25 0x00007f062deb3830 __libc_start_main
/build/glibc-LK5gWL/glibc-2.23/csu/../csu/libc-start.c:325:0
#26 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-da1e3c.cpp
clang-11: note: diagnostic msg: /tmp/bug-da1e3c.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
Reproduced in Godbolt: https://godbolt.org/z/8oBmF7
--
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/c39eefc2/attachment.html>
More information about the llvm-bugs
mailing list