Skip to content

Commit 4f389e9

Browse files
authored
Merge pull request #925 from boriel-basic/fix/crash_on_uminus_bool
fix: crash when using -(bool expression)
2 parents 8d3c992 + bd8d57b commit 4f389e9

8 files changed

Lines changed: 67 additions & 1 deletion

File tree

src/api/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def to_signed(cls, type_: "TYPE") -> "TYPE":
148148
"""Return signed type or equivalent"""
149149
if type_ in cls.unsigned:
150150
return {
151-
TYPE.boolean: TYPE.boolean,
151+
TYPE.boolean: TYPE.byte,
152152
TYPE.ubyte: TYPE.byte,
153153
TYPE.uinteger: TYPE.integer,
154154
TYPE.ulong: TYPE.long,
File renamed without changes.
File renamed without changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
;; Replaces sequence:
2+
;; neg
3+
;; neg
4+
;; with
5+
;; ; nop ;; double neg can be removed
6+
7+
OLEVEL: 1
8+
OFLAG: 13
9+
10+
REPLACE {{
11+
neg
12+
neg
13+
}}
14+
15+
WITH {{
16+
}}
File renamed without changes.
File renamed without changes.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
org 32768
2+
.core.__START_PROGRAM:
3+
di
4+
push ix
5+
push iy
6+
exx
7+
push hl
8+
exx
9+
ld hl, 0
10+
add hl, sp
11+
ld (.core.__CALL_BACK__), hl
12+
ei
13+
jp .core.__MAIN_PROGRAM__
14+
.core.__CALL_BACK__:
15+
DEFW 0
16+
.core.ZXBASIC_USER_DATA:
17+
; Defines USER DATA Length in bytes
18+
.core.ZXBASIC_USER_DATA_LEN EQU .core.ZXBASIC_USER_DATA_END - .core.ZXBASIC_USER_DATA
19+
.core.__LABEL__.ZXBASIC_USER_DATA_LEN EQU .core.ZXBASIC_USER_DATA_LEN
20+
.core.__LABEL__.ZXBASIC_USER_DATA EQU .core.ZXBASIC_USER_DATA
21+
_a:
22+
DEFB 00
23+
.core.ZXBASIC_USER_DATA_END:
24+
.core.__MAIN_PROGRAM__:
25+
ld hl, (_a - 1)
26+
ld a, (_a)
27+
sub h
28+
sub 1
29+
sbc a, a
30+
ld (_a), a
31+
ld hl, 0
32+
ld b, h
33+
ld c, l
34+
.core.__END_PROGRAM:
35+
di
36+
ld hl, (.core.__CALL_BACK__)
37+
ld sp, hl
38+
exx
39+
pop hl
40+
exx
41+
pop iy
42+
pop ix
43+
ei
44+
ret
45+
;; --- end of user code ---
46+
END
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
DIM a As Ubyte
2+
3+
LET a = -(a = a)
4+

0 commit comments

Comments
 (0)