summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2006-02-21 10:00:20 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2006-02-21 10:00:20 +0000
commitf5cd9b1fc17ef82bf539563d4538fcb8494fd420 (patch)
treed097fdcc85bcd712a29d11b897c1efe84f3b4940
parent07efcd5eba36124fca8c775183dc1080089b3803 (diff)
downloadfpc-linker@2665.tar.gz
* hopefully final range check fixlinker@2665
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk/compiler@2659 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--cgobj.pas7
1 files changed, 4 insertions, 3 deletions
diff --git a/cgobj.pas b/cgobj.pas
index 4367dbf589..d4f45d4c80 100644
--- a/cgobj.pas
+++ b/cgobj.pas
@@ -1654,9 +1654,6 @@ implementation
if not(cs_check_range in aktlocalswitches) or
not(fromdef.deftype in [orddef,enumdef]) then
exit;
- { check the rangetype of the array, not the array itself }
- if (todef.deftype = arraydef) then
- todef := tarraydef(todef).rangetype.def;
{$ifndef cpu64bit}
{ handle 64bit rangechecks separate for 32bit processors }
if is_64bit(fromdef) or is_64bit(todef) then
@@ -1671,6 +1668,10 @@ implementation
getrange(todef,lto,hto);
from_signed := is_signed(fromdef);
to_signed := is_signed(todef);
+ { check the rangetype of the array, not the array itself }
+ { (only change now, since getrange needs the arraydef) }
+ if (todef.deftype = arraydef) then
+ todef := tarraydef(todef).rangetype.def;
{ no range check if from and to are equal and are both longint/dword }
{ (if we have a 32bit processor) or int64/qword, since such }
{ operations can at most cause overflows (JM) }