https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115057
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Gaius Mulley <ga...@gcc.gnu.org>: https://gcc.gnu.org/g:399065ea44219d08ca28238cba0fc1fef422628b commit r14-10943-g399065ea44219d08ca28238cba0fc1fef422628b Author: Gaius Mulley <gaiusm...@gmail.com> Date: Tue Nov 19 18:30:10 2024 +0000 [PATCH] PR modula2/115057 TextIO.ReadRestLine raises an exception when buffer is exceeded TextIO.ReadRestLine will raise an "attempting to read beyond end of file" exception if the buffer is exceeded. This bug is caused by the TextIO.ReadRestLine calling IOChan.Skip without a preceeding IOChan.Look. The Look procedure will update the status result whereas Skip always sets read result to allRight. gcc/m2/ChangeLog: PR modula2/115057 * gm2-libs-iso/TextIO.mod (ReadRestLine): Use ReadChar to skip unwanted characters as this calls IOChan.Look and updates the cid result status. A Skip without a Look does not update the status. Skip always sets read result to allRight. * gm2-libs-iso/TextUtil.def (SkipSpaces): Improve comments. (CharAvailable): Improve comments. * gm2-libs-iso/TextUtil.mod (SkipSpaces): Improve comments. (CharAvailable): Improve comments. gcc/testsuite/ChangeLog: PR modula2/115057 * gm2/isolib/run/pass/testrestline.mod: New test. * gm2/isolib/run/pass/testrestline2.mod: New test. * gm2/isolib/run/pass/testrestline3.mod: New test. (cherry picked from commit 680af0e1e90d4b80260d173636dfe15654fd470d) Signed-off-by: Gaius Mulley <gaiusm...@gmail.com>