https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118168
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andi Kleen <a...@gcc.gnu.org>: https://gcc.gnu.org/g:e2f024f586e99fb63dd49e0603f52d1cb765a77e commit r15-7211-ge2f024f586e99fb63dd49e0603f52d1cb765a77e Author: Andi Kleen <a...@gcc.gnu.org> Date: Wed Dec 25 20:21:58 2024 -0800 Move ferror out of hot loop of file cache glibc ferror is surprisingly expensive. Move it out of the hot loop of finding lines by setting a flag after the actual IO operations. gcc/ChangeLog: PR preprocessor/118168 * input.cc (file_cache_slot::m_error): New field. (file_cache_slot::create): Clear m_error. (file_cache_slot::file_cache_slot): Clear m_error. (file_cache_slot::read_data): Set m_error on error. (file_cache_slot::get_next_line): Use m_error instead of ferror.