]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cobol: Don't display 0xFF HIGH-VALUE characters in testcases. [PR120251]
authorRobert Dubner <rdubner@symas.com>
Thu, 15 May 2025 16:01:12 +0000 (12:01 -0400)
committerRobert Dubner <rdubner@symas.com>
Tue, 29 Jul 2025 16:06:38 +0000 (12:06 -0400)
The tests were displaying 0xFF characters, and the resulting generated
output changed with the system locale.  The check_88 test was modified
so that the regex comparisons ignore those character positions. Two
of the other tests were changed to output hexadecimal rather than
character strings.

There is one new test, and the other inspect testcases were edited to
remove an unimportant back-apostrophe that had found its way into the
source code sequence number area.

gcc/testsuite/ChangeLog:

PR cobol/120251
* cobol.dg/group1/check_88.cob: Ignore characters above 0x80.
* cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob:
Output HIGH-VALUE as hex, rather than as characters.
* cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out:
Likewise.
* cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob: Typo.
* cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out: Likewise.
* cobol.dg/group2/INSPECT_ISO_Example_1.cob: Likewise.
* cobol.dg/group2/INSPECT_ISO_Example_2.cob: Likewise.
* cobol.dg/group2/INSPECT_ISO_Example_3.cob: Likewise.
* cobol.dg/group2/INSPECT_ISO_Example_4.cob: Likewise.
* cobol.dg/group2/INSPECT_ISO_Example_5-f.cob: Likewise.
* cobol.dg/group2/INSPECT_ISO_Example_6.cob: Likewise.
* cobol.dg/group2/INSPECT_ISO_Example_7.cob: Likewise.
* cobol.dg/group2/Multiple_INDEXED_BY_variables_with_the_same_name.cob: New test.
* cobol.dg/group2/Multiple_INDEXED_BY_variables_with_the_same_name.out: New test.

(cherry picked from commit 022d8e25e49021b378a4e6c24c2f0c380a066690)

14 files changed:
gcc/testsuite/cobol.dg/group1/check_88.cob
gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob
gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out
gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob
gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out
gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob
gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob
gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob
gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob
gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob
gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob
gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob
gcc/testsuite/cobol.dg/group2/Multiple_INDEXED_BY_variables_with_the_same_name.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Multiple_INDEXED_BY_variables_with_the_same_name.out [new file with mode: 0644]

