From eb7aedc2854d476e0fae6ea63c5ea49dff99f9c2 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 20 Sep 2007 20:23:26 +0000 Subject: [PATCH] * fixed overflow git-svn-id: trunk@8577 - --- compiler/ncgset.pas | 12 +++++------- 1 file 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