[clang] [Clang] Fix assertion failure (#189260) (PR #189305)
Kartik Ohlan via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 30 15:48:11 PDT 2026
https://github.com/Ko496-glitch updated https://github.com/llvm/llvm-project/pull/189305
>From 2d47db0ff28f869363ed3808a82d6996dd07c2c5 Mon Sep 17 00:00:00 2001
From: kartikohlan <kartik7ohlan at gmail.com>
Date: Sun, 29 Mar 2026 23:49:47 -0400
Subject: [PATCH 1/2] [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 23802cdeb4811..737d4fd145a4d 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2781,6 +2781,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
>From 9a0b88d08f96f9ca0cf2f3e17b6d6a696817144d Mon Sep 17 00:00:00 2001
From: kartikohlan <kartik7ohlan at gmail.com>
Date: Mon, 30 Mar 2026 18:46:21 -0400
Subject: [PATCH 2/2] Added the exisiting practise and fixed the format
---
clang/lib/CodeGen/CGExpr.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 737d4fd145a4d..20a38b6367df5 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2782,9 +2782,8 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
Vec = Builder.CreateBitCast(Vec, IRVecTy);
// iN --> <N x i1>.
- if(SrcVal->getType() != Builder.getInt1Ty())
- SrcVal = Builder.CreateTrunc(SrcVal,Builder.getInt1Ty());
- }
+ SrcVal = Builder.CreateIntCast(SrcVal, Builder.getInt1Ty(),
+ /*isSigned=*/false);
}
// Allow inserting `<1 x T>` into an `<N x T>`. It can happen with scalar
More information about the cfe-commits
mailing list