Browse Source

Avoid range check error inside tcgcasenode.pass_generate_code method

Pierre Muller 3 years ago
parent
commit
c06a3f2ca3
1 changed files with 2 additions and 2 deletions
  1. 2 2
      compiler/ncgset.pas

+ 2 - 2
compiler/ncgset.pas

@@ -1251,9 +1251,9 @@ implementation
 
                    distv:=max_label-min_label;
                    if distv>=0 then
-                     dist:=distv.uvalue
+                     dist:=min(distv.uvalue,high(dist))
                    else
-                     dist:=asizeuint(-distv.svalue);
+                     dist:=min(asizeuint(-distv.svalue),high(dist));
 
                    { optimize for size ? }
                    if cs_opt_size in current_settings.optimizerswitches  then