[flang-commits] [PATCH] D116622: [flang] Modify an IO format error message

vdonaldson via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jan 4 13:16:39 PST 2022


vdonaldson created this revision.
vdonaldson added a project: Flang.
Herald added a subscriber: jdoerfert.
vdonaldson requested review of this revision.

F18 <https://reviews.llvm.org/F18> constraint C1308 is:

  For the G edit descriptor, e shall not be specified if w is zero.

For an edit descriptor such as 'G0.2E4', change the error message from:

  error: Unexpected 'e' in 'G0' edit descriptor

To:

  error: A 'G0' edit descriptor must not have an 'e' value


https://reviews.llvm.org/D116622

Files:
  flang/include/flang/Common/format.h
  flang/test/Semantics/io07.f90
  flang/test/Semantics/io08.f90


Index: flang/test/Semantics/io08.f90
===================================================================
--- flang/test/Semantics/io08.f90
+++ flang/test/Semantics/io08.f90
@@ -189,10 +189,10 @@
   !ERROR: Expected 'G' edit descriptor '.d' value
   write(*,'(G4)')
 
-  !ERROR: Unexpected 'e' in 'G0' edit descriptor
+  !ERROR: A 'G0' edit descriptor must not have an 'e' value
   write(*,'(G0.8e)')
 
-  !ERROR: Unexpected 'e' in 'G0' edit descriptor
+  !ERROR: A 'G0' edit descriptor must not have an 'e' value
   write(*,'(G0.8e2)')
 
   !ERROR: Kind parameter '_' character in format expression
Index: flang/test/Semantics/io07.f90
===================================================================
--- flang/test/Semantics/io07.f90
+++ flang/test/Semantics/io07.f90
@@ -74,9 +74,9 @@
 
 8001 format(9G0.5)
 
-     !ERROR: Unexpected 'e' in 'G0' edit descriptor
+     !ERROR: A 'G0' edit descriptor must not have an 'e' value
 8101 format(9(G0.5e1))
 
-     !ERROR: Unexpected 'e' in 'G0' edit descriptor
+     !ERROR: A 'G0' edit descriptor must not have an 'e' value
 8102 format(9(G0.5  E 1))
 end
Index: flang/include/flang/Common/format.h
===================================================================
--- flang/include/flang/Common/format.h
+++ flang/include/flang/Common/format.h
@@ -606,8 +606,8 @@
             check_e();
           }
         } else if (token_.kind() == TokenKind::Point && check_d() &&
-            token_.kind() == TokenKind::E) {
-          ReportError("Unexpected 'e' in 'G0' edit descriptor"); // C1308
+            token_.kind() == TokenKind::E) { // C1308
+          ReportError("A 'G0' edit descriptor must not have an 'e' value");
           NextToken();
           if (token_.kind() == TokenKind::UnsignedInteger) {
             NextToken();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116622.397386.patch
Type: text/x-patch
Size: 1789 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220104/4e2ba214/attachment.bin>


More information about the flang-commits mailing list