duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 5693daf9274857233e9dae883e3e0214a0cc090f
parent 502776783e8ef7de7f7c233d9b5a653433641f17
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sun,  2 Apr 2023 13:19:57 -0400

halcc: fix postincdec op + struct

The result of the operation wasn't the good one.

Diffstat:
Mfs/comp/c/egen.fs | 2+-
Mfs/tests/comp/c/cc.fs | 1+
Mfs/tests/comp/c/test.c | 3+--
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/comp/c/egen.fs b/fs/comp/c/egen.fs @@ -135,7 +135,7 @@ code _callA branchA, : _incdec, ( res incsz -- res ) Result :?freeCurrentW over Result :*arisz * - swap Result :hal$ A>) lea, A) @, A) [+n], Result :W ; + swap Result :hal$ dup @, [+n], Result :W ; : _arrow ( res -- res ) dup Result cdecl nextt ( res cdecl name ) diff --git a/fs/tests/comp/c/cc.fs b/fs/tests/comp/c/cc.fs @@ -92,6 +92,7 @@ $72 2 binop11 $1c #eq 1 42 binop13 1 #eq -1 42 binop13 0 #eq structop1 44 #eq +structop2 44 #eq structop2 45 #eq structop3 42 #eq structop4 globdata 12 + #eq diff --git a/fs/tests/comp/c/test.c b/fs/tests/comp/c/test.c @@ -372,8 +372,7 @@ short structop1() { } // postop on a struct field failed under the Forth VM int structop2() { - globdata.bar++; - return globdata.bar; + return globdata.bar++; } // In the Forth VM, indexing a struct array with a struct field resulted in TOS // mixup.