Explorar el Código

Avoid range check error inside tcgcasenode.pass_generate_code method

Pierre Muller hace 3 años
padre
commit
c06a3f2ca3
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  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