From 573ea10ef338c245c728ed1dda75427b6390ab74 Mon Sep 17 00:00:00 2001 From: nickysn Date: Sat, 16 Mar 2013 12:42:37 +0000 Subject: [PATCH] * fixed val when the 'code' parameter is the same size as the native CPU int type, but unsigned git-svn-id: branches/i8086@23859 - --- compiler/ninl.pas | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/ninl.pas b/compiler/ninl.pas index e596ef1612..827a091385 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -1380,11 +1380,12 @@ 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(ptrsinttype).ordtype) then { because code is a var parameter, it must match types exactly } - { however, since it will return values in [0..255], both longints } - { and cardinals are fine. Since the formal code para type is } - { longint, insert a typecoversion to longint for cardinal para's } + { 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); { make it explicit, oterwise you may get a nonsense range }