commit 13e3306d211b6346576a36bf72d93e37acea46ba
parent dbf1f13b3a6e9ee0c3c2ee77238b0d7783601479
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Mon, 28 Nov 2022 19:11:36 -0500
comp/c/vm/i386: fix || op
it was simply broken.
Diffstat:
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/comp/c/vm/i386.fs b/fs/comp/c/vm/i386.fs
@@ -263,7 +263,8 @@ UNOPMUTCNT wordtbl _tbl
\ const. If we do proper constant propagation at the AST level, this should
\ never happen and :>reg becomes spurious.
vmop^ :>reg vmop^ :compiletest vmop^ :init forward! _z>vmop ;
-: _|| vmop :>reg vmop :compile vmop^ :compile or, vmop^ :init neg, _z>vmop ;
+: _|| vmop :>reg vmop :compile vmop^ :compile or, vmop^ :init
+ vmop :compile neg, _z>vmop ;
LOGOPCNT wordtbl _tblsigned
:w _ setl, ; :w _ setg, ; :w _ setle, ; :w _ setge, ;
diff --git a/fs/tests/comp/c/cc.fs b/fs/tests/comp/c/cc.fs
@@ -73,6 +73,7 @@ binop6 $1fe #eq
binop7 0 #eq
binop8 $ffffffab #eq
binop9 $1234 #eq
+123 12 binop10 1 #eq
structop1 44 #eq
structop2 45 #eq
structop3 42 #eq
diff --git a/fs/tests/comp/c/test.c b/fs/tests/comp/c/test.c
@@ -304,7 +304,10 @@ int binop9() {
char array[2] = {$12, $34};
return array[0]<<8|array[1];
}
-
+// i386 VM used to crash on this
+int binop10(int a, int b) {
+ return a == 42 || b == 12;
+}
short structop1() {
globdata.bar += 2;
return globdata.bar;