Browse Source

* fix for bug #855

pierre 25 years ago
parent
commit
fe57fa3993
2 changed files with 22 additions and 4 deletions
  1. 5 1
      compiler/cgai386.pas
  2. 17 3
      compiler/symdef.inc

+ 5 - 1
compiler/cgai386.pas

@@ -2124,6 +2124,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
             begin
               parraydef(todef)^.genrangecheck;
               rstr:=parraydef(todef)^.getrangecheckstring;
+              doublebound:=(lto>hto);
             end;
         end;
       { get op and opsize }
@@ -3781,7 +3782,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 end.
 {
   $Log$
-  Revision 1.84  2000-03-01 00:03:12  pierre
+  Revision 1.85  2000-03-01 12:35:44  pierre
+   * fix for bug 855
+
+  Revision 1.84  2000/03/01 00:03:12  pierre
     * fixes for locals in inlined procedures
       fix for bug797
     + stabs generation for inlined paras and locals

+ 17 - 3
compiler/symdef.inc

@@ -1861,8 +1861,19 @@
                 datasegment^.concat(new(pai_symbol,initname_global(getrangecheckstring,8)))
               else
                 datasegment^.concat(new(pai_symbol,initname(getrangecheckstring,8)));
-              datasegment^.concat(new(pai_const,init_32bit(lowrange)));
-              datasegment^.concat(new(pai_const,init_32bit(highrange)));
+              if lowrange<=highrange then
+                begin
+                  datasegment^.concat(new(pai_const,init_32bit(lowrange)));
+                  datasegment^.concat(new(pai_const,init_32bit(highrange)));
+                end
+              { for big arrays we need two bounds }
+              else
+                begin
+                  datasegment^.concat(new(pai_const,init_32bit(lowrange)));
+                  datasegment^.concat(new(pai_const,init_32bit($7fffffff)));
+                  datasegment^.concat(new(pai_const,init_32bit($80000000)));
+                  datasegment^.concat(new(pai_const,init_32bit(highrange)));
+                end;
            end;
       end;
 
@@ -3932,7 +3943,10 @@ Const local_symtable_index : longint = $8001;
 
 {
   $Log$
-  Revision 1.196  2000-02-14 20:58:43  marco
+  Revision 1.197  2000-03-01 12:35:45  pierre
+   * fix for bug 855
+
+  Revision 1.196  2000/02/14 20:58:43  marco
    * Basic structures for new sethandling implemented.
 
   Revision 1.195  2000/02/11 13:53:49  pierre