[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 03:11:42 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:
Yes, I agree. However I'm struggling to find a way to properly test this since the tests now error e.g:
```
// RUN: fir-opt --vscale-attr="vscale-min=0 vscale-max=4" --verify-diagnostics %s | FileCheck %s --check-prefix=VSCALE-MIN-0
// VSCALE-MIN-0: expected-error @func {{VScaleAttr: vscaleMin has to be a power-of-two greater than 0}}
func.func @_QPtest(%arg0: !fir.ref<i32> {fir.bindc_name = "x"}) {
return
}
```
so FileCheck won't receive the input.
I couldn't find any other test that uses `--check-prefix` when testing diagnostics. Do you have an idea how to do this?
https://github.com/llvm/llvm-project/pull/180234
More information about the flang-commits
mailing list