From c48811add681f1d910aed569b5e3649920701848 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 13 Feb 2021 18:46:00 -0600 Subject: [PATCH] Report errors in a few cases where the codegen finds unexpected types. This makes it more likely that unsupported ops on long long or any other types added in the future will give an error rather than silently generating bad code. Also, update a comment. --- CGI.Comments | 3 ++- Gen.pas | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CGI.Comments b/CGI.Comments index b5e0ab6..7142d91 100644 --- a/CGI.Comments +++ b/CGI.Comments @@ -421,9 +421,10 @@ { } { Gen1t(pc_ldc, val, type) } { GenLdcLong(val) } +{ GenLdcQuad(val) } { GenLdcReal(val) } { } -{ Loads a constant value. Special calls for long and real } +{ Loads a constant value. Special calls for long, quad & real } { values are provided due to the unique parameter requirements.} { } { } diff --git a/Gen.pas b/Gen.pas index d43d03a..f4136c2 100644 --- a/Gen.pas +++ b/Gen.pas @@ -2461,7 +2461,9 @@ else if op^.optype in [cgLong,cgULong] then begin end; {else} end; {else} end; {else} - end; {else if} + end {else if} +else + Error(cge1); end; {GenIncDec} @@ -2682,7 +2684,7 @@ case optype of end; {if} end; {case cgByte,cgUByte,cgWord,cgUWord} - otherwise: ; + otherwise: Error(cge1); end; {case} end; {GenInd} @@ -4252,7 +4254,7 @@ case optype of end; {else} end; - otherwise: ; + otherwise: Error(cge1); end; {case} end; {GenStrCop} @@ -5691,7 +5693,9 @@ procedure GenTree {op: icptr}; if isIncLoad then skipLoad := false; case op^.optype of {do the pop} - otherwise: ; + otherwise: Error(cge1); + + cgByte, cgUByte, cgWord, cgUWord, cgVoid: ; cgLong, cgULong: if not isIncLoad then