https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118693
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Ah, I can reproduce the problem when the program reads from standard input and pasting the text into the terminal. I think it's a shell problem, e.g. only pasting 4kB characters. Reading directly from a file shows that the std::istream code is working fine.