From: Iain Sandoe Date: Sun, 6 Apr 2025 13:56:20 +0000 (+0100) Subject: cobol: Address some iconv issues. X-Git-Tag: basepoints/gcc-16~296 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f6c2694dc7c07bca5086c77ef29f3793e0c61c2;p=thirdparty%2Fgcc.git cobol: Address some iconv issues. Darwin/macOS installed libiconv does not accept // trailers on conversion codes; this causes the init_iconv to fail - and then that SEGVs later. Remove the trailing // as it is not needed elsewhere. Also print a warning if we fail to init the conversion. gcc/cobol/ChangeLog: * symbols.cc : Remove trailing // on standard_internal. (cbl_field_t::internalize): Print a warning if we fail to initialise iconv. Signed-off-by: Iain Sandoe --- diff --git a/gcc/cobol/symbols.cc b/gcc/cobol/symbols.cc index 50431251a0f..4067459858c 100644 --- a/gcc/cobol/symbols.cc +++ b/gcc/cobol/symbols.cc @@ -3567,7 +3567,7 @@ cbl_field_t::is_ascii() const { * compilation, if it moves off the default, it adjusts only once, and * never reverts. */ -static const char standard_internal[] = "CP1252//"; +static const char standard_internal[] = "CP1252"; extern os_locale_t os_locale; static const char * @@ -3595,6 +3595,10 @@ cbl_field_t::internalize() { static iconv_t cd = iconv_open(tocode, fromcode); static const size_t noconv = size_t(-1); + if (cd == (iconv_t)-1) { + yywarn("failed iconv_open tocode = '%s' fromcode = %s", tocode, fromcode); + } + // Sat Mar 16 11:45:08 2024: require temporary environment for testing if( getenv( "INTERNALIZE_NO") ) return data.initial;