diff --git a/compiler/i8086/n8086cnv.pas b/compiler/i8086/n8086cnv.pas index 89b8065870..5043f053d4 100644 --- a/compiler/i8086/n8086cnv.pas +++ b/compiler/i8086/n8086cnv.pas @@ -70,14 +70,22 @@ implementation begin if resultdef.typ<>procvardef then internalerror(2018040401); - exclude(tprocvardef(resultdef).procoptions,po_far); + if po_far in tprocvardef(resultdef).procoptions then + begin + resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_offset); + exclude(tprocvardef(resultdef).procoptions,po_far); + end; end else if (tcnf_proc_2_procvar_2_voidpointer in convnodeflags) and (current_settings.x86memorymodel in x86_far_code_models) then begin if resultdef.typ<>procvardef then internalerror(2018040402); - include(tprocvardef(resultdef).procoptions,po_far); + if not (po_far in tprocvardef(resultdef).procoptions) then + begin + resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_far_address); + include(tprocvardef(resultdef).procoptions,po_far); + end; end; end; diff --git a/compiler/symdef.pas b/compiler/symdef.pas index 1a76c5a805..e4741ae336 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -643,6 +643,12 @@ interface pno_mangledname, pno_noparams); tprocnameoptions = set of tprocnameoption; tproccopytyp = (pc_normal, +{$ifdef i8086} + { the address in a far format } + pc_far_address, + { the offset part of the far address } + pc_offset, +{$endif i8086} { creates a procvardef describing only the code pointer of a method/netsted function/... } pc_address_only,