https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96935
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:d01c3def63caf59d1d156aec8d52a1540e5ffe27 commit r10-8772-gd01c3def63caf59d1d156aec8d52a1540e5ffe27 Author: Marek Polacek <pola...@redhat.com> Date: Wed Sep 16 09:27:29 2020 -0400 preprocessor: Fix ICE with too long line in fmtwarn [PR96935] Here we ICE in char_span::subspan because the offset it gets is -1. It's -1 because get_substring_ranges_for_loc gets a location whose column was 0. That only happens in testcases like the attached where we're dealing with extremely long lines (at least 4065 chars it seems). This does happen in practice, though, so it's not just a theoretical problem (e.g. when building the SU2 suite). Fixed by checking that the column get_substring_ranges_for_loc gets is sane, akin to other checks in that function. gcc/ChangeLog: PR preprocessor/96935 * input.c (get_substring_ranges_for_loc): Return if start.column is less than 1. gcc/testsuite/ChangeLog: PR preprocessor/96935 * gcc.dg/format/pr96935.c: New test. (cherry picked from commit 31dd5cd6344bfbbe122fb512993b128e11236d35)