From 1a2e4772cd8693d82225c15efbfcd9050011eb0c Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sun, 27 Jan 2019 11:53:09 -0600 Subject: [PATCH] Don't generate scalar load operations with bogus types. This could occur with some operations on function parameters declared with array types, in some cases leading to compiler errors. Fixes #61. --- Expression.pas | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Expression.pas b/Expression.pas index 27b851f..640ae78 100644 --- a/Expression.pas +++ b/Expression.pas @@ -1963,10 +1963,10 @@ var tp: baseTypeEnum; {base type} begin {LoadScalar} -if id^.itype^.kind = pointerType then - tp := cgULong -else - tp := id^.itype^.baseType; +if id^.itype^.kind = scalarType then + tp := id^.itype^.baseType +else {if id^.itype^.kind in [pointerType,arrayType] then} + tp := cgULong; case id^.storage of stackFrame, parameter: Gen2t(pc_lod, id^.lln, 0, tp); @@ -2521,7 +2521,7 @@ var goto 1; end; {if} end {if} - else {if iType^.kind = pointerType then} begin + else {if iType^.kind in [pointerType,arrayType] then} begin lSize := iType^.pType^.size; if lSize = 0 then Error(122);