Преглед изворни кода

* fixed the assignment of global functions to nested procvars in i8086 far code
models

git-svn-id: trunk@25831 -

nickysn пре 11 година
родитељ
комит
645cd11b9d
1 измењених фајлова са 8 додато и 5 уклоњено
  1. 8 5
      compiler/i8086/n8086cnv.pas

+ 8 - 5
compiler/i8086/n8086cnv.pas

@@ -107,7 +107,6 @@ implementation
           end
           end
         else
         else
           begin
           begin
-            { TODO: update for far procs }
             if not tabstractprocdef(left.resultdef).is_addressonly then
             if not tabstractprocdef(left.resultdef).is_addressonly then
               location_copy(location,left.location)
               location_copy(location,left.location)
             else
             else
@@ -116,17 +115,21 @@ implementation
                   tmethodpointer record and set the "frame pointer" to nil }
                   tmethodpointer record and set the "frame pointer" to nil }
                 if not(left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
                 if not(left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
                   internalerror(2013031503);
                   internalerror(2013031503);
-                location_reset_ref(location,LOC_REFERENCE,int_cgsize(sizeof(pint)*2),sizeof(pint));
+                location_reset_ref(location,LOC_REFERENCE,int_cgsize(6),sizeof(pint));
                 tg.gethltemp(current_asmdata.CurrAsmList,resultdef,resultdef.size,tt_normal,location.reference);
                 tg.gethltemp(current_asmdata.CurrAsmList,resultdef,resultdef.size,tt_normal,location.reference);
                 tmpreg:=cg.getaddressregister(current_asmdata.CurrAsmList);
                 tmpreg:=cg.getaddressregister(current_asmdata.CurrAsmList);
                 cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,tmpreg);
                 cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,tmpreg);
-                cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,tmpreg,location.reference);
+                cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_16,OS_16,tmpreg,location.reference);
+                tmpref:=left.location.reference;
+                tmpref.refaddr:=addr_seg;
+                inc(location.reference.offset,2);
+                cg.a_load_ref_ref(current_asmdata.CurrAsmList,OS_16,OS_16,tmpref,location.reference);
                 { setting the frame pointer to nil is not strictly necessary
                 { setting the frame pointer to nil is not strictly necessary
                   since the global procedure won't use it, but it can help with
                   since the global procedure won't use it, but it can help with
                   debugging }
                   debugging }
-                inc(location.reference.offset,sizeof(pint));
+                inc(location.reference.offset,2);
                 cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_ADDR,0,location.reference);
                 cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_ADDR,0,location.reference);
-                dec(location.reference.offset,sizeof(pint));
+                dec(location.reference.offset,4);
               end;
               end;
           end;
           end;
       end;
       end;