-
Notifications
You must be signed in to change notification settings - Fork 15k
Open
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]
Description
When compiling the code below with clangtk -O0
, an assertion failure is triggered by clangtk
.
#include <x86intrin.h>
int a = 0;
int __attribute__((__vector_size__(8))) b;
void bar(void) {
b *= __builtin_ia32_vec_init_v2si(0, a);
}
Clang's output (which can be verified at https://gcc.godbolt.org/z/oMhTbYo5r):
clang: /root/llvm-project/llvm/lib/IR/Instructions.cpp:3061: static llvm::BinaryOperator* llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*, llvm::Value*, const llvm::Twine&, llvm::Instruction*): Assertion `S1->getType() == S2->getType() && "Cannot create binary operator with two operands of differing type!"' 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 -gdwarf-4 -g -o /app/output.s -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O0 <source>
1. <eof> parser at end of file
2. <source>:6:6: LLVM IR generation of declaration 'bar'
3. <source>:6:6: Generating code for declaration 'bar'
#0 0x000055e93c31a1df llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bb41df)
#1 0x000055e93c317f4c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bb1f4c)
#2 0x000055e93c261658 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007fc3312a5420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fc330d7200b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007fc330d51859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007fc330d51729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007fc330d62fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x000055e93bc33f35 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x34cdf35)
#9 0x000055e93bc41af4 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x34dbaf4)
#10 0x000055e939d81593 llvm::IRBuilderBase::CreateMul(llvm::Value*, llvm::Value*, llvm::Twine const&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x161b593)
#11 0x000055e93ca3bf3b (anonymous namespace)::ScalarExprEmitter::EmitMul((anonymous namespace)::BinOpInfo const&) CGExprScalar.cpp:0:0
#12 0x000055e93ca53e31 (anonymous namespace)::ScalarExprEmitter::EmitCompoundAssignLValue(clang::CompoundAssignOperator const*, llvm::Value* ((anonymous namespace)::ScalarExprEmitter::*)((anonymous namespace)::BinOpInfo const&), llvm::Value*&) (.constprop.0) CGExprScalar.cpp:0:0
#13 0x000055e93ca54837 (anonymous namespace)::ScalarExprEmitter::EmitCompoundAssign(clang::CompoundAssignOperator const*, llvm::Value* ((anonymous namespace)::ScalarExprEmitter::*)((anonymous namespace)::BinOpInfo const&)) (.constprop.0) CGExprScalar.cpp:0:0
#14 0x000055e93ca47284 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#15 0x000055e93ca4e4e4 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x42e84e4)
#16 0x000055e93c9e1b6e clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x427bb6e)
#17 0x000055e93ca03ecb clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x429decb)
#18 0x000055e93c6491a7 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ee31a7)
#19 0x000055e93c64fde4 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ee9de4)
#20 0x000055e93c6afe2a clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f49e2a)
#21 0x000055e93c6c3c3f clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f5dc3f)
#22 0x000055e93c727c39 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fc1c39)
#23 0x000055e93c722bc5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fbcbc5)
#24 0x000055e93c723798 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fbd798)
#25 0x000055e93c72c6a3 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#26 0x000055e93d5651b6 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#27 0x000055e93d5556e0 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4def6e0)
#28 0x000055e93ea5e184 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x62f8184)
#29 0x000055e93d561f78 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4dfbf78)
#30 0x000055e93cdbbea9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4655ea9)
#31 0x000055e93cd40e46 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45dae46)
#32 0x000055e93ce9ed26 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4738d26)
#33 0x000055e9397dff5c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x1079f5c)
#34 0x000055e9397dbc7a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#35 0x000055e93cba7d7d 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
#36 0x000055e93c261b60 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3afbb60)
#37 0x000055e93cba85ff 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
#38 0x000055e93cb6fbfc clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4409bfc)
#39 0x000055e93cb7068d 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+0x440a68d)
#40 0x000055e93cb7876d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x441276d)
#41 0x000055e9397de1da clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10781da)
#42 0x000055e9396e5215 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xf7f215)
#43 0x00007fc330d53083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#44 0x000055e9397d6a5e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x1070a5e)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
The version of testing clang is (associated with commit f05b58a):
clang version 17.0.0 (https://github.com/llvm/llvm-project.git f05b58a9468cc2990678e06bc51df56b30344807)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-assertions-trunk/bin
Metadata
Metadata
Assignees
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]