diff --git a/compiler/ninl.pas b/compiler/ninl.pas index b29b3961fe..43a53d44ef 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -1450,6 +1450,7 @@ implementation newstatement : tstatementnode; newblock : tblocknode; tempcode : ttempcreatenode; + valsinttype : tdef; begin { for easy exiting if something goes wrong } result := cerrornode.create; @@ -1474,6 +1475,9 @@ implementation exit; end; + { retrieve the ValSInt type } + valsinttype:=search_system_type('VALSINT').typedef; + { reverse parameters for easier processing } left := reverseparameters(tcallparanode(left)); @@ -1517,12 +1521,12 @@ implementation newblock:=internalstatements(newstatement); { do we need a temp for code? Yes, if no code specified, or if } - { code is not a 32bit parameter (we already checked whether the } - { the code para, if specified, was an orddef) } + { code is not a valsinttype sized parameter (we already checked } + { whether the code para, if specified, was an orddef) } if not assigned(codepara) or - (codepara.resultdef.size<>ptrsinttype.size) then + (codepara.resultdef.size<>valsinttype.size) then begin - tempcode := ctempcreatenode.create(ptrsinttype,ptrsinttype.size,tt_persistent,false); + tempcode := ctempcreatenode.create(valsinttype,valsinttype.size,tt_persistent,false); addstatement(newstatement,tempcode); { set the resultdef of the temp (needed to be able to get } { the resultdef of the tempref used in the new code para) } @@ -1539,14 +1543,14 @@ implementation { we need its resultdef later on } codepara.get_paratype; end - else if (torddef(codepara.resultdef).ordtype <> torddef(ptrsinttype).ordtype) then + else if (torddef(codepara.resultdef).ordtype <> torddef(valsinttype).ordtype) then { because code is a var parameter, it must match types exactly } { however, since it will return values >= 0, both signed and } { and unsigned ints of the same size are fine. Since the formal } { code para type is sinttype, insert a typecoversion to sint for } { unsigned para's } begin - codepara.left := ctypeconvnode.create_internal(codepara.left,ptrsinttype); + codepara.left := ctypeconvnode.create_internal(codepara.left,valsinttype); { make it explicit, oterwise you may get a nonsense range } { check error if the cardinal already contained a value } { > $7fffffff }