Browse Source

* two bugs reported by Romio (bugs 13) are fixed:
- empty array constructors are now handled correctly (e.g. for sysutils.format)
- comparsion of ansistrings was sometimes coded wrong

florian 26 years ago
parent
commit
ba314dab05
4 changed files with 42 additions and 9 deletions
  1. 7 1
      compiler/cg386add.pas
  2. 18 5
      compiler/tccal.pas
  3. 9 1
      compiler/tcld.pas
  4. 8 2
      compiler/types.pas

+ 7 - 1
compiler/cg386add.pas

@@ -196,6 +196,7 @@ implementation
                    ltn,lten,gtn,gten,
                    equaln,unequaln:
                      begin
+                        cmpop:=true;
                         secondpass(p^.left);
                         pushed:=maybe_push(p^.right^.registers32,p);
                         secondpass(p^.right);
@@ -2028,7 +2029,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.58  1999-05-18 21:58:22  florian
+  Revision 1.59  1999-05-19 10:31:53  florian
+    * two bugs reported by Romio (bugs 13) are fixed:
+        - empty array constructors are now handled correctly (e.g. for sysutils.format)
+        - comparsion of ansistrings was sometimes coded wrong
+
+  Revision 1.58  1999/05/18 21:58:22  florian
     * fixed some bugs related to temp. ansistrings and functions results
       which return records/objects/arrays which need init/final.
 

+ 18 - 5
compiler/tccal.pas

@@ -76,8 +76,16 @@ implementation
                  p^.hightree:=genloadnode(pvarsym(srsym),st);
                end
               else
-               len:=parraydef(p^.left^.resulttype)^.highrange-
-                    parraydef(p^.left^.resulttype)^.lowrange;
+                begin
+                   { this is an empty constructor
+                   if (parraydef(p^.left^.resulttype)^.highrange=-1)
+                     and (parraydef(p^.left^.resulttype)^.lowrange=0) then
+                     len:=0
+                   else
+                   }
+                     len:=parraydef(p^.left^.resulttype)^.highrange-
+                       parraydef(p^.left^.resulttype)^.lowrange;
+                end;
             end;
           stringdef :
             begin
@@ -113,8 +121,8 @@ implementation
         else
           len:=0;
         end;
-        if len>=0 then
-          p^.hightree:=genordinalconstnode(len,s32bitdef);
+        { if len>=0 then }
+        p^.hightree:=genordinalconstnode(len,s32bitdef);
         firstpass(p^.hightree);
       end;
 
@@ -1156,7 +1164,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.44  1999-05-18 21:58:33  florian
+  Revision 1.45  1999-05-19 10:31:54  florian
+    * two bugs reported by Romio (bugs 13) are fixed:
+        - empty array constructors are now handled correctly (e.g. for sysutils.format)
+        - comparsion of ansistrings was sometimes coded wrong
+
+  Revision 1.44  1999/05/18 21:58:33  florian
     * fixed some bugs related to temp. ansistrings and functions results
       which return records/objects/arrays which need init/final.
 

+ 9 - 1
compiler/tcld.pas

@@ -427,6 +427,9 @@ implementation
             end;
          end;
         calcregisters(p,0,0,0);
+        { looks a little bit dangerous to me                }
+        { len-1 gives problems with is_open_array if len=0, }
+        { is_open_array checks now for isconstructor (FK)   }
         p^.resulttype:=new(parraydef,init(0,len-1,s32bitdef));
         parraydef(p^.resulttype)^.definition:=pd;
         parraydef(p^.resulttype)^.IsConstructor:=true;
@@ -449,7 +452,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.29  1999-05-17 23:51:45  peter
+  Revision 1.30  1999-05-19 10:31:55  florian
+    * two bugs reported by Romio (bugs 13) are fixed:
+        - empty array constructors are now handled correctly (e.g. for sysutils.format)
+        - comparsion of ansistrings was sometimes coded wrong
+
+  Revision 1.29  1999/05/17 23:51:45  peter
     * with temp vars now use a reference with a persistant temp instead
       of setting datasize
 

+ 8 - 2
compiler/types.pas

@@ -286,7 +286,8 @@ implementation
       begin
          is_open_array:=(p^.deftype=arraydef) and
                         (parraydef(p)^.lowrange=0) and
-                        (parraydef(p)^.highrange=-1);
+                        (parraydef(p)^.highrange=-1) and
+                        not(is_array_constructor(p));
       end;
 
 
@@ -810,7 +811,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.60  1999-05-18 14:16:01  peter
+  Revision 1.61  1999-05-19 10:31:56  florian
+    * two bugs reported by Romio (bugs 13) are fixed:
+        - empty array constructors are now handled correctly (e.g. for sysutils.format)
+        - comparsion of ansistrings was sometimes coded wrong
+
+  Revision 1.60  1999/05/18 14:16:01  peter
     * containsself fixes
     * checktypes()