[flang-commits] [flang] [flang] Enumeration Type: (PR 4/5) Lowering (PR #193571)
via flang-commits
flang-commits at lists.llvm.org
Thu Oct 1 19:49:39 PDT 2026
================
@@ -2348,6 +2515,43 @@ hlfir::EntityWithAttributes Fortran::lower::convertExprToHLFIR(
return HlfirBuilder(loc, converter, symMap, stmtCtx).gen(expr);
}
+hlfir::Entity Fortran::lower::genEnumerationOrdinalDesignator(
+ mlir::Location loc, fir::FirOpBuilder &builder, hlfir::Entity enumVar) {
+ assert(enumVar.isVariable() && "expected an enumeration variable");
+ auto recTy = mlir::cast<fir::RecordType>(enumVar.getFortranElementType());
+ assert(recTy.getNumFields() == 1 && "expected an enumeration type");
+ auto [fieldName, ordTy] = recTy.getTypeList().front();
+ mlir::Type designatorType = builder.getRefType(ordTy);
----------------
MattPD wrote:
For `type(color), volatile :: c`, `i=int(c)` now emits `load i32` rather than `load volatile i32`. The read remains volatile at [095d1945](https://github.com/llvm/llvm-project/commit/095d1945f7700776c0f8f0ed00640133a8c285f2). Strict FIR verification also diagnoses a volatility mismatch between the enumeration reference and the ordinal reference. Could the ordinal designator preserve `c`'s VOLATILE qualification, as ordinary component designators do?
https://github.com/llvm/llvm-project/pull/193571
More information about the flang-commits
mailing list