https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69650
--- Comment #53 from Bernd Schmidt <bernds at gcc dot gnu.org> --- Hmm. Something got reallocated perhaps? It's not entirely obvious to me where that would happen. Does the following help at all? Index: directives.c =================================================================== --- directives.c (revision 234831) +++ directives.c (working copy) @@ -977,6 +977,8 @@ do_linemarker (cpp_reader *pfile) { struct line_maps *line_table = pfile->line_table; const line_map_ordinary *map = LINEMAPS_LAST_ORDINARY_MAP (line_table); + bool main_file_p = MAIN_FILE_P (map); + const line_map_ordinary *from = INCLUDED_FROM (pfile->line_table, map); const cpp_token *token; const char *new_file = ORDINARY_MAP_FILE_NAME (map); linenum_type new_lineno; @@ -1048,10 +1050,9 @@ do_linemarker (cpp_reader *pfile) if (reason == LC_LEAVE) { - const line_map_ordinary *from; - if (MAIN_FILE_P (map) + if (main_file_p || (new_file - && (from = INCLUDED_FROM (pfile->line_table, map)) != NULL + && from != NULL && filename_cmp (ORDINARY_MAP_FILE_NAME (from), new_file) != 0)) { cpp_warning (pfile, CPP_W_NONE,