index 4a7723eb92a303cddcda4b46ab4be3cc68a18274..18a299fc282bd9e272f8aea39b161531137a1dd2 100644 (file)
@@ -3,25 +3,25 @@
 *> { dg-output {\->   <\-(\n|\r\n|\r)} }
 *> { dg-output {\->"""<\-(\n|\r\n|\r)} }
 *> { dg-output {\->000<\-(\n|\r\n|\r)} }
-*> { dg-output {\->ÿÿÿ<\-(\n|\r\n|\r)} }
+*> { dg-output {\->.*<\-(\n|\r\n|\r)} }
 *> { dg-output { (\n|\r\n|\r)} }
 *> { dg-output {\-><\-(\n|\r\n|\r)} }
 *> { dg-output {\->    <\-(\n|\r\n|\r)} }
 *> { dg-output {\->""""<\-(\n|\r\n|\r)} }
 *> { dg-output {\->0000<\-(\n|\r\n|\r)} }
-*> { dg-output {\->ÿÿÿÿ<\-(\n|\r\n|\r)} }
+*> { dg-output {\->.*<\-(\n|\r\n|\r)} }
 *> { dg-output { (\n|\r\n|\r)} }
 *> { dg-output {There should be no garbage after character 32(\n|\r\n|\r)} }
 *> { dg-output {\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-(\n|\r\n|\r)} }
-*> { dg-output {üüüüüüüüüüüüüüüüüüü Bundesstraße                                (\n|\r\n|\r)} }
-*> { dg-output {üüüüüüüüüüüüüüüüüüü Bundesstraße                                (\n|\r\n|\r)} }
+*> { dg-output {.* Bundesstra.e                                (\n|\r\n|\r)} }
+*> { dg-output {.* Bundesstra.e                                (\n|\r\n|\r)} }
 *> { dg-output { (\n|\r\n|\r)} }
 *> { dg-output {There should be no spaces before the final quote(\n|\r\n|\r)} }
-*> { dg-output {"üüüüüüüüüüüüüüüüüüü Bundesstraße"(\n|\r\n|\r)} }
+*> { dg-output {".* Bundesstraße"(\n|\r\n|\r)} }
 *> { dg-output { (\n|\r\n|\r)} }
 *> { dg-output {   IsLow   ""(\n|\r\n|\r)} }
 *> { dg-output {   IsZero  "000"(\n|\r\n|\r)} }
-*> { dg-output {   IsHi    "ÿÿÿ"(\n|\r\n|\r)} }
+*> { dg-output {   IsHi    ".*"(\n|\r\n|\r)} }
 *> { dg-output {   IsBob   "bob"(\n|\r\n|\r)} }
 *> { dg-output {   IsQuote """""(\n|\r\n|\r)} }
 *> { dg-output {   IsSpace "   "(\n|\r\n|\r)} }
index 6fab992b56fccc574a17f9fadb34d8590b4b65ad..a5ef3a8e473793336ad91a738fc1e7e5e61dc6fc 100644 (file)
          02  based-x            pic x(24) value "I am I, Don Quixote".
          02  based-9            pic 999   value 123.
          02  based-p            pointer   value NULL.
+        01 pval redefines based-var pointer.
         01   allocated-pointer  pointer.
         procedure division.
         display     "allocate characters  (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)"
         allocate 35 characters returning allocated-pointer
         set address of based-var to allocated-pointer
-        call        "reporter" using based-var
+        display pval
         free        allocated-pointer
         goback.
         end program             prog-high.
index c141fdf702aa9fbc7261c6692b597baee00e0f37..ea05e96cfb31f8f73bb27f2873e2361c64de2a1c 100644 (file)
@@ -12,6 +12,5 @@ allocate characters  (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultb
        "                        " "   " 0x2020202020202020
 initialize high-value
 allocate characters  (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)
-   (1) as allocated
-       "ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ" "¿¿¿" 0xffffffffffffffff
+0xffffffffffffffff
 
index 2983cce07bfcc8d54236d65bd7997235bb16dcd3..91440f5e555afc7c80fdfa1bc61c7b61392db3e8 100644 (file)
@@ -1,27 +1,27 @@
        *> { dg-do run }
        *> { dg-output-file "group2/INSPECT_CONVERTING_TO_figurative_constants.out" }
-
         identification division.
         program-id. clouseau.
         data division.
         working-storage section.
         01 item pic x(12).
+        01 pitem redefines item pointer.
         procedure division.
         move all "abcd" to item
         inspect item converting "abcd" to low-values
-        display "low-values " space """" item """"
+        display "low-values " space """" pitem """"
         move all "abcd" to item
         inspect item converting "abcd" to spaces
-        display "spaces     " space """" item """"
+        display "spaces     " space """" pitem """"
         move all "abcd" to item
         inspect item converting "abcd" to zeros
-        display "zeros      " space """" item """"
+        display "zeros      " space """" pitem """"
         move all "abcd" to item
         inspect item converting "abcd" to quotes
-        display "quotes     " space """" item """"
+        display "quotes     " space """" pitem """"
         move all "abcd" to item
         inspect item converting "abcd" to high-values
-        display "high-values" space """" item """"
+        display "high-values" space """" pitem """"
         goback.
         end program clouseau.
 
index 7de6e48102096f2c6afa8d3e49fb9db23f17db96..23ce49ba5743fba74059d4a802b568937e6a982e 100644 (file)
@@ -1,6 +1,6 @@
-low-values  ""
-spaces      "            "
-zeros       "000000000000"
-quotes      """"""""""""""
-high-values "ÿÿÿÿÿÿÿÿÿÿÿÿ"
+low-values  "0x0000000000000000"
+spaces      "0x2020202020202020"
+zeros       "0x3030303030303030"
+quotes      "0x2222222222222222"
+high-values "0xffffffffffffffff"
 
index 1bbdea447524d47dfa1295d2834dbeffc803300a..2f306f1159a277bfc597301b2f87a0af76f18dc5 100644 (file)
@@ -25,7 +25,7 @@
         Move ' EFABDBCGABEFGG      0301010005TUXYXVWRXYZZPZ' to row(1).
         Move ' BABABC              0200000101SXYXYZ'         to row(3).
         Move ' BBBC                0001000200SSVW'           to row(5).
-`
+
         compute rowlim = 2*rows - 1
 
         Display '  INPUT                C0 C1 C2 C3 C4 OUTPUT'
index a464101ae16d9788a6c6795eb0a5b54fcc888b62..0e4297dc7e1a6c31a97a32a118fb0e46ac8d131a 100644 (file)
@@ -25,7 +25,7 @@
         *> the observed outputs
         Move ' BBB                 0300ZZZ' to row(1).
         Move ' ABA                 0300ZZZ' to row(3).
-`
+
         compute rowlim = 2*rows - 1
 
         Display '  INPUT                C0 C1 OUTPUT'
index 7111e9c107157a62b2ec0c3022205ceb1a88314b..0b6c00cb54d6e72ff964d915525d33fdbb56661e 100644 (file)
@@ -19,7 +19,7 @@
         Move ' ADDDDA              000005AZZZZZ'  to row(5).
         Move ' CDDDDC              000000CDDDDC'  to row(7).
         Move ' BDBBBDB             000300BDWWWDB' to row(9).
-`
+
         Display '  INPUT                C0 C1 C2 OUTPUT'
         Display '  -------------------- -- -- -- --------------------'
         Perform Example-3 with test after
index 192e1a83a3043d1080be47a5d41c9187802228e0..03a0b073169c10f206dfb710c6f5c626fca4bb6d 100644 (file)
@@ -24,7 +24,7 @@
         *> Even-numbered rows are modified by the INSPECT statements and contain
         *> the observed outputs
         Move ' ABABABABC           01ABABXYABC' to row(1).
-`
+
         compute rowlim = 2*rows - 1
 
         Display '  INPUT                C0 C1 OUTPUT'
index 09237203c1296c2dc50193c06781e4270e1c938f..5ef97e1830cd94838687cc9f24bcc1282dcbfbd3 100644 (file)
@@ -30,7 +30,7 @@
         Move ' ABABBCAB            000106ABABBCXY' to row(1).
         Move ' ABDBABC             000001AVDBABC'  to row(3).
         Move ' BCABCABD            010000BCABCAVD' to row(5).
-`
+
         compute rowlim = 2*rows - 1
 
         Display '  INPUT                C0 C1 C2 OUTPUT'
index 75917a2d78c4936bf34a0cbd9b837aa620ead005..40cecfc29ca0812db07b07940ea76f3649acd4c7 100644 (file)
@@ -22,7 +22,7 @@
         *> Even-numbered rows are modified by the INSPECT statements and contain
         *> the observed outputs
         Move ' AC"AEBDFBCD#AB"D    AC"XEYXFYZX#AB"D' to row(1).
-`
+
         compute rowlim = 2*rows - 1
 
         Display '  INPUT                OUTPUT'
index ca2ae71ed0bd3c1b84d2830a4ff297cd381b4487..abf9eb95197f98c97c3a11255d60d71c14ee9aa9 100644 (file)
@@ -27,7 +27,7 @@
         Move ' 415-245-1212        415-245-1212' to row(1).
         Move ' 415-CH5-1212        415-??5-1212' to row(3).
         Move ' 20%Numeric          20%???????' to row(5).
-`
+
         compute rowlim = 2*rows - 1
 
         Display '  INPUT                OUTPUT'
diff --git a/gcc/testsuite/cobol.dg/group2/Multiple_INDEXED_BY_variables_with_the_same_name.cob b/gcc/testsuite/cobol.dg/group2/Multiple_INDEXED_BY_variables_with_the_same_name.cob
new file mode 100644 (file)
index 0000000..4bcc06c
--- /dev/null
@@ -0,0 +1,24 @@
+       *> { dg-do run }
+       *> { dg-output-file "group2/Multiple_INDEXED_BY_variables_with_the_same_name.out" }
+       IDENTIFICATION DIVISION.
+       PROGRAM-ID. prog.
+       DATA DIVISION.
+       WORKING-STORAGE SECTION.
+       01  GROUP-1-TABLE.
+           05  TABLE-LEVEL-1 VALUE "ABCDEFGHIJKLMNO".
+               06  TABLE-ITEM PICTURE X OCCURS 15 TIMES INDEXED BY IND.
+               88  EQUALS-M   VALUE "M".
+       01  GROUP-2-TABLE.
+           05  TABLE-LEVEL-1 VALUE "abcdefghijklmno".
+               06  TABLE-ITEM PICTURE X OCCURS 15 TIMES INDEXED BY IND.
+               88  EQUALS-M   VALUE "M".
+       PROCEDURE DIVISION.
+            set IND OF GROUP-1-TABLE to 2
+            set IND OF GROUP-2-TABLE to 4
+            display "The output should be ""Db"""
+            display "The output        is " """"
+                    TABLE-ITEM of GROUP-1-TABLE(IND OF GROUP-2-TABLE)
+                    TABLE-ITEM of GROUP-2-TABLE(IND OF GROUP-1-TABLE)
+                    """"
+            goback.
+
diff --git a/gcc/testsuite/cobol.dg/group2/Multiple_INDEXED_BY_variables_with_the_same_name.out b/gcc/testsuite/cobol.dg/group2/Multiple_INDEXED_BY_variables_with_the_same_name.out
new file mode 100644 (file)
index 0000000..c4d70c9
--- /dev/null
@@ -0,0 +1,3 @@
+The output should be "Db"
+The output        is "Db"
+