[flang-commits] [flang] [flang] Accept OPEN(..., CONVERT="SWAP") in semantics (PR #79050)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Mon Jan 22 12:19:51 PST 2024


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/79050

The runtime implements CONVERT="SWAP", but semantics doesn't like it.  Add it to the relevant table.

Fixes llvm-test-suite/Fortran/gfortran/regression/record_marker_1.f90, .../unf_io_convert_1.f90, .../unf_io_convert_2.f90, and .../unf_io_convert_3.f90.

>From 696b8626fc8def9c7235fd1cd51d0e08d1d129d8 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Mon, 22 Jan 2024 12:16:58 -0800
Subject: [PATCH] [flang] Accept OPEN(...,CONVERT="SWAP") in semantics

The runtime implements CONVERT="SWAP", but semantics doesn't
like it.  Add it to the relevant table.

Fixes llvm-test-suite/Fortran/gfortran/regression/record_marker_1.f90,
.../unf_io_convert_1.f90, .../unf_io_convert_2.f90, and
.../unf_io_convert_3.f90.
---
 flang/lib/Semantics/check-io.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/lib/Semantics/check-io.cpp b/flang/lib/Semantics/check-io.cpp
index 3cff6eca4542c7..ad89a9be5a290f 100644
--- a/flang/lib/Semantics/check-io.cpp
+++ b/flang/lib/Semantics/check-io.cpp
@@ -918,7 +918,7 @@ void IoChecker::CheckStringValue(IoSpecKind specKind, const std::string &value,
           // Open values; Close values are {"DELETE", "KEEP"}.
           {"NEW", "OLD", "REPLACE", "SCRATCH", "UNKNOWN"}},
       {IoSpecKind::Carriagecontrol, {"LIST", "FORTRAN", "NONE"}},
-      {IoSpecKind::Convert, {"BIG_ENDIAN", "LITTLE_ENDIAN", "NATIVE"}},
+      {IoSpecKind::Convert, {"BIG_ENDIAN", "LITTLE_ENDIAN", "NATIVE", "SWAP"}},
       {IoSpecKind::Dispose, {"DELETE", "KEEP"}},
   };
   auto upper{Normalize(value)};



More information about the flang-commits mailing list