- Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Copy link
Labels
clang:bytecodeIssues for the clang bytecode constexpr interpreterIssues for the clang bytecode constexpr interpretercrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]
Description
Reproducer:
https://godbolt.org/z/zo4P8M8Gr
int a; void foo(void) { a *= __builtin_addc(1, 2, 0, 0); }Backtrace:
clang++: /root/llvm-project/llvm/tools/clang/lib/AST/ByteCode/Pointer.h:665: T& clang::interp::Pointer::deref() const [with T = clang::interp::Integral<32, false>]: Assertion `isBlockPointer()' 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 -fexperimental-new-constant-interpreter <source> 1. <source>:3:51: current parser token '}' 2. <source>:3:16: parsing function body 'foo' 3. <source>:3:16: in compound statement ('{}') #0 0x0000000004224288 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4224288) #1 0x00000000042216b4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42216b4) #2 0x0000000004165908 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0 #3 0x00007464dd642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #4 0x00007464dd6969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc) #5 0x00007464dd642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #6 0x00007464dd6287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #7 0x00007464dd62871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b) #8 0x00007464dd639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96) #9 0x0000000007c8b5e9 clang::interp::Integral<32u, false>& clang::interp::Pointer::deref<clang::interp::Integral<32u, false>>() const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7c8b5e9) #10 0x0000000007dbd400 clang::interp::assignInteger(clang::interp::InterpState&, clang::interp::Pointer const&, clang::interp::PrimType, llvm::APSInt const&) InterpBuiltin.cpp:0:0 #11 0x0000000007dbe32c clang::interp::interp__builtin_carryop(clang::interp::InterpState&, clang::interp::CodePtr, clang::interp::InterpFrame const*, clang::CallExpr const*, unsigned int) (.isra.0) InterpBuiltin.cpp:0:0 #12 0x0000000007dc776c clang::interp::InterpretBuiltin(clang::interp::InterpState&, clang::interp::CodePtr, clang::CallExpr const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dc776c) #13 0x00000000080e1e0b clang::interp::Compiler<clang::interp::EvalEmitter>::VisitBuiltinCallExpr(clang::CallExpr const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x80e1e0b) #14 0x00000000080e219e clang::interp::Compiler<clang::interp::EvalEmitter>::VisitCallExpr(clang::CallExpr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x80e219e) #15 0x00000000080e900a clang::interp::Compiler<clang::interp::EvalEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x80e900a) #16 0x00000000080d8d74 clang::interp::Compiler<clang::interp::EvalEmitter>::VisitCompoundAssignOperator(clang::CompoundAssignOperator const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x80d8d74) #17 0x00000000080e900a clang::interp::Compiler<clang::interp::EvalEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x80e900a) #18 0x00000000080ddc36 clang::interp::Compiler<clang::interp::EvalEmitter>::visitExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x80ddc36) #19 0x0000000007c7d5bd clang::interp::EvalEmitter::interpretExpr(clang::Expr const*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7c7d5bd) #20 0x0000000007c6ca33 clang::interp::Context::evaluateAsRValue(clang::interp::State&, clang::Expr const*, clang::APValue&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7c6ca33) #21 0x0000000007bd9363 EvaluateAsRValue((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) ExprConstant.cpp:0:0 #22 0x0000000007bdce8e clang::Expr::EvaluateForOverflow(clang::ASTContext const&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7bdce8e) #23 0x0000000006b68986 clang::Sema::CheckForIntOverflow(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b68986) #24 0x0000000006bab24c clang::Sema::CheckCompletedExpr(clang::Expr*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6bab24c) #25 0x0000000006f51257 clang::Sema::ActOnFinishFullExpr(clang::Expr*, clang::SourceLocation, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f51257) #26 0x0000000007267cfe clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr*, true>, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7267cfe) #27 0x0000000006a2fe44 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a2fe44) #28 0x0000000006a273d2 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::LabelDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a273d2) #29 0x0000000006a27d99 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::LabelDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a27d99) #30 0x0000000006a30526 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a30526) #31 0x0000000006a30d3a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a30d3a) #32 0x000000000693780b clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x693780b) #33 0x000000000696dc7d 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+++0x696dc7d) #34 0x000000000692afbe clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x692afbe) #35 0x000000000692b75f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x692b75f) #36 0x0000000006933013 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6933013) #37 0x0000000006933f25 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6933f25) #38 0x00000000069155aa clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69155aa) #39 0x0000000004b6f288 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b6f288) #40 0x0000000004e5c665 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4e5c665) #41 0x0000000004ddd63e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ddd63e) #42 0x0000000004f5369d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4f5369d) #43 0x0000000000dcf7b0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdcf7b0) #44 0x0000000000dc631a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0 #45 0x0000000000dc649d 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 #46 0x0000000004bd8649 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 #47 0x0000000004165da4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4165da4) #48 0x0000000004bd8c5f 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 #49 0x0000000004b99d72 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b99d72) #50 0x0000000004b9ad1e 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+++0x4b9ad1e) #51 0x0000000004ba2455 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ba2455) #52 0x0000000000dcbcd9 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdcbcd9) #53 0x0000000000c7a954 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc7a954) #54 0x00007464dd629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #55 0x00007464dd629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #56 0x0000000000dc5db5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdc5db5) clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation) Compiler returned: 134Metadata
Metadata
Assignees
Labels
clang:bytecodeIssues for the clang bytecode constexpr interpreterIssues for the clang bytecode constexpr interpretercrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]