~vdupras/duskos

5693daf9274857233e9dae883e3e0214a0cc090f — Virgil Dupras a month ago 5027767
halcc: fix postincdec op + struct

The result of the operation wasn't the good one.
3 files changed, 3 insertions(+), 3 deletions(-)

M fs/comp/c/egen.fs
M fs/tests/comp/c/cc.fs
M fs/tests/comp/c/test.c
M fs/comp/c/egen.fs => fs/comp/c/egen.fs +1 -1
@@ 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 )

M fs/tests/comp/c/cc.fs => fs/tests/comp/c/cc.fs +1 -0
@@ 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

M fs/tests/comp/c/test.c => fs/tests/comp/c/test.c +1 -2
@@ 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.