]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/m2/gm2-libs/FIO.def
PR modula2/110631 Bugfix to FIO WriteCardinal
authorGaius Mulley <gaiusmod2@gmail.com>
Sat, 22 Jul 2023 09:01:02 +0000 (10:01 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Sat, 22 Jul 2023 09:01:02 +0000 (10:01 +0100)
commit73cc6ce1294ec35e9322b1bbc91009cfc76f732b
tree0b08b9c2728a536197beb7caffb437c765dd9d13
parent16894253cd152dd8e02ba48708ec8ec0a9f99e24
PR modula2/110631 Bugfix to FIO WriteCardinal

FIO.WriteCardinal fails to write binary data.  This patch fixes two
bugs in FIO.mod and provides a testcase which writes and reads binary
cardinals.  There was an off by one error when using HIGH (a) to
determine the number of bytes and the dest/src pointers were switched
when calling memcpy.

gcc/m2/ChangeLog:

PR modula2/110631
* gm2-libs/FIO.def (ReadAny): Correct comment as
HIGH (a) + 1 is number of bytes.
(WriteAny): Correct comment as HIGH (a) + 1 is number of
bytes.
* gm2-libs/FIO.mod (ReadAny): Correct comment as
HIGH (a) + 1 is number of bytes.  Also pass HIGH (a) + 1
to BufferedRead.
(WriteAny): Correct comment as HIGH (a) + 1 is number of
bytes. Also pass HIGH (a) + 1 to BufferedWrite.
(BufferedWrite): Rename parameter a to src, rename variable
t to dest.  Correct parameter order to memcpy.

gcc/testsuite/ChangeLog:

PR modula2/110631
* gm2/pimlib/run/pass/testfiobinary.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-libs/FIO.def
gcc/m2/gm2-libs/FIO.mod
gcc/testsuite/gm2/pimlib/run/pass/testfiobinary.mod [new file with mode: 0644]