Преглед на файлове

* when a function returns a value in a register, but normally that type
would never be put in that kind of register by the compiler, store
it to memory to avoid issues down the line
o fixes tcalext6 on darwin/i386

git-svn-id: trunk@46449 -

Jonas Maebe преди 5 години
родител
ревизия
cc14f06677
променени са 1 файла, в които са добавени 12 реда и са изтрити 0 реда
  1. 12 0
      compiler/ncgcal.pas

+ 12 - 0
compiler/ncgcal.pas

@@ -623,6 +623,18 @@ implementation
              assigned(funcretnode) then
             hlcg.gen_load_cgpara_loc(current_asmdata.CurrAsmList,realresdef,retloc,location,false);
 
+        if ((location.loc=LOC_REGISTER) and
+            not realresdef.is_intregable) or
+           ((location.loc in [LOC_FPUREGISTER,LOC_MMREGISTER]) and
+            (not realresdef.is_fpuregable or
+             ((location.loc=LOC_MMREGISTER)<>use_vectorfpu(realresdef)))) then
+          begin
+            hlcg.location_force_mem(current_asmdata.CurrAsmList,location,realresdef);
+            { may have been record returned in a floating point register (-> location.size
+              will be the size of the fpuregister instead of the int size of the record) }
+            location.size:=def_cgsize(realresdef);
+          end;
+
         { copy value to the final location if this was already provided to the
           callnode. This must be done after the call node, because the location can
           also be used as parameter and may not be finalized yet }