https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112956
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- libcpp/lex.cc.jj 2023-12-11 12:39:23.353442196 +0100
+++ libcpp/lex.cc 2023-12-12 13:15:07.154019695 +0100
@@ -3809,7 +3809,7 @@ _cpp_get_fresh_line (cpp_reader *pfile)
cpp_token *
_cpp_lex_direct (cpp_reader *pfile)
{
- cppchar_t c;
+ cppchar_t c = 0;
cpp_buffer *buffer;
const unsigned char *comment_start;
bool fallthrough_comment = false;
@@ -3833,6 +3833,7 @@ _cpp_lex_direct (cpp_reader *pfile)
pfile->state.in_deferred_pragma = false;
if (!pfile->state.pragma_allow_expansion)
pfile->state.prevent_expansion--;
+ result->src_loc = pfile->line_table->highest_line;
return result;
}
if (!_cpp_get_fresh_line (pfile))
@@ -3849,6 +3850,8 @@ _cpp_lex_direct (cpp_reader *pfile)
/* Now pop the buffer that _cpp_get_fresh_line did not. */
_cpp_pop_buffer (pfile);
}
+ else if (c == 0)
+ result->src_loc = pfile->line_table->highest_line;
return result;
}
if (buffer != pfile->buffer)
seems to work though (at least in quick cpp.exp testing).