~vdupras/duskos

74f965f41b8bb3cb078a7ba0c598be7226d8baf7 — Virgil Dupras a month ago a74baaa
halcc: fix another binop bug

uxn tests almost pass!
3 files changed, 7 insertions(+), 1 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
@@ 66,7 66,7 @@ UOPSCNT wordtbl uoptbl ( res -- res )

\ ops that can't freely swap their operands
: _prep ( left right -- left halop )
  Result :?freeCurrentW Result :hal$ over Result :?>W ;
  Result :?freeCurrentW over Result :?>W Result :hal$ ;
: _/, _prep /, ; : _%, _prep %, ;
: _<<, _prep <<, ; : _>>, _prep >>, ;


M fs/tests/comp/c/cc.fs => fs/tests/comp/c/cc.fs +1 -0
@@ 104,6 104,7 @@ structop6 54 #eq
structop7 42 #eq
12 42 structop8 54 #eq
structop9 123 #eq
structop10 30 #eq
cond2 scnt not # \ don't crash or leak
opwidth1 42 #eq
opwidth2 42 #eq

M fs/tests/comp/c/test.c => fs/tests/comp/c/test.c +5 -0
@@ 435,6 435,11 @@ int structop9() {
	return s.ref->foo;
}

int structop10() {
	globdata.foo = 42;
	globdata.bar = 12;
	return globdata.foo - globdata.bar;
}
// we used to leak VM ops in condition blocks without {}
void cond1() {
    int x = 42;