[clang] [Clang] prevented assertion failure by handling integral to boolean conversions for boolean vectors (PR #108657)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 16 19:53:03 PDT 2024


================
@@ -9868,7 +9868,12 @@ static bool tryVectorConvertAndSplat(Sema &S, ExprResult *scalar,
   // if necessary.
   CastKind scalarCast = CK_NoOp;
 
-  if (vectorEltTy->isIntegralType(S.Context)) {
+  if (vectorEltTy->isBooleanType()) {
+    if (scalarTy->isIntegralType(S.Context))
+      scalarCast = CK_IntegralToBoolean;
+    else if (!scalarTy->isBooleanType())
----------------
shafik wrote:

So why doesn't the `scalarTy->isIntegralType` include `isBooleanType()`? 

Also we have two branches here but only one added test case? Which case covers the crash from the issue and what code should the other branch catch?

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


More information about the cfe-commits mailing list