[clang] [clang] Fix division by zero in ACLEIntrinsic constructor (PR #115883)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 04:59:31 PST 2024


================
@@ -1415,7 +1415,10 @@ ACLEIntrinsic::ACLEIntrinsic(EmitterBase &ME, const Record *R,
         } else if (Bounds->getName() == "IB_LaneIndex") {
           IA.boundsType = ImmediateArg::BoundsType::ExplicitRange;
           IA.i1 = 0;
-          IA.i2 = 128 / Param->sizeInBits() - 1;
+          unsigned sizeInBits = Param->sizeInBits();
+          if (sizeInBits == 0)
+            PrintFatalError("Division by zero: Param->sizeInBits() is zero.");
----------------
Fznamznon wrote:

mm
https://github.com/llvm/llvm-project/blob/97298853b4de70dbce9c0a140ac38e3ac179e02e/clang/utils/TableGen/MveEmitter.cpp#L102

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


More information about the cfe-commits mailing list