~vdupras/duskos

d814a6cf4a3b2380f64e6e6d8cd5c8c102e37e6a — Virgil Dupras a month ago 18b601d
halcc: stupid little binop bug

uxn and uxntal compile
3 files changed, 6 insertions(+), 1 deletions(-)

M fs/comp/c/expr.fs
M fs/tests/comp/c/cc.fs
M fs/tests/comp/c/test.c
M fs/comp/c/expr.fs => fs/comp/c/expr.fs +1 -1
@@ 119,7 119,7 @@ struct[ Result
]struct

BOPSCNT wordtbl _tbl ( a b -- n )
'w +     'w -      'w *      'w /      'w mod    'w <<     'w >>     'w <
'w +     'w -      'w *      'w /      'w mod    'w lshift 'w rshift 'w <
'w >     'w <=     'w >=     'w =      'w <>     'w and    'w xor    'w or
'w and?  'w or?    'w _err   'w _err   'w _err   'w _err   'w _err   'w _err
'w _err  'w _err   'w _err   'w _err   'w _err   'w _err

M fs/tests/comp/c/cc.fs => fs/tests/comp/c/cc.fs +1 -0
@@ 91,6 91,7 @@ $72 2 binop11 $1c #eq
54 5 binop12 -1 #eq scnt not #
1 42 binop13 1 #eq
-1 42 binop13 0 #eq
binop14 $100 #eq
structop1 44 #eq
structop2 44 #eq
structop2 45 #eq

M fs/tests/comp/c/test.c => fs/tests/comp/c/test.c +4 -0
@@ 366,6 366,10 @@ int binop12(int a, int b) {
int binop13(ushort a, ushort b) {
	return a < b;
}
// Believe it or not, this made CC crash.
int binop14() {
	return 1 << 8;
}
short structop1() {
    globdata.bar += 2;
    return globdata.bar;