From e4b717c81766d4ee4b614e4627887045a781d771 Mon Sep 17 00:00:00 2001 From: yury Date: Tue, 18 Aug 2020 09:52:40 +0000 Subject: [PATCH] * 8086: More fixes for Ofs() handling. git-svn-id: trunk@46478 - --- compiler/i8086/n8086cnv.pas | 10 ++-------- compiler/i8086/symcpu.pas | 32 ++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/compiler/i8086/n8086cnv.pas b/compiler/i8086/n8086cnv.pas index 5043f053d4..08db07ed9f 100644 --- a/compiler/i8086/n8086cnv.pas +++ b/compiler/i8086/n8086cnv.pas @@ -71,10 +71,7 @@ implementation if resultdef.typ<>procvardef then internalerror(2018040401); if po_far in tprocvardef(resultdef).procoptions then - begin - resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_offset); - exclude(tprocvardef(resultdef).procoptions,po_far); - end; + resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_offset); end else if (tcnf_proc_2_procvar_2_voidpointer in convnodeflags) and (current_settings.x86memorymodel in x86_far_code_models) then @@ -82,10 +79,7 @@ implementation if resultdef.typ<>procvardef then internalerror(2018040402); 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; + resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_far_address); end; end; diff --git a/compiler/i8086/symcpu.pas b/compiler/i8086/symcpu.pas index ea132fe18c..1b7dc39a85 100644 --- a/compiler/i8086/symcpu.pas +++ b/compiler/i8086/symcpu.pas @@ -271,6 +271,28 @@ implementation result:=(p.typ=pointerdef) and (tcpupointerdef(p).x86pointertyp=x86pt_huge); end; + procedure handle_procdef_copyas(src: tabstractprocdef; is_far: boolean; copytyp:tproccopytyp; var result: tabstractprocdef); + begin + if is_far then + include(result.procoptions,po_far) + else + exclude(result.procoptions,po_far); + case copytyp of + pc_far_address: + begin + include(result.procoptions,po_addressonly); + include(result.procoptions,po_far); + end; + pc_offset: + begin + include(result.procoptions,po_addressonly); + exclude(result.procoptions,po_far); + end; + else + ; {none} + end; + end; + {**************************************************************************** tcpuclassrefdef ****************************************************************************} @@ -337,10 +359,7 @@ implementation function tcpuprocdef.getcopyas(newtyp:tdeftyp;copytyp:tproccopytyp;const paraprefix:string):tstoreddef; begin result:=inherited; - if is_far then - include(tabstractprocdef(result).procoptions,po_far) - else - exclude(tabstractprocdef(result).procoptions,po_far); + handle_procdef_copyas(self,is_far,copytyp,tabstractprocdef(result)); end; @@ -431,10 +450,7 @@ implementation function tcpuprocvardef.getcopyas(newtyp:tdeftyp;copytyp:tproccopytyp;const paraprefix:string):tstoreddef; begin result:=inherited; - if is_far then - include(tabstractprocdef(result).procoptions,po_far) - else - exclude(tabstractprocdef(result).procoptions,po_far); + handle_procdef_copyas(self,is_far,copytyp,tabstractprocdef(result)); end;