From: Jakub Jelinek Date: Wed, 23 Nov 2022 13:43:48 +0000 (+0100) Subject: diagnostics: Fix selftest ICE in certain locales [PR107722] X-Git-Tag: basepoints/gcc-14~2942 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d601708870ad8dc3ef935e440bf03394891d42e2;p=thirdparty%2Fgcc.git diagnostics: Fix selftest ICE in certain locales [PR107722] As reported in the PR, since special_fname_builtin () call has been introduced, the diagnostics code compares filename against _("") rather than "", which means that if self tests are performed with the string being translated, one self-test fails. The following patch fixes that. 2022-11-23 Jakub Jelinek PR bootstrap/107722 * diagnostic.cc (test_diagnostic_get_location_text): Test special_fname_builtin () rather than "" and expect special_fname_builtin () concatenated with ":" for it. --- diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index 7c7ee6da746e..a9562a815b12 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -2593,7 +2593,10 @@ test_diagnostic_get_location_text () const char *old_progname = progname; progname = "PROGNAME"; assert_location_text ("PROGNAME:", NULL, 0, 0, true); - assert_location_text (":", "", 42, 10, true); + char *built_in_colon = concat (special_fname_builtin (), ":", (char *) 0); + assert_location_text (built_in_colon, special_fname_builtin (), + 42, 10, true); + free (built_in_colon); assert_location_text ("foo.c:42:10:", "foo.c", 42, 10, true); assert_location_text ("foo.c:42:9:", "foo.c", 42, 10, true, 0); assert_location_text ("foo.c:42:1010:", "foo.c", 42, 10, true, 1001);