[llvm] [flang][runtime] Fix formatted input of NAN(...) (PR #149606)

Peter Klausler via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 07:33:57 PDT 2025


================
@@ -375,21 +375,33 @@ static RT_API_ATTRS ScannedRealInput ScanRealInput(
         Put(*next);
       }
     }
-    if (next && *next == '(') { // NaN(...)
-      Put('(');
-      int depth{1};
-      while (true) {
-        next = io.NextInField(remaining, edit);
-        if (depth == 0) {
-          break;
-        } else if (!next) {
-          return {}; // error
-        } else if (*next == '(') {
-          ++depth;
-        } else if (*next == ')') {
-          --depth;
+    if (first == 'N' && !next && remaining.value_or(1) > 0) { // NaN(...)?
+      std::size_t byteCount{0};
+      next = io.GetCurrentChar(byteCount);
+      if (next && *next == '(') {
+        int depth{1};
+        while (true) {
+          if (*next >= 'a' && *next <= 'z') {
+            *next = *next - 'a' + 'A';
+          }
----------------
klausler wrote:

No.

https://github.com/llvm/llvm-project/pull/149606


More information about the llvm-commits mailing list