[flang-commits] [flang] [flang] Fix volatile attribute propagation on allocatables (PR #139183)
Asher Mancinelli via flang-commits
flang-commits at lists.llvm.org
Fri May 9 06:42:04 PDT 2025
================
@@ -207,20 +207,25 @@ static bool hasExplicitLowerBounds(mlir::Value shape) {
mlir::isa<fir::ShapeShiftType, fir::ShiftType>(shape.getType());
}
-static std::pair<mlir::Type, mlir::Value> updateDeclareInputTypeWithVolatility(
+static std::pair<mlir::Type, mlir::Value> updateDeclaredInputTypeWithVolatility(
mlir::Type inputType, mlir::Value memref, mlir::OpBuilder &builder,
fir::FortranVariableFlagsAttr fortran_attrs) {
if (fortran_attrs &&
bitEnumContainsAny(fortran_attrs.getFlags(),
fir::FortranVariableFlagsEnum::fortran_volatile)) {
+ // A volatile pointer's pointee is volatile.
const bool isPointer = bitEnumContainsAny(
fortran_attrs.getFlags(), fir::FortranVariableFlagsEnum::pointer);
+ // An allocatable's inner type's volatility matches that of the reference.
+ const bool isAllocatable = bitEnumContainsAny(
+ fortran_attrs.getFlags(), fir::FortranVariableFlagsEnum::allocatable);
----------------
ashermancinelli wrote:
We should have only entered this if-body if the attrs were non-null, but I think this is not very clear. Let me rewrite this a bit so it's more obvious. Thanks!
https://github.com/llvm/llvm-project/pull/139183
More information about the flang-commits
mailing list