[clang] [clang][bytecode] Fix crash on discarded complex comparison (PR #177731)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 25 04:23:51 PST 2026


================
@@ -7406,7 +7406,13 @@ bool Compiler<Emitter>::emitComplexComparison(const Expr *LHS, const Expr *RHS,
                                               const BinaryOperator *E) {
   assert(E->isComparisonOp());
   assert(!Initializing);
-  assert(!DiscardResult);
+if (DiscardResult) {
+    if (!this->discard(LHS))
+        return false;
+    if (!this->discard(RHS))
+        return false;
+    return true;
----------------
tbaederr wrote:

```suggestion
return this->discard(LHS) && this->discard(RHS);
```

https://github.com/llvm/llvm-project/pull/177731


More information about the cfe-commits mailing list