ソースを参照

* fixed crash with empty array constructors

peter 25 年 前
コミット
3cc443d181
3 ファイル変更29 行追加4 行削除
  1. 6 2
      compiler/htypechk.pas
  2. 8 1
      compiler/tcld.pas
  3. 15 1
      compiler/types.pas

+ 6 - 2
compiler/htypechk.pas

@@ -268,7 +268,8 @@ implementation
                         if is_open_array(def_to) and
                            is_array_constructor(def_from) then
                          begin
-                           if is_equal(parraydef(def_to)^.elementtype.def,parraydef(def_from)^.elementtype.def) then
+                           if is_void(parraydef(def_from)^.elementtype.def) or
+                              is_equal(parraydef(def_to)^.elementtype.def,parraydef(def_from)^.elementtype.def) then
                             begin
                               doconv:=tc_equal;
                               b:=1;
@@ -847,7 +848,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.53  1999-12-18 14:55:21  florian
+  Revision 1.54  1999-12-31 14:26:27  peter
+    * fixed crash with empty array constructors
+
+  Revision 1.53  1999/12/18 14:55:21  florian
     * very basic widestring support
 
   Revision 1.52  1999/12/16 19:12:04  peter

+ 8 - 1
compiler/tcld.pas

@@ -446,6 +446,10 @@ implementation
         { 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)   }
+      { if no type is set then we set the type to voiddef to overcome a
+        0 addressing }
+        if not assigned(pd) then
+         pd:=voiddef;
       { skip if already done ! (PM) }
         if not assigned(p^.resulttype) or
            (p^.resulttype^.deftype<>arraydef) or
@@ -474,7 +478,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.54  1999-12-09 23:18:05  pierre
+  Revision 1.55  1999-12-31 14:26:27  peter
+    * fixed crash with empty array constructors
+
+  Revision 1.54  1999/12/09 23:18:05  pierre
    * no_fast_exit if procedure contains implicit termination code
 
   Revision 1.53  1999/12/02 17:28:53  peter

+ 15 - 1
compiler/types.pas

@@ -53,6 +53,9 @@ interface
     { true if p is a char }
     function is_char(def : pdef) : boolean;
 
+    { true if p is a void}
+    function is_void(def : pdef) : boolean;
+
     { true if p is a smallset def }
     function is_smallset(p : pdef) : boolean;
 
@@ -355,6 +358,14 @@ implementation
       end;
 
 
+    { true if p is a void }
+    function is_void(def : pdef) : boolean;
+      begin
+        is_void:=(def^.deftype=orddef) and
+                 (porddef(def)^.typ=uvoid);
+      end;
+
+
     { true if p is a char }
     function is_char(def : pdef) : boolean;
       begin
@@ -985,7 +996,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.92  1999-11-30 10:40:59  peter
+  Revision 1.93  1999-12-31 14:26:28  peter
+    * fixed crash with empty array constructors
+
+  Revision 1.92  1999/11/30 10:40:59  peter
     + ttype, tsymlist
 
   Revision 1.91  1999/11/06 14:34:31  peter