[flang-commits] [flang] [llvm] Flang improve fidelity of unformatted I/O endianness with FORT_CONVERT_UNIT (PR #223831)
David Parks via flang-commits
flang-commits at lists.llvm.org
Fri Sep 18 09:12:43 PDT 2026
================
@@ -112,9 +113,26 @@ bool ExternalFileUnit::OpenUnit(common::optional<OpenStatus> status,
common::optional<Action> action, Position position,
OwningPtr<char> &&newPath, std::size_t newPathLength, Convert convert,
IoErrorHandler &handler) {
+ Convert explicitRtConvert{Convert::Unknown};
+
+ // Increasing order of conversion specifiers (endianness)
+ // 1. CONVERT=<mode> specifier on OPEN statement.
+ // 2. Environment variable FORT_CONVERT iff CONVERT specifier is not present.
+ // 3. Even if CONVERT specifier is present, check to environment variable
+ // FORT_CONVERT_UNIT to see if unit number has an explicit setting.
+
if (convert == Convert::Unknown) {
convert = executionEnvironment.conversion;
}
+
+ explicitRtConvert = executionEnvironment.UnitRtConvert(unitNumber());
+ if (Convert::Unknown != explicitRtConvert) {
+ // Runtime has overridden previous defaults using environment variable
+ // FORT_CONVERT_UNIT.
+ convert = explicitRtConvert;
+ }
+
+ executionEnvironment.UnitRtConvert(unitNumber());
----------------
d-parks wrote:
Argh - yup - an error. Thanks.
https://github.com/llvm/llvm-project/pull/223831
More information about the flang-commits
mailing list