Landing: 059231fb8a42
Project / Subsystem
gcc / libcpp
Date
2026-09-21
Author
Léo Hardt
Commit
059231fb8a42eaeac8880c5d207249b46757767c
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- libcpp
- patch_id
- —
- commit_hash
- 059231fb8a42eaeac8880c5d207249b46757767c
- source_type
- github
- headline
- libcpp: Fix ICE when parsing __has_include outside a directive.
- tldr
- Preprocessor correctly handles __has_include and __has_embed when not inside a directive, preventing internal compiler errors.
- author
- Léo Hardt
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • preprocessor
- • bugfix
- • compiler
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-09-21T00:00:00.000Z
This change fixes an internal compiler error (ICE) in the C preprocessor (libcpp) that occurred when __has_include or __has_embed were used outside of a preprocessor directive. Previously, the parser would incorrectly attempt to read the entire file as a header name, leading to an error and a crash when encountering the closing token. The fix adds an early exit condition in builtin_has_include_1 to prevent calling glue_header_name in invalid contexts, thus avoiding the ICE and correctly handling these builtins.