Hi! There are various implementations of iconv, in glibc, libiconv, ... and not all of them support all the charsets or their exact spellings. All C/C++ tests (at least from what I've grepped around) do use dg-require-iconv directive if iconv_open supports the given encoding when using -fexec-charset= and similar options. IMHO COBOL tests should do the same.
Bootstrapped/regtested on x86_64-linux and i686-linux, verified manually that the test still PASS the way they did on glibc which does support those encodings. Ok for trunk? 2026-09-22 Jakub Jelinek <[email protected]> * cobol.dg/group2/CDF_Feature_.cob: Add dg-require-iconv directive. * cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.cob: Likewise. * cobol.dg/group2/FIND-STRING__forward_.cob: Likewise. * cobol.dg/group2/FIND-STRING__reverse_.cob: Likewise. * cobol.dg/group2/RT3609_Unexpected_PROCESS.cob: Likewise. --- a/gcc/testsuite/cobol.dg/group2/CDF_Feature_.cob 2026-09-21 08:58:18.067059667 +0200 +++ b/gcc/testsuite/cobol.dg/group2/CDF_Feature_.cob 2026-09-21 20:37:45.763162451 +0200 @@ -1,6 +1,7 @@ *> Do not edit this generated file. See README.txt *> { dg-do run } *> { dg-options "-fexec-charset=ibm1140 -dialect ibm" } + *> { dg-require-iconv "ibm1140" } *> { dg-output-file "group2/CDF_Feature_.out" } id division. --- a/gcc/testsuite/cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.cob 2026-09-21 08:58:18.067059667 +0200 +++ b/gcc/testsuite/cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.cob 2026-09-21 20:37:53.176065824 +0200 @@ -1,6 +1,7 @@ *> Do not edit this generated file. See README.txt *> { dg-do run } *> { dg-options "-fexec-charset=ibm1140" } + *> { dg-require-iconv "ibm1140" } *> { dg-output-file "group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.out" } IDENTIFICATION DIVISION. PROGRAM-ID. prog. --- a/gcc/testsuite/cobol.dg/group2/FIND-STRING__forward_.cob 2026-09-21 08:58:18.067059667 +0200 +++ b/gcc/testsuite/cobol.dg/group2/FIND-STRING__forward_.cob 2026-09-21 20:37:58.875991525 +0200 @@ -1,6 +1,7 @@ *> Do not edit this generated file. See README.txt *> { dg-do run } *> { dg-options "-fexec-charset=ibm1140" } + *> { dg-require-iconv "ibm1140" } *> { dg-output-file "group2/FIND-STRING__forward_.out" } IDENTIFICATION DIVISION. PROGRAM-ID. prog. --- a/gcc/testsuite/cobol.dg/group2/FIND-STRING__reverse_.cob 2026-09-21 08:58:18.067059667 +0200 +++ b/gcc/testsuite/cobol.dg/group2/FIND-STRING__reverse_.cob 2026-09-21 20:38:04.542917656 +0200 @@ -1,6 +1,7 @@ *> Do not edit this generated file. See README.txt *> { dg-do run } *> { dg-options "-fexec-charset=ibm1140" } + *> { dg-require-iconv "ibm1140" } *> { dg-output-file "group2/FIND-STRING__reverse_.out" } IDENTIFICATION DIVISION. PROGRAM-ID. prog. --- a/gcc/testsuite/cobol.dg/group2/RT3609_Unexpected_PROCESS.cob 2026-09-03 09:43:55.779409851 +0200 +++ b/gcc/testsuite/cobol.dg/group2/RT3609_Unexpected_PROCESS.cob 2026-09-21 20:38:14.813783777 +0200 @@ -1,6 +1,7 @@ *> Do not edit this generated file. See README.txt *> { dg-do run } *> { dg-options "-O0 -Wno-ibm-cdf -I copybooks -Wno-recording-mode -ffixed-form -dialect ibm -fno-static-call -fexec-charset=CP037 -fexec-national-charset=CP037" } + *> { dg-require-iconv "CP037" } 00001 PROCESS FLAG(I,W) FDUMP 00002 IDENTIFICATION DIVISION. Jakub
