| Issue |
176740
|
| Summary |
[clang][bytecode] Assertion `BitWidth == V.getBitWidth()' failed.
|
| Labels |
crash-on-valid,
clang:bytecode
|
| Assignees |
|
| Reporter |
k-arrows
|
Reproducer:
https://godbolt.org/z/ovP1shYYG
```c
int foo[2 * (22222222222wb + 2i) == 2];
```
Backtrace:
```console
clang++: /root/llvm-project/llvm/tools/clang/lib/AST/ByteCode/IntegralAP.h:79: void clang::interp::IntegralAP<Signed>::copy(const APInt&) [with bool Signed = true; clang::interp::APInt = llvm::APInt]: Assertion `BitWidth == V.getBitWidth()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -x c -std=c2y -fexperimental-new-constant-interpreter <source>
1. <source>:1:39: current parser token ';'
#0 0x0000000004312838 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4312838)
#1 0x000000000430fc94 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x430fc94)
#2 0x00000000042528e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007c9cf6242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007c9cf62969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007c9cf6242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007c9cf62287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007c9cf622871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007c9cf6239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000007e2dbe4 clang::interp::IntegralAP<true>::copy(llvm::APInt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7e2dbe4)
#10 0x0000000007ef4615 bool clang::interp::IntegralAP<true>::CheckAddSubMulUB<std::multiplies>(clang::interp::IntegralAP<true> const&, clang::interp::IntegralAP<true> const&, unsigned int, clang::interp::IntegralAP<true>*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7ef4615)
#11 0x0000000007ef68dd bool clang::interp::Mulc<(clang::interp::PrimType)9, clang::interp::IntegralAP<true>>(clang::interp::InterpState&, clang::interp::CodePtr) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7ef68dd)
#12 0x0000000008289edd clang::interp::Compiler<clang::interp::EvalEmitter>::VisitComplexBinOp(clang::BinaryOperator const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8289edd)
#13 0x000000000829f203 clang::interp::Compiler<clang::interp::EvalEmitter>::VisitBinaryOperator(clang::BinaryOperator const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x829f203)
#14 0x000000000828f1f2 clang::interp::Compiler<clang::interp::EvalEmitter>::visitInitializer(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x828f1f2)
#15 0x000000000829c9c0 clang::interp::Compiler<clang::interp::EvalEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x829c9c0)
#16 0x000000000828db36 clang::interp::Compiler<clang::interp::EvalEmitter>::emitComplexComparison(clang::Expr const*, clang::Expr const*, clang::BinaryOperator const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x828db36)
#17 0x000000000829f23d clang::interp::Compiler<clang::interp::EvalEmitter>::VisitBinaryOperator(clang::BinaryOperator const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x829f23d)
#18 0x000000000829c8da clang::interp::Compiler<clang::interp::EvalEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x829c8da)
#19 0x0000000008290aa6 clang::interp::Compiler<clang::interp::EvalEmitter>::visitExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8290aa6)
#20 0x0000000007e211ad clang::interp::EvalEmitter::interpretExpr(clang::Expr const*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7e211ad)
#21 0x0000000007e11473 clang::interp::Context::evaluateAsRValue(clang::interp::State&, clang::Expr const*, clang::APValue&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7e11473)
#22 0x0000000007d7e9b3 EvaluateAsRValue((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) ExprConstant.cpp:0:0
#23 0x0000000007d86e97 clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&, clang::ASTContext const&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7d86e97)
#24 0x0000000006fd43c1 clang::Sema::VerifyIntegerConstantExpression(clang::Expr*, llvm::APSInt*, clang::Sema::VerifyICEDiagnoser&, clang::AllowFoldKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fd43c1)
#25 0x00000000076c1981 clang::Sema::BuildArrayType(clang::QualType, clang::ArraySizeModifier, clang::Expr*, unsigned int, clang::SourceRange, clang::DeclarationName) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x76c1981)
#26 0x00000000076de852 GetFullTypeForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*) SemaType.cpp:0:0
#27 0x00000000076e45bf clang::Sema::GetTypeForDeclarator(clang::Declarator&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x76e45bf)
#28 0x0000000006e6e30c clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e6e30c)
#29 0x0000000006e6f650 clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e6f650)
#30 0x0000000006aa6cd3 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6aa6cd3)
#31 0x0000000006ab4aba clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ab4aba)
#32 0x0000000006a721bb clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a721bb)
#33 0x0000000006a729af clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a729af)
#34 0x0000000006a7a7da clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a7a7da)
#35 0x0000000006a7b775 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a7b775)
#36 0x0000000006a7bc20 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a7bc20)
#37 0x0000000006a5c7c3 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a5c7c3)
#38 0x0000000004c7ab78 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c7ab78)
#39 0x0000000004f74f85 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f74f85)
#40 0x0000000004ef495e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ef495e)
#41 0x000000000506fbfd clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x506fbfd)
#42 0x0000000000ddd1ce cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xddd1ce)
#43 0x0000000000dd3b9a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#44 0x0000000000dd3d1d int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#45 0x0000000004cee0b9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#46 0x0000000004252d84 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4252d84)
#47 0x0000000004cee6cf clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#48 0x0000000004caf0a2 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4caf0a2)
#49 0x0000000004cb004e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4cb004e)
#50 0x0000000004cb7495 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4cb7495)
#51 0x0000000000dd9541 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdd9541)
#52 0x0000000000c96be4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc96be4)
#53 0x00007c9cf6229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#54 0x00007c9cf6229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#55 0x0000000000dd3635 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdd3635)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs