<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/107704>107704</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Assertion `E->getOpcode() == BO_Assign && "unexpected binary l-value"' 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/ccxeE7exq](https://godbolt.org/z/ccxeE7exq)
Attempting to compile the following program with Clang Assertion Trunk:
```c
typedef union {
_Complex float cf;
long long ll;
} ucf ;
void foo () {
ucf ucf1;
_Complex float cf;
__asm ("" : "=r" (ucf1.ll) : "r" ((cf + 0)));
}
```
Stack dump:
```
clang-20: /root/llvm-project/clang/lib/CodeGen/CGExpr.cpp:5714: clang::CodeGen::LValue clang::CodeGen::CodeGenFunction::EmitBinaryOperatorLValue(const clang::BinaryOperator*): Assertion `E->getOpcode() == BO_Assign && "unexpected binary l-value"' 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-20240907/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -main-file-name example.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-assertions-trunk-20240907/lib/clang/20 -internal-isystem /opt/compiler-explorer/clang-assertions-trunk-20240907/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-17b744.o -x c <source>
1. <eof> parser at end of file
2. <source>:6:6: LLVM IR generation of declaration 'foo'
3. <source>:6:6: Generating code for declaration 'foo'
#0 0x0000000003b24fa8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x3b24fa8)
#1 0x0000000003b226ec SignalHandler(int) Signals.cpp:0:0
#2 0x000077a810a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x000077a810a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x000077a810a42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x000077a810a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000077a810a2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x000077a810a39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x00000000042f7572 clang::CodeGen::CodeGenFunction::EmitBinaryOperatorLValue(clang::BinaryOperator const*) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x42f7572)
#9 0x00000000042e43b0 clang::CodeGen::CodeGenFunction::EmitLValueHelper(clang::Expr const*, clang::CodeGen::KnownNonNull_t) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x42e43b0)
#10 0x00000000042e4721 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*, clang::CodeGen::KnownNonNull_t) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x42e4721)
#11 0x0000000003e7a443 clang::CodeGen::CodeGenFunction::EmitAsmInput(clang::TargetInfo::ConstraintInfo const&, clang::Expr const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x3e7a443)
#12 0x0000000003e7ffec clang::CodeGen::CodeGenFunction::EmitAsmStmt(clang::AsmStmt const&) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x3e7ffec)
#13 0x0000000003e860d0 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x3e860d0)
#14 0x0000000003e8db44 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x3e8db44)
#15 0x0000000003ef5764 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x3ef5764)
#16 0x0000000003f07f7f clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x3f07f7f)
#17 0x0000000003f6c09a clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x3f6c09a)
#18 0x0000000003f66f15 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x3f66f15)
#19 0x0000000003f674cb clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x3f674cb)
#20 0x0000000003f71603 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#21 0x0000000004471816 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#22 0x0000000004461a38 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x4461a38)
#23 0x00000000065ae1c4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x65ae1c4)
#24 0x000000000446f378 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x446f378)
#25 0x00000000047012b9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x47012b9)
#26 0x0000000004684b6e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x4684b6e)
#27 0x00000000047ea6de clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0x47ea6de)
#28 0x0000000000cb8fdf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0xcb8fdf)
#29 0x0000000000cb222a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#30 0x0000000000cb5b5e clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0xcb5b5e)
#31 0x0000000000b88c84 main (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0xb88c84)
#32 0x000077a810a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#33 0x000077a810a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#34 0x0000000000cb1cde _start (/opt/compiler-explorer/clang-assertions-trunk-20240907/bin/clang-20+0xcb1cde)
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWl1z46i2_TXKC4VLQrJkP-TBseOerttzumvS1efRhdCWwgSBLqC0c379LUBOjPMxndzxqemK3RaCzVqLzWYjQY3hnQS4TOZXyXxzQUd7q_TlA_-TymJRzC9q1TxcrlU_cAEaXe8HoTToJF-hZH51a-1gknyVkG1Ctp1qaiXsTOkuIdv_JGTL2B6uK9j_bzLfJGTx69XJMkk3SboK3ytroR8slx2yCrEABtlbQK0SQv10NwatOk179JPbW7QWVHZoZQxoy5VE3_Uo71zHwWiZhj8Wru3DAA20aJSublJdhWKEdo63gD1qhaIWsTbJH-8JJbvpSzwWJ9UGjaxFTwX--17xBrVKoYQsErI87sLVHlmbHVl-q9fdjpo-mCEJIciPAyFJvtH-kiycsZkQvptw83AnIQsHjVyh1Okb_o6Qn4hzTODGUnaHmrEfnkR8qTZzumOShp63WimbkK0Q9z0etPoTmLv0lVwxrxOyXasGPoF0vz5d7wc9Y4PrZF5lhbMSKuerJF8davqLLz-oGOHV29PFdpTMOUAovO65veKS6oevA2hqlQ5WnDBKGntsLa6XkJUXa3XkU0mZXuMkv-7Afh2YauAwuPkmyTfo6utu5ecWSkiZkNKNxChhPwCz0KDa20cC3wcEJCEVaikX0MyClt--XK9urpEZ655bRFE9dkjDoLR1k-BkKnF7O9YzpvpJ7ueqc2NGMAnZIiobxCUTYxPmENPU3KKasjurKYOErNGgYdCKgTHQIKNGHYpdS2qMYpw6DnqUyDDNBzt71U3SWZIuv01zk-pu7EFaM_mHGrw_TMEFwyG4TD6C6UFsg62bwZikpEiXaZWQbc3lYz2SIsxYhrDVfBCA9otyVxZ4lHdS_ZRYcDnucSdHhKH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