Skip to content

Commit 85d8362

Browse files
committed
parser: Fix compiler crash during error recovery for bad type() expressions
(02c411c regression)
1 parent 3764b62 commit 85d8362

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Version 1.01.0
5757
- BLOAD now gives an error if it encounters a BMP file with an unknown header size
5858
- BLOAD was misreading bitfields in BMP files with undocumented BITMAPV3HEADER format (56-byte headers)
5959
- PRINT now disallows commas/newlines after SPC/TAB, instead of silently ignoring them
60+
- 0.90.0 regression: Compiler crash during error recovery for expressions like 'type<UDT>().field' where initializer values are missing
6061

6162

6263
Version 1.00.0 (former 0.91.0):

src/compiler/parser-expr-unary.bas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ function cStrIdxOrMemberDeref _
132132
dim as FBSYMBOL ptr subtype = any
133133
dim as integer dtype = any
134134

135+
if( expr = NULL ) then exit function
136+
135137
dtype = astGetFullType( expr )
136138
subtype = astGetSubType( expr )
137139

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
' TEST_MODE : COMPILE_ONLY_FAIL
2+
3+
type UDT
4+
i as integer
5+
j as integer
6+
end type
7+
8+
'' Regression test: The missing initializer values shouldn't cause a compiler crash
9+
print type<UDT>().i, type<UDT>().j

0 commit comments

Comments
 (0)