https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107722
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2022-11-16 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- static void test_diagnostic_get_location_text () { const char *old_progname = progname; progname = "PROGNAME"; assert_location_text ("PROGNAME:", NULL, 0, 0, true); assert_location_text ("<built-in>:", "<built-in>", 42, 10, true); Hmmm. This is where 42 and 10 are coming from. Oh the problem is the use directly "<built-in>" here rather than special_fname_builtin . This might fix/improve that: diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index 22f7b0b6d6e..5764ce672ec 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -470,7 +470,7 @@ diagnostic_get_location_text (diagnostic_context *context, const char *file = s.file ? s.file : progname; int line = 0; int col = -1; - if (strcmp (file, N_("<built-in>"))) + if (strcmp (file, special_fname_builtin ())) { line = s.line; if (context->show_column) @@ -2593,7 +2593,7 @@ test_diagnostic_get_location_text () const char *old_progname = progname; progname = "PROGNAME"; assert_location_text ("PROGNAME:", NULL, 0, 0, true); - assert_location_text ("<built-in>:", "<built-in>", 42, 10, true); + assert_location_text ("<built-in>:", special_fname_builtin(), 42, 10, true); 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); But I am not 100% sure it is correct ....