Skip to content

[flang][runtime] Don't emit runtime error for "AA" editing #107714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

klausler
Copy link
Contributor

@klausler klausler commented Sep 7, 2024

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

Commas are optional between edit descriptors in a format, so treat
"AA" as if it were "A,A".
@klausler klausler requested a review from vdonaldson September 7, 2024 20:00
@llvmbot llvmbot added flang:runtime flang Flang issues not falling into any other category labels Sep 7, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 7, 2024

@llvm/pr-subscribers-flang-runtime

Author: Peter Klausler (klausler)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/107714.diff

1 Files Affected:

  • (modified) flang/runtime/format-implementation.h (+3-2)
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_;

@klausler klausler merged commit cd92c42 into llvm:main Sep 10, 2024
11 checks passed
@klausler klausler deleted the fs21012 branch September 10, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:runtime flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants