Files
gcc/libcpp
Nathaniel Shead deba30681d libcpp: Fix ICE with directives-only and cpp_maybe_module_directive [PR124153]
When doing directives-only processing (-E -fdirectives-only, or -M) we
crash if we hit an unexpected CPP_PRAGMA_EOL because we 'know' we're in
a module directive but the in_deferred_pragma flag is no longer set.

Fixed by undoing the "finished a module directive" behaviour within
cpp_maybe_module_directive if we're bailing due to an ill-formed peeked
token.

	PR c++/124153

libcpp/ChangeLog:

	* lex.cc (cpp_maybe_module_directive): Set in_deferred_pragma
	and eol when we see an unexpected CPP_PRAGMA_EOL.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/cpp-22.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
2026-02-23 02:25:10 +11:00
..
2026-01-15 10:17:43 -05:00
2026-02-20 00:16:32 +00:00
2026-01-31 00:16:35 +00:00
2026-01-15 10:17:43 -05:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-15 10:17:43 -05:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2025-10-08 18:02:39 +02:00