Browse Source

* fixed passing of array of record or shortstring to open array

peter 24 years ago
parent
commit
62cccdebb5
2 changed files with 29 additions and 25 deletions
  1. 24 7
      compiler/i386/n386ld.pas
  2. 5 18
      compiler/symdef.pas

+ 24 - 7
compiler/i386/n386ld.pas

@@ -916,11 +916,7 @@ implementation
         if dovariant then
         if dovariant then
          elesize:=8
          elesize:=8
         else
         else
-         begin
-           elesize:=tarraydef(resulttype.def).elesize;
-           if elesize>4 then
-            internalerror(8765678);
-         end;
+         elesize:=tarraydef(resulttype.def).elesize;
         if not(nf_cargs in flags) then
         if not(nf_cargs in flags) then
          begin
          begin
            reset_reference(location.reference);
            reset_reference(location.reference);
@@ -1053,8 +1049,26 @@ implementation
                      emit_mov_loc_ref(hp.left.location,href,S_W,freetemp);
                      emit_mov_loc_ref(hp.left.location,href,S_W,freetemp);
                    4 :
                    4 :
                      emit_mov_loc_ref(hp.left.location,href,S_L,freetemp);
                      emit_mov_loc_ref(hp.left.location,href,S_L,freetemp);
+                   8 :
+                     begin
+                       if hp.left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
+                        begin
+                          emit_reg_ref(A_MOV,S_L,hp.left.location.registerlow,newreference(href));
+                          { update href to the high bytes and write it }
+                          inc(href.offset,4);
+                          emit_reg_ref(A_MOV,S_L,hp.left.location.registerhigh,newreference(href));
+                          dec(href.offset,4)
+                        end
+                       else
+                        concatcopy(hp.left.location.reference,href,elesize,freetemp,false);
+                     end;
                    else
                    else
-                     internalerror(87656781);
+                     begin
+                       { concatcopy only supports reference }
+                       if not(hp.left.location.loc in [LOC_MEM,LOC_REFERENCE]) then
+                        internalerror(200108012);
+                       concatcopy(hp.left.location.reference,href,elesize,freetemp,false);
+                     end;
                  end;
                  end;
                  inc(href.offset,elesize);
                  inc(href.offset,elesize);
                end;
                end;
@@ -1072,7 +1086,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.15  2001-07-28 15:13:17  peter
+  Revision 1.16  2001-08-01 21:47:48  peter
+    * fixed passing of array of record or shortstring to open array
+
+  Revision 1.15  2001/07/28 15:13:17  peter
     * fixed opsize for assignment with LOC_JUMP
     * fixed opsize for assignment with LOC_JUMP
 
 
   Revision 1.14  2001/05/27 14:30:56  florian
   Revision 1.14  2001/05/27 14:30:56  florian

+ 5 - 18
compiler/symdef.pas

@@ -2639,23 +2639,7 @@ implementation
 
 
     function tarraydef.elesize : longint;
     function tarraydef.elesize : longint;
       begin
       begin
-        if ((lowrange=0) and
-            (highrange=-1) and
-            (not IsArrayOfConst) and
-            (not IsVariant) and
-            (not IsDynamicArray)) or
-           IsConstructor then
-         begin
-           { strings are stored by address only }
-           case elementtype.def.deftype of
-             stringdef :
-               elesize:=4;
-             else
-               elesize:=elementtype.def.size;
-           end;
-         end
-        else
-         elesize:=elementtype.def.size;
+        elesize:=elementtype.def.size;
       end;
       end;
 
 
 
 
@@ -5523,7 +5507,10 @@ Const local_symtable_index : longint = $8001;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.38  2001-07-30 20:59:27  peter
+  Revision 1.39  2001-08-01 21:47:48  peter
+    * fixed passing of array of record or shortstring to open array
+
+  Revision 1.38  2001/07/30 20:59:27  peter
     * m68k updates from v10 merged
     * m68k updates from v10 merged
 
 
   Revision 1.37  2001/07/30 11:52:57  jonas
   Revision 1.37  2001/07/30 11:52:57  jonas