https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116073
--- Comment #3 from Gaius Mulley <gaius at gcc dot gnu.org> --- Created attachment 60272 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60272&action=edit Proposed patch to correct offset and return type to/from lseek FWIIW I wonder if the bug might be related to the correction in libc.def for lseek to use SYSTEM.COFF_T (rather than SYSTEM.CSSIZE_T)? These changes commenced when fixing -Wodr violations PR 118010 and PR 118183. It appears doModeChange is missing the change to COFF_T; patch proposed: Proposed ChangeLog entry: PR modula2/116073 invalid rtl sharing compiling FileSystem.mod This patch corrects the return result and second parameter conversion when calling lseek. Prior to this patch both were using LONGINT (now changed to SYSTEM.COFF_T). gcc/m2/ChangeLog: * gm2-libs-log/FileSystem.mod (doModeChange): Change declaration r to use COFF_T. Change conversion of the offset from LONGINT to COFF_T.