[clang] [Clang] Fix assertion failure (#189260) (PR #189305)
Kartik Ohlan via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 29 20:53:41 PDT 2026
https://github.com/Ko496-glitch created https://github.com/llvm/llvm-project/pull/189305
#189260
Fix assertion failure in boolean vector indexing by truncating to i1.
>From 0283bf6204c38b5289a8d4a64c01d2544073bf6e Mon Sep 17 00:00:00 2001
From: kartikohlan <kartik7ohlan at gmail.com>
Date: Sun, 29 Mar 2026 23:49:47 -0400
Subject: [PATCH] [Clang] Fix assertion failure (#189260)
---
clang/lib/CodeGen/CGExpr.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index eebb36276e0eb..1c305dd1b5018 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2756,6 +2756,10 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
Builder.getInt1Ty(), IRStoreTy->getPrimitiveSizeInBits());
Vec = Builder.CreateBitCast(Vec, IRVecTy);
// iN --> <N x i1>.
+
+ if(SrcVal->getType() != Builder.getInt1Ty())
+ SrcVal = Builder.CreateTrunc(SrcVal,Builder.getInt1Ty());
+ }
}
// Allow inserting `<1 x T>` into an `<N x T>`. It can happen with scalar
More information about the cfe-commits
mailing list