[flang-commits] [flang] [flang] Fix volatile attribute propagation on allocatables (PR #139183)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Fri May 9 04:23:32 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);
----------------
tblah wrote:
Line 213 checks if `fortran_attrs` is null before calling `bitEnumContainsAny`. Is that needed here too?
https://github.com/llvm/llvm-project/pull/139183
More information about the flang-commits
mailing list