[flang-commits] [flang] [flang] Set assumed-size last extent to -1 (PR #79156)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Tue Jan 23 09:37:23 PST 2024


================
@@ -5691,10 +5691,10 @@ static mlir::Value computeLBOUND(fir::FirOpBuilder &builder, mlir::Location loc,
   if (hasDefaultLowerBound(array))
     return one;
   mlir::Value lb = fir::factory::readLowerBound(builder, loc, array, dim, one);
-  if (dim + 1 == array.rank() && array.isAssumedSize())
-    return lb;
   mlir::Value extent = fir::factory::readExtent(builder, loc, array, dim);
   zero = builder.createConvert(loc, extent.getType(), zero);
+  // Note: for assumed size, the extent is -1, and the lower bound should
+  // be return. It is important to test extent == 0 and not extent > 0.
----------------
clementval wrote:

```suggestion
  // be returned. It is important to test extent == 0 and not extent > 0.
```

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


More information about the flang-commits mailing list