[llvm-bugs] [Bug 44927] New: Assertion `FromType->castAs<EnumType>()->getDecl()->isFixed() && SCS.Second == ICK_Integral_Promotion && "only enums with fixed underlying type can promote to bool"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Feb 15 11:25:08 PST 2020


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

            Bug ID: 44927
           Summary: Assertion
                    `FromType->castAs<EnumType>()->getDecl()->isFixed() &&
                    SCS.Second == ICK_Integral_Promotion && "only enums
                    with fixed underlying type can promote to bool"'
                    failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: changochen1 at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

POC:
---
a = 0 && (enum b)c
---

Run script:
---
# Crash reproducer for clang version 11.0.0
(https://github.com/llvm/llvm-project.git
56b7f595d2b402ff177ca42214325c8fdea10fb0)
# Driver args: "--driver-mode=g++" "-x" "c++" "-o" "tm" "./test1.c"
# Original command:  "/data/rxz226/llvm-project/bld/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"
"/data/rxz226/llvm-project/bld/lib/clang/11.0.0" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/data/rxz226/llvm-project/bld/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/rxz226/c_reduce" "-ferror-limit" "19" "-fmessage-length" "0"
"-fgnuc-version=4.2.1" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-faddrsig" "-o"
"/tmp/test1-79d5c4.o" "-x" "c++" "./test1.c"
 "/data/rxz226/llvm-project/bld/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" "-fdeprecated-macro" "-ferror-limit" "19"
"-fmessage-length" "0" "-fgnuc-version=4.2.1" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-faddrsig" "-x" "c++" "test1-ace176.cpp"
---

Stack dump:
---
clang++: /home/rxz226/llvm-project/clang/lib/Sema/SemaExprCXX.cpp:4021:
clang::ExprResult clang::Sema::PerformImplicitConversion(clang::Expr*,
clang::QualType, const clang::StandardConversionSequence&,
clang::Sema::AssignmentAct
ion, clang::Sema::CheckedConversionKind): Assertion
`FromType->castAs<EnumType>()->getDecl()->isFixed() && SCS.Second ==
ICK_Integral_Promotion && "only enums with fixed underlying type can promote to
bool"' failed.
Stack dump:
0.      Program arguments: /home/rxz226/llvm-project/bld/bin/clang++ -x c++ -o
tm ./test1.c
1.      <eof> parser at end of file
 #0 0x000000000511679b llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:0
 #1 0x000000000511682e PrintStackTraceSignalHandler(void*)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:625:0
 #2 0x00000000051145b6 llvm::sys::RunSignalHandlers()
/home/rxz226/llvm-project/llvm/lib/Support/Signals.cpp:68:0
 #3 0x0000000005115fd7 llvm::sys::CleanupOnSignal(unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:361:0
 #4 0x000000000501be1f (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:80:0
 #5 0x000000000501c2fe CrashRecoverySignalHandler(int)
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:362:0
 #6 0x00007facce99f390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #7 0x00007faccd6ae428 raise
/build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #8 0x00007faccd6b002a abort /build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0
 #9 0x00007faccd6a6bd7 __assert_fail_base
/build/glibc-LK5gWL/glibc-2.23/assert/assert.c:92:0
#10 0x00007faccd6a6c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#11 0x0000000007fb8e19 clang::Sema::PerformImplicitConversion(clang::Expr*,
clang::QualType, clang::StandardConversionSequence const&,
clang::Sema::AssignmentAction, clang::Sema::CheckedConversionKind)
/home/rxz226/llvm-project/
clang/lib/Sema/SemaExprCXX.cpp:4023:0
#12 0x0000000007fb8163 clang::Sema::PerformImplicitConversion(clang::Expr*,
clang::QualType, clang::ImplicitConversionSequence const&,
clang::Sema::AssignmentAction, clang::Sema::CheckedConversionKind)
/home/rxz226/llvm-project/
clang/lib/Sema/SemaExprCXX.cpp:3803:0
#13 0x0000000008226189
clang::Sema::PerformContextuallyConvertToBool(clang::Expr*)
/home/rxz226/llvm-project/clang/lib/Sema/SemaOverload.cpp:5449:0
#14 0x0000000007f856d7
clang::Sema::CheckLogicalOperands(clang::ActionResult<clang::Expr*, true>&,
clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation,
clang::BinaryOperatorKind) /home/rxz226/llvm-project/clang/lib/S
ema/SemaExpr.cpp:11550:0
#15 0x0000000007ec0801 clang::Sema::CreateBuiltinBinOp(clang::SourceLocation,
clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
/home/rxz226/llvm-project/clang/lib/Sema/SemaExpr.cpp:13077:0
#16 0x0000000008246ea1
clang::Sema::CreateOverloadedBinOp(clang::SourceLocation,
clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*,
clang::Expr*, bool, bool, clang::FunctionDecl*) /home/rxz226/llvm-project
/clang/lib/Sema/SemaOverload.cpp:13498:0
#17 0x0000000007ec2a64 BuildOverloadedBinOp(clang::Sema&, clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
/home/rxz226/llvm-project/clang/lib/Sema/SemaExpr.cpp:13459:0
#18 0x0000000007ec33a1 clang::Sema::BuildBinOp(clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
/home/rxz226/llvm-project/clang/lib/Sema/SemaExpr.cpp:13561:0
#19 0x0000000007ec2846 clang::Sema::ActOnBinOp(clang::Scope*,
clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*)
/home/rxz226/llvm-project/clang/lib/Sema/SemaExpr.cpp:13418:0
#20 0x0000000007a60acc
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:629:0
#21 0x0000000007a5e8af
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:177:0
#22 0x0000000007a35a42 clang::Parser::ParseInitializer()
/home/rxz226/llvm-project/clang/include/clang/Parse/Parser.h:1950:0
#23 0x0000000007a1f984
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.c
pp:2374:0
#24 0x0000000007a1e882 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.cpp:2129:0
#25 0x00000000079ff6cd
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:1110:0
#26 0x00000000079ff7ab
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:1125:0
...
---

-- 
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/20200215/34237079/attachment-0001.html>


More information about the llvm-bugs mailing list