commit 74f965f41b8bb3cb078a7ba0c598be7226d8baf7
parent a74baaaaaa3e05788784cd0c2952376cd6c1f3af
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Tue, 4 Apr 2023 21:30:12 -0400
halcc: fix another binop bug
uxn tests almost pass!
Diffstat:
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/comp/c/egen.fs b/fs/comp/c/egen.fs
@@ -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 >>, ;
diff --git a/fs/tests/comp/c/cc.fs b/fs/tests/comp/c/cc.fs
@@ -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
diff --git a/fs/tests/comp/c/test.c b/fs/tests/comp/c/test.c
@@ -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;