<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/111301>111301</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] [Trunk] Assertion `getType()->isIntOrIntVectorTy() && "Tried to create an integer operation on a non-integer type!"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yijan4845
</td>
</tr>
</table>
<pre>
Compiler Explorer: [https://godbolt.org/z/M45qzaj4b](https://godbolt.org/z/M45qzaj4b)
It seems that the code will get another assertion failed if `-` is changed to `+` on line 5:
Assertion `getType()->isIntOrIntVectorTy() && "Tried to create an integer operation on a non-integer type!"' failed.`
Compiler Explorer for changed version: [https://godbolt.org/z/9GYYPb9TW](https://godbolt.org/z/9GYYPb9TW)
Attempting to compile the following program with Clang Trunk and Clang Assertion Trunk:
```c
typedef unsigned __int128 __attribute__ ((__vector_size__ (64))) v512u128;
v512u128 f;
void foo(_Complex double e) {
v512u128 g = f - -e;
}
```
Stack dump:
```
clang: /root/llvm-project/llvm/lib/IR/Instructions.cpp:2572: void llvm::BinaryOperator::AssertOK(): Assertion `getType()->isIntOrIntVectorTy() && "Tried to create an integer operation on a non-integer 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 -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O3 <source>
1. <eof> parser at end of file
2. <source>:4:6: LLVM IR generation of declaration 'foo'
3. <source>:4:6: Generating code for declaration 'foo'
#0 0x0000000003b99d28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b99d28)
#1 0x0000000003b979ec llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b979ec)
#2 0x0000000003ae61f8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000079d24de42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000079d24de969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000079d24de42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000079d24de287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000079d24de2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000079d24de39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00000000034c239d llvm::BinaryOperator::AssertOK() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x34c239d)
#10 0x00000000034c2795 llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*, llvm::Value*, llvm::Twine const&, llvm::InsertPosition) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x34c2795)
#11 0x0000000001384d6e llvm::IRBuilderBase::CreateSub(llvm::Value*, llvm::Value*, llvm::Twine const&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x1384d6e)
#12 0x00000000043bbb56 (anonymous namespace)::ScalarExprEmitter::EmitSub((anonymous namespace)::BinOpInfo const&) CGExprScalar.cpp:0:0
#13 0x00000000043cdcdb (anonymous namespace)::ScalarExprEmitter::VisitMinus(clang::UnaryOperator const*, clang::QualType) CGExprScalar.cpp:0:0
#14 0x00000000043c12e7 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#15 0x00000000043c1b4b (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#16 0x00000000043c9dac (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#17 0x00000000043c000c clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#18 0x00000000043cd306 clang::CodeGen::CodeGenFunction::EmitPromotedScalarExpr(clang::Expr const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43cd306)
#19 0x00000000043cdeba (anonymous namespace)::ScalarExprEmitter::EmitBinOps(clang::BinaryOperator const*, clang::QualType) CGExprScalar.cpp:0:0
#20 0x00000000043c0b59 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#21 0x00000000043c58ac clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43c58ac)
#22 0x000000000431869f clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x431869f)
#23 0x000000000431a104 clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x431a104)
#24 0x00000000043265b1 clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43265b1)
#25 0x0000000004326b76 clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
#26 0x0000000004326dc6 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4326dc6)
#27 0x0000000003eecae7 clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3eecae7)
#28 0x0000000003f036f9 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f036f9)
#29 0x0000000003efb395 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3efb395)
#30 0x0000000003f03114 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f03114)
#31 0x0000000003f6b5b4 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f6b5b4)
#32 0x0000000003f7d59c clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f7d59c)
#33 0x0000000003fe5f4a clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fe5f4a)
#34 0x0000000003fe0c65 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fe0c65)
#35 0x0000000003fe121b clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fe121b)
#36 0x0000000003feb593 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#37 0x00000000044f2e26 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#38 0x00000000044e3a08 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44e3a08)
#39 0x000000000661af54 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x661af54)
#40 0x00000000044f0998 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44f0998)
#41 0x00000000047aa2e9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47aa2e9)
#42 0x0000000004728c2e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4728c2e)
#43 0x000000000488fb6e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x488fb6e)
#44 0x0000000000cd801f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcd801f)
#45 0x0000000000ccfd2a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#46 0x0000000004534669 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 0x0000000003ae66a4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ae66a4)
#48 0x0000000004534c5f 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 0x00000000044fa59d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44fa59d)
#50 0x00000000044fb68d 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+0x44fb68d)
#51 0x0000000004502fb5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4502fb5)
#52 0x0000000000cd4eef clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcd4eef)
#53 0x0000000000ba49a4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xba49a4)
#54 0x000079d24de29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#55 0x000079d24de29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#56 0x0000000000ccf7de _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xccf7de)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkW11z4yjW_jXKDSWXhD4sXeTCcT7ezNtdne1ke2quXAghm2kJtIDSzvz6LUC2hWKn7bR7q3d2qieJERye5zmHwzHGSEq6ZIRcesmVl1xfoE6tuLh8oX8iFmdxclHw8uVyzpuW1kSAm3Vbc0GEF82Al1ytlGqlF808eOvB2yUvC16rCRdLD97-5cHbj3Hyr7_Qn3HhJdcezI7vDnMvuPaCmf15r4AkpJFArZACakUA5iUB32hdgyVRADGuVkQAJCURinIGKkRrUgJaAS8NfC8NAJUArxBbkhIorls9eKXbOQM1ZQQkGpeZbba14qXBkqinl5Z4MPNg7nvRDZX3TH0S90x9IVh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