https://gcc.gnu.org/g:022d8e25e49021b378a4e6c24c2f0c380a066690

commit r16-660-g022d8e25e49021b378a4e6c24c2f0c380a066690
Author: Robert Dubner <rdub...@symas.com>
Date:   Thu May 15 12:01:12 2025 -0400

    cobol: Don't display 0xFF HIGH-VALUE characters in testcases. [PR120251]
    
    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.

Diff:
---
 gcc/testsuite/cobol.dg/group1/check_88.cob         | 12 +++++------
 ...CATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob |  3 ++-
 ...CATE_Rule_8_OPTION_INITIALIZE_with_figconst.out |  3 +--
 .../INSPECT_CONVERTING_TO_figurative_constants.cob | 12 +++++------
 .../INSPECT_CONVERTING_TO_figurative_constants.out | 10 ++++-----
 .../cobol.dg/group2/INSPECT_ISO_Example_1.cob      |  2 +-
 .../cobol.dg/group2/INSPECT_ISO_Example_2.cob      |  2 +-
 .../cobol.dg/group2/INSPECT_ISO_Example_3.cob      |  2 +-
 .../cobol.dg/group2/INSPECT_ISO_Example_4.cob      |  2 +-
 .../cobol.dg/group2/INSPECT_ISO_Example_5-f.cob    |  2 +-
 .../cobol.dg/group2/INSPECT_ISO_Example_6.cob      |  2 +-
 .../cobol.dg/group2/INSPECT_ISO_Example_7.cob      |  2 +-
 ...ple_INDEXED_BY_variables_with_the_same_name.cob | 24 ++++++++++++++++++++++
 ...ple_INDEXED_BY_variables_with_the_same_name.out |  3 +++
 14 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/gcc/testsuite/cobol.dg/group1/check_88.cob 
b/gcc/testsuite/cobol.dg/group1/check_88.cob
index 4a7723eb92a3..18a299fc282b 100644
--- a/gcc/testsuite/cobol.dg/group1/check_88.cob
+++ b/gcc/testsuite/cobol.dg/group1/check_88.cob
@@ -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)} }
diff --git 
a/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob
 
b/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob
index 6fab992b56fc..a5ef3a8e4737 100644
--- 
a/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob
+++ 
b/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob
@@ -81,12 +81,13 @@
          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.
diff --git 
a/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out
 
b/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out
index c141fdf702aa..ea05e96cfb31 100644
--- 
a/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out
+++ 
b/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out
@@ -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
 
diff --git 
a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob 
b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob
index 2983cce07bfc..91440f5e555a 100644
--- 
a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob
+++ 
b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob
@@ -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.
 
diff --git 
a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out 
b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out
index 7de6e4810209..23ce49ba5743 100644
--- 
a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out
+++ 
b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out
@@ -1,6 +1,6 @@
-low-values  ""
-spaces      "            "
-zeros       "000000000000"
-quotes      """"""""""""""
-high-values "ÿÿÿÿÿÿÿÿÿÿÿÿ"
+low-values  "0x0000000000000000"
+spaces      "0x2020202020202020"
+zeros       "0x3030303030303030"
+quotes      "0x2222222222222222"
+high-values "0xffffffffffffffff"
 
diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob 
b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob
index 1bbdea447524..2f306f1159a2 100644
--- a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob
+++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob
@@ -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'
diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob 
b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob
index a464101ae16d..0e4297dc7e1a 100644
--- a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob
+++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob
@@ -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'
diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob 
b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob
index 7111e9c10715..0b6c00cb54d6 100644
--- a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob
+++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob
@@ -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
diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob 
b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob
index 192e1a83a304..03a0b073169c 100644
--- a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob
+++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob
@@ -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'
diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob 
b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob
index 09237203c129..5ef97e1830cd 100644
--- a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob
+++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob
@@ -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'
diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob 
b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob
index 75917a2d78c4..40cecfc29ca0 100644
--- a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob
+++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob
@@ -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'
diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob 
b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob
index ca2ae71ed0bd..abf9eb95197f 100644
--- a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob
+++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob
@@ -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
index 000000000000..4bcc06c413d8
--- /dev/null
+++ 
b/gcc/testsuite/cobol.dg/group2/Multiple_INDEXED_BY_variables_with_the_same_name.cob
@@ -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
index 000000000000..c4d70c92fe2e
--- /dev/null
+++ 
b/gcc/testsuite/cobol.dg/group2/Multiple_INDEXED_BY_variables_with_the_same_name.out
@@ -0,0 +1,3 @@
+The output should be "Db"
+The output        is "Db"
+

Reply via email to