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)
*> { 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)} }
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.
" " " " 0x2020202020202020
initialize high-value
allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)
- (1) as allocated
- "ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ" "¿¿¿" 0xffffffffffffffff
+0xffffffffffffffff
*> { 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.
-low-values ""
-spaces " "
-zeros "000000000000"
-quotes """"""""""""""
-high-values "ÿÿÿÿÿÿÿÿÿÿÿÿ"
+low-values "0x0000000000000000"
+spaces "0x2020202020202020"
+zeros "0x3030303030303030"
+quotes "0x2222222222222222"
+high-values "0xffffffffffffffff"
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'
*> 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'
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
*> 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'
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'
*> 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'
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'
--- /dev/null
+ *> { 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.
+
--- /dev/null
+The output should be "Db"
+The output is "Db"
+