Add a compile-time test for PR ld/22263
[binutils-gdb.git] / ld / ldmisc.c
index 904a23d37d0641e7a5fa8f8cf562823a783bd6c3..420ddb13c18273f786cb4c6ef3ad1d7d00061352 100644 (file)
@@ -280,8 +280,8 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
                 The arguments are a BFD, a section, and an offset.  */
              {
                static bfd *last_bfd;
-               static char *last_file = NULL;
-               static char *last_function = NULL;
+               static char *last_file;
+               static char *last_function;
                bfd *abfd;
                asection *section;
                bfd_vma offset;
@@ -331,9 +331,9 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
                           (eg emacs) to correctly locate multiple
                           errors in the same source file.  */
                        if (last_bfd == NULL
-                           || last_file == NULL
                            || last_function == NULL
                            || last_bfd != abfd
+                           || (last_file == NULL) != (filename == NULL)
                            || (filename != NULL
                                && filename_cmp (last_file, filename) != 0)
                            || strcmp (last_function, functionname) != 0)