[flang-commits] [flang] [flang] Fix -debug crash from VScaleAttrPass (PR #180234)

Philipp Rados via flang-commits flang-commits at lists.llvm.org
Mon Feb 9 04:29:30 PST 2026


================
@@ -63,16 +66,29 @@ void VScaleAttrPass::runOnOperation() {
 
   LLVM_DEBUG(llvm::dbgs() << "Func-name:" << func.getSymName() << "\n");
 
+  if (!llvm::isPowerOf2_32(vscaleMin)) {
+    LLVM_DEBUG(
+        llvm::dbgs()
+        << "VScaleAttr: vscaleMin has to be a power-of-two greater than 0\n");
+    return;
----------------
prados-oc wrote:

Ok I have a found a fix for this problem:
```
// RUN: not fir-opt --vscale-attr="vscale-min=0 vscale-max=4" %s 2>&1 | FileCheck %s --check-prefix=VSCALE-MIN-0

// VSCALE-MIN-0: VScaleAttr: vscaleMin has to be a power-of-two greater than 1
func.func @_QPtest(%arg0: !fir.ref<i32> {fir.bindc_name = "x"}) {
  return
}
```
It's not using the diagnostics-engine to check for the error, but I think this is still fine.

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


More information about the flang-commits mailing list