[flang-commits] [flang] [flang][runtime] Don't emit runtime error for "AA" editing (PR #107714)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Sat Sep 7 13:00:15 PDT 2024


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

Commas are optional between edit descriptors in a format, so treat "AA" as if it were "A,A".

>From 7b4da8853e8ee91a10cc68b40f0c4cc4c145b1b8 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Sat, 7 Sep 2024 12:58:35 -0700
Subject: [PATCH] [flang][runtime] Don't emit runtime error for "AA" editing

Commas are optional between edit descriptors in a format, so treat
"AA" as if it were "A,A".
---
 flang/runtime/format-implementation.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/flang/runtime/format-implementation.h b/flang/runtime/format-implementation.h
index 74254bebe6e7a8..46204ca927c135 100644
--- a/flang/runtime/format-implementation.h
+++ b/flang/runtime/format-implementation.h
@@ -443,8 +443,9 @@ RT_API_ATTRS int FormatControl<CONTEXT>::CueUpNextDataEdit(
       if (ch != 'P') { // 1PE5.2 - comma not required (C1302)
         CharType peek{Capitalize(PeekNext())};
         if (peek >= 'A' && peek <= 'Z') {
-          if (ch == 'A' /* anticipate F'202X AT editing */ || ch == 'B' ||
-              ch == 'D' || ch == 'E' || ch == 'R' || ch == 'S' || ch == 'T') {
+          if ((ch == 'A' && peek == 'T' /* anticipate F'202X AT editing */) ||
+              ch == 'B' || ch == 'D' || ch == 'E' || ch == 'R' || ch == 'S' ||
+              ch == 'T') {
             // Assume a two-letter edit descriptor
             next = peek;
             ++offset_;



More information about the flang-commits mailing list