Browse Source

* use tasbtractprocdef(resultdef).addresstype instead of voidcodepointertype in
tcgtypeconvnode.second_proc_to_procvar. In the future (it's not implemented
yet), this will allow taking the address of near procedures (which would then
produce a near procvar) in i8086 far code memory models.

git-svn-id: trunk@38644 -

nickysn 7 years ago
parent
commit
0b66419e8b
1 changed files with 3 additions and 3 deletions
  1. 3 3
      compiler/ncgcnv.pas

+ 3 - 3
compiler/ncgcnv.pas

@@ -548,18 +548,18 @@ interface
       begin
       begin
         if tabstractprocdef(resultdef).is_addressonly then
         if tabstractprocdef(resultdef).is_addressonly then
           begin
           begin
-            location_reset(location,LOC_REGISTER,def_cgsize(voidcodepointertype));
+            location_reset(location,LOC_REGISTER,def_cgsize(tabstractprocdef(resultdef).address_type));
             { only a code pointer? (when taking the address of classtype.method
             { only a code pointer? (when taking the address of classtype.method
               we also only get a code pointer even though the resultdef is a
               we also only get a code pointer even though the resultdef is a
               procedure of object, and hence is_addressonly would return false)
               procedure of object, and hence is_addressonly would return false)
              }
              }
-	    if left.location.size = def_cgsize(voidcodepointertype) then
+	    if left.location.size = def_cgsize(tabstractprocdef(resultdef).address_type) then
               begin
               begin
                 case left.location.loc of
                 case left.location.loc of
                   LOC_REFERENCE,LOC_CREFERENCE:
                   LOC_REFERENCE,LOC_CREFERENCE:
                     begin
                     begin
                       { the procedure symbol is encoded in reference.symbol -> take address }
                       { the procedure symbol is encoded in reference.symbol -> take address }
-                      location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,voidcodepointertype);
+                      location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,tabstractprocdef(resultdef).address_type);
                       hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,left.location.reference,location.register);
                       hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,left.location.reference,location.register);
                     end;
                     end;
                   else
                   else