This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix -fself-test ICE in non-english locale (PR bootstrap/77569)
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 03 Jan 2017 20:09:03 -0500
- Subject: Re: [PATCH] Fix -fself-test ICE in non-english locale (PR bootstrap/77569)
- Authentication-results: sourceware.org; auth=none
- References: <20170103230136.GC21933@tucnak>
On Wed, 2017-01-04 at 00:01 +0100, Jakub Jelinek wrote:
> Hi!
>
> The cb.error hook is called in the case we are looking for with
> _("conversion from %s to %s not supported by iconv")
> where _(msgid) is dgettext ("cpplib", msgid), so if performing -fself
> -test
> on iconv that doesn't support ebcdic in a locale that has
> translations
> for this string, gcc ICEs.
>
> The following patch uses the same translation as libcpp to avoid
> that.
>
> I've bootstrapped/regtested this on x86_64-linux and i686-linux, but
> there
> iconv doesn't fail, plus simulated in the debugger iconv error (both
> in
> LC_ALL=en_US.UTF-8 and LC_ALL=de_DE.UTF-8). Ok for trunk?
Thanks for looking at this; OK for trunk.
I wonder if it makes sense to add a target to gcc/Makefile.in to run
the selftests in a non-English locale, to catch these things earlier?
Or to hardcode it to run in the C locale?
> 2017-01-03 Jakub Jelinek <jakub@redhat.com>
>
> PR bootstrap/77569
> * input.c (ebcdic_execution_charset::on_error): Don't use
> strstr for
> a substring of the message, but strcmp with the whole message.
> Ifdef
> ENABLE_NLS, translate the message first using dgettext.
>
> --- gcc/input.c.jj 2017-01-01 12:45:37.000000000 +0100
> +++ gcc/input.c 2017-01-03 13:40:46.827595040 +0100
> @@ -2026,9 +2026,14 @@ class ebcdic_execution_charset : public
> ATTRIBUTE_FPTR_PRINTF(5,0)
> {
> gcc_assert (s_singleton);
> + /* Avoid exgettext from picking this up, it is translated in
> libcpp. */
> + const char *msg = "conversion from %s to %s not supported by
> iconv";
> +#ifdef ENABLE_NLS
> + msg = dgettext ("cpplib", msg);
> +#endif
> /* Detect and record errors emitted by
> libcpp/charset.c:init_iconv_desc
> when the local iconv build doesn't support the conversion.
> */
> - if (strstr (msgid, "not supported by iconv"))
> + if (strcmp (msgid, msg) == 0)
> {
> s_singleton->m_num_iconv_errors++;
> return true;
>
> Jakub