From e0c21b6f8b141c40f917a9a7a7aa89a5d08dff79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1roly=20Balogh?= Date: Wed, 16 Mar 2016 10:08:44 +0000 Subject: [PATCH] ARM: avoid some range check errors, while running a compiler compiled with -CR git-svn-id: trunk@33257 - --- compiler/arm/aasmcpu.pas | 12 ++++++------ compiler/nutils.pas | 2 +- compiler/ogelf.pas | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/arm/aasmcpu.pas b/compiler/arm/aasmcpu.pas index 5652ce2ead..2c90d9a183 100644 --- a/compiler/arm/aasmcpu.pas +++ b/compiler/arm/aasmcpu.pas @@ -2779,15 +2779,15 @@ implementation function MakeRegList(reglist: tcpuregisterset): word; var - i, w: word; + i, w: integer; begin result:=0; - w:=1; + w:=0; for i:=RS_R0 to RS_R15 do begin if i in reglist then - result:=result or w; - w:=w shl 1 + result:=result or (1 shl w); + inc(w); end; end; @@ -2980,9 +2980,9 @@ implementation bytes:=bytes or (((oper[0]^.ref^.offset-8) shr 2) and $ffffff); if (opcode<>A_BL) or (condition<>C_None) then - objdata.writereloc(bytes,4,currsym,RELOC_RELATIVE_24) + objdata.writereloc(aint(bytes),4,currsym,RELOC_RELATIVE_24) else - objdata.writereloc(bytes,4,currsym,RELOC_RELATIVE_CALL); + objdata.writereloc(aint(bytes),4,currsym,RELOC_RELATIVE_CALL); exit; end; diff --git a/compiler/nutils.pas b/compiler/nutils.pas index 11f430671f..66df7a833c 100644 --- a/compiler/nutils.pas +++ b/compiler/nutils.pas @@ -814,7 +814,7 @@ implementation ordconstn: begin {$ifdef ARM} - if not(is_shifter_const(tordconstnode(p).value.svalue,dummy)) then + if not(is_shifter_const(aint(tordconstnode(p).value.svalue),dummy)) then result:=2; {$endif ARM} exit; diff --git a/compiler/ogelf.pas b/compiler/ogelf.pas index b14aa17f80..8e3e7e4939 100644 --- a/compiler/ogelf.pas +++ b/compiler/ogelf.pas @@ -864,7 +864,7 @@ implementation if (reltype in [RELOC_RELATIVE_24,RELOC_RELATIVE_CALL]) and (p.objsection=CurrObjSec) then begin - data:=(data and $ff000000) or (((((data and $ffffff) shl 2)+(symaddr-CurrObjSec.Size)) shr 2) and $FFFFFF); // TODO: Check overflow + data:=aint((data and $ff000000) or (((((data and $ffffff) shl 2)+(symaddr-CurrObjSec.Size)) shr 2) and $FFFFFF)); // TODO: Check overflow end else {$endif ARM}