[flang-commits] [PATCH] D128262: [Fortran] Avoid digits in character constant

Diana Picus via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 21 05:20:40 PDT 2022


rovka created this revision.
rovka added reviewers: awarzynski, kiranchandramohan, Meinersbur, sscalpone, naromero77.
rovka added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
rovka requested review of this revision.

Test 9 from FM905.f tests the splitting of long character strings at the
80-character boundary when using list-directed output. There are
2 issues that make it difficult to keep this test in the test-suite in
its current form:

1. One of the character constants contains only digits, which makes

fpcmp interpret it as a very large number rather than a character
constant. This is only really a problem because of issue #2:

2. The standard is not strict about the number of spaces that can

crop up in list-directed output, which means that different compilers
will reach column 80 at different points in the character constant, and
therefore fpcmp will either see one very large number or 2 smaller but
somewhat arbitrary numbers, depending on where the newline was inserted.

This patch changes the problematic character constant to use letters
instead of digits. Since whitespaces are ignored, this fixes the issue.


Repository:
  rT test-suite

https://reviews.llvm.org/D128262

Files:
  Fortran/UnitTests/fcvs21_f95/FM905.f
  Fortran/UnitTests/fcvs21_f95/FM905.reference_output
  Fortran/UnitTests/fcvs21_f95/README


Index: Fortran/UnitTests/fcvs21_f95/README
===================================================================
--- Fortran/UnitTests/fcvs21_f95/README
+++ Fortran/UnitTests/fcvs21_f95/README
@@ -47,6 +47,8 @@
   strings to conform to the Fortran 95 standard.
 
 Modifications:
+2022 June by Diana Picus
+- replaced digits with letters in test 9 from FM905.f
 June 10 by Nichols A. Romero
 - modified driver_run input and output files to make it easier to update LLVM Test-Suite
 - remove a number of problematic tests, see CMakeLists.txt
Index: Fortran/UnitTests/fcvs21_f95/FM905.reference_output
===================================================================
--- Fortran/UnitTests/fcvs21_f95/FM905.reference_output
+++ Fortran/UnitTests/fcvs21_f95/FM905.reference_output
@@ -67,10 +67,10 @@
        5 O'CLOCK
      9    INSPECT
                  COMPUTED= 
- SHORTTHIS IS A LONGER CHARACTER STRING123456789012345678901234567890123456789012345678901234567890123456789012          
+ SHORTTHIS IS A LONGER CHARACTER STRINGabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijab
                  CORRECT=  
- SHORT  THIS IS A LONGER CHARACTER STRING 123456789012345678901234567890123456789
- 012345678901234567890123456789012
+ SHORT  THIS IS A LONGER CHARACTER STRING abcdefghijabcdefghijabcdefghijabcdefghi
+ jabcdefghijabcdefghijabcdefghijab
     10    INSPECT
                  COMPUTED= 
            5           5           5           5           5
Index: Fortran/UnitTests/fcvs21_f95/FM905.f
===================================================================
--- Fortran/UnitTests/fcvs21_f95/FM905.f
+++ Fortran/UnitTests/fcvs21_f95/FM905.f
@@ -222,15 +222,15 @@
            WRITE (NUVI, 80020)                                          02200905
         A5VK = 'SHORT'                                                  02210905
         A33VK = 'THIS IS A LONGER CHARACTER STRING'                     02220905
-        A82VK = '123456789012345678901234567890123456789012345678901234502230905
-     167890123456789012'                                                02240905
+        A82VK = 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde02230905
+     1fghijabcdefghijab'                                                02240905
         WRITE(NUVI, *) A5VK, A33VK, A82VK                               02250905
            IVINSP = IVINSP + 1                                          02260905
            WRITE (NUVI, 80022)                                          02270905
            WRITE (NUVI, 70091)                                          02280905
 70091      FORMAT(" ", "SHORT  THIS IS A LONGER CHARACTER STRING" ,     02290905
-     1            " 123456789012345678901234567890123456789" /          02300905
-     2            " ","012345678901234567890123456789012" )             02310905
+     1            " abcdefghijabcdefghijabcdefghijabcdefghi" /          02300905
+     2            " ","jabcdefghijabcdefghijabcdefghijab" )             02310905
 CT010*  TEST 10 - SEVERAL IDENTICAL VALUES                              02320905
            IVTNUM = 10                                                  02330905
            WRITE (NUVI, 80004) IVTNUM                                   02340905


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128262.438650.patch
Type: text/x-patch
Size: 3250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220621/bc90b536/attachment.bin>


More information about the flang-commits mailing list