summaryrefslogtreecommitdiff
path: root/compiler/ncgset.pas
diff options
context:
space:
mode:
authorpeter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2>2007-09-20 20:23:26 +0000
committerpeter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2>2007-09-20 20:23:26 +0000
commit7ce8f154e64266d3ed2a73a145e968230e6db3da (patch)
tree1415208d7da6802b4216664a9b9bd739c3fe242e /compiler/ncgset.pas
parent154ab67a36ca217fb892a7e53437d1dceb99eb94 (diff)
downloadfpc-7ce8f154e64266d3ed2a73a145e968230e6db3da.tar.gz
* fixed overflow
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@8577 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/ncgset.pas')
-rw-r--r--compiler/ncgset.pas12
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/ncgset.pas b/compiler/ncgset.pas
index f8e0d06cc8..77c2fa3bee 100644
--- a/compiler/ncgset.pas
+++ b/compiler/ncgset.pas
@@ -126,6 +126,7 @@ implementation
i:byte;
begin
analizeset:=false;
+ fillchar(setparts,sizeof(setparts),0);
numparts:=0;
compares:=0;
{ Lots of comparisions take a lot of time, so do not allow
@@ -663,6 +664,7 @@ implementation
var
oldflowcontrol: tflowcontrol;
i : longint;
+ distv,
lv,hv,
max_label: tconstexprint;
labelcnt : aint;
@@ -761,14 +763,10 @@ implementation
{ than the positive range of a aint }
if (min_label<0) and (max_label>0) then
- begin
- if min_label=TConstExprInt(int64(low(aint))) then
- dist:=aword(max_label.uvalue)+aword(low(aint))
- else
- dist:=aword(max_label.uvalue)+aword(-min_label.svalue)
- end
+ distv:=max_label+min_label
else
- dist:=max_label.uvalue-min_label.uvalue;
+ distv:=max_label-min_label;
+ dist:=distv.uvalue;
{ optimize for size ? }
if cs_opt_size in current_settings.optimizerswitches then