Browse Source

* range check error fix

carl 23 years ago
parent
commit
5c1fa99660
1 changed files with 12 additions and 6 deletions
  1. 12 6
      compiler/cgbase.pas

+ 12 - 6
compiler/cgbase.pas

@@ -234,7 +234,7 @@ unit cgbase;
     {# From a constant numeric value, return the abstract code generator
     {# From a constant numeric value, return the abstract code generator
        size.
        size.
     }
     }
-    function int_cgsize(const l: byte): tcgsize;
+    function int_cgsize(const a: aword): tcgsize;
 
 
     {# return the inverse condition of opcmp }
     {# return the inverse condition of opcmp }
     function inverse_opcmp(opcmp: topcmp): topcmp;
     function inverse_opcmp(opcmp: topcmp): topcmp;
@@ -594,9 +594,14 @@ implementation
         end;
         end;
       end;
       end;
 
 
-    function int_cgsize(const l: byte): tcgsize;
+    function int_cgsize(const a: aword): tcgsize;
       begin
       begin
-        case l of
+        if a > 8 then
+          begin
+            int_cgsize := OS_NO;
+            exit;
+          end;
+        case byte(a) of
           1 :
           1 :
             result := OS_8;
             result := OS_8;
           2 :
           2 :
@@ -605,8 +610,6 @@ implementation
             result := OS_32;
             result := OS_32;
           5..8 :
           5..8 :
             result := OS_64;
             result := OS_64;
-          else
-            result:=OS_NO;
         end;
         end;
       end;
       end;
 
 
@@ -654,7 +657,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.30  2002-09-30 07:00:44  florian
+  Revision 1.31  2002-10-03 21:20:19  carl
+    * range check error fix
+
+  Revision 1.30  2002/09/30 07:00:44  florian
     * fixes to common code to get the alpha compiler compiled applied
     * fixes to common code to get the alpha compiler compiled applied
 
 
   Revision 1.29  2002/09/07 19:35:45  florian
   Revision 1.29  2002/09/07 19:35:45  florian