Landing: e1c8dac7ca8d

Project / Subsystem

gcc / libcpp

Date

2026-08-26

Author

Alexey Klimkin

Commit

e1c8dac7ca8dde4d99776685dee43e05cd3ea6d2

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
libcpp
patch_id
—
commit_hash
e1c8dac7ca8dde4d99776685dee43e05cd3ea6d2
source_type
github
headline
Fix header-unit file descriptor handling to prevent reading stdin
tldr
libcpp now correctly uses -1 as a sentinel for closed file descriptors related to header units, preventing accidental reads from stdin.
author
Alexey Klimkin
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • libcpp
  • • preprocessor
  • • C++20
  • • modules
discussion_id_link
—
bugzilla_pr
—
date
2026-08-26T00:00:00.000Z

A bug in libcpp’s header unit handling caused a closed file descriptor to be recorded as zero instead of the intended -1 sentinel. This led to incorrect behavior where subsequent textual includes could mistakenly reopen and read from stdin. This fix ensures that valid descriptors are closed and the sentinel is correctly set to -1, resolving the issue and preventing incorrect file reading.