public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8389] PR modula2/113559 FIO.mod lseek requires cssize_t rather than longint
@ 2024-01-24 13:12 Gaius Mulley
  0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2024-01-24 13:12 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3de031c96f28f19a68ea2080260d8fd2c78828ee

commit r14-8389-g3de031c96f28f19a68ea2080260d8fd2c78828ee
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Wed Jan 24 13:11:46 2024 +0000

    PR modula2/113559 FIO.mod lseek requires cssize_t rather than longint
    
    This patch fixes a bug in gcc/m2/gm2-libs/FIO.mod which failed to cast the
    whence parameter into the correct type.  The patch casts the whence
    parameter for lseek to SYSTEM.CSSIZE_T.
    
    gcc/m2/ChangeLog:
    
            PR modula2/113559
            * gm2-libs/FIO.mod (SetPositionFromBeginning): Convert pos into
            CSSIZE_T during call to lseek.
            (SetPositionFromEnd): Convert pos into CSSIZE_T during call to
            lseek.
    
    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

Diff:
---
 gcc/m2/gm2-libs/FIO.mod | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/m2/gm2-libs/FIO.mod b/gcc/m2/gm2-libs/FIO.mod
index 7e0aebe8886..6755d3d649d 100644
--- a/gcc/m2/gm2-libs/FIO.mod
+++ b/gcc/m2/gm2-libs/FIO.mod
@@ -36,7 +36,7 @@ IMPLEMENTATION MODULE FIO ;
                  provides a simple buffered file input/output library.
 *)
 
-FROM SYSTEM IMPORT ADR, TSIZE, WORD ;
+FROM SYSTEM IMPORT ADR, TSIZE, WORD, CSSIZE_T ;
 FROM ASCII IMPORT nl, nul, tab ;
 FROM StrLib IMPORT StrLen, StrConCat, StrCopy ;
 FROM Storage IMPORT ALLOCATE, DEALLOCATE ;
@@ -1448,7 +1448,7 @@ BEGIN
                      filled   := 0
                   END
                END ;
-               offset := lseek(unixfd, pos, SEEK_SET) ;
+               offset := lseek (unixfd, VAL (CSSIZE_T, pos), SEEK_SET) ;
                IF (offset>=0) AND (pos=offset)
                THEN
                   abspos := pos
@@ -1497,7 +1497,7 @@ BEGIN
                   filled   := 0
                END
             END ;
-            offset := lseek(unixfd, pos, SEEK_END) ;
+            offset := lseek (unixfd, VAL (CSSIZE_T, pos), SEEK_END) ;
             IF offset>=0
             THEN
                abspos := offset ;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-24 13:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-24 13:12 [gcc r14-8389] PR modula2/113559 FIO.mod lseek requires cssize_t rather than longint Gaius Mulley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).