* fixed i8086 far pointer typed constants that are initialized with nil

git-svn-id: trunk@27458 -
This commit is contained in:
nickysn 2014-04-03 21:39:00 +00:00
parent 910e5ff888
commit 4832682c58
5 changed files with 94 additions and 2 deletions

1
.gitattributes vendored
View File

@ -262,6 +262,7 @@ compiler/i8086/n8086inl.pas svneol=native#text/plain
compiler/i8086/n8086ld.pas svneol=native#text/plain
compiler/i8086/n8086mat.pas svneol=native#text/plain
compiler/i8086/n8086mem.pas svneol=native#text/plain
compiler/i8086/n8086tcon.pas svneol=native#text/plain
compiler/i8086/r8086ari.inc svneol=native#text/plain
compiler/i8086/r8086att.inc svneol=native#text/plain
compiler/i8086/r8086con.inc svneol=native#text/plain

View File

@ -56,6 +56,8 @@ unit cpunode;
n8086inl,
n8086mat,
n8086con,
{ these are not really nodes }
n8086tcon,
{ symtable }
symcpu
;

View File

@ -0,0 +1,77 @@
{
Copyright (c) 1998-2011 by Florian Klaempfl, Jonas Maebe
Generates i8086 assembler for typed constant declarations
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit n8086tcon;
{$i fpcdefs.inc}
interface
uses
node,symdef,ngtcon;
type
{ ti8086typedconstbuilder }
ti8086typedconstbuilder = class(tasmlisttypedconstbuilder)
protected
procedure tc_emit_pointerdef(def: tpointerdef; var node: tnode);override;
end;
implementation
uses
ncnv,defcmp,defutil,aasmtai;
{ ti8086typedconstbuilder }
procedure ti8086typedconstbuilder.tc_emit_pointerdef(def: tpointerdef; var node: tnode);
var
hp: tnode;
begin
{ remove equal typecasts for pointer/nil addresses }
if (node.nodetype=typeconvn) then
with Ttypeconvnode(node) do
if (left.nodetype in [addrn,niln]) and equal_defs(def,node.resultdef) then
begin
hp:=left;
left:=nil;
node.free;
node:=hp;
end;
if node.nodetype=niln then
begin
if is_farpointer(def) or is_hugepointer(def) then
list.concat(Tai_const.Create_32bit(0))
else
list.concat(Tai_const.Create_16bit(0));
end
else
inherited tc_emit_pointerdef(def, node);
end;
begin
ctypedconstbuilder:=ti8086typedconstbuilder;
end.

View File

@ -76,11 +76,11 @@ interface
tasmlisttypedconstbuilder = class(ttypedconstbuilder)
private
list: tasmlist;
curoffset: asizeint;
function parse_single_packed_const(def: tdef; var bp: tbitpackedval): boolean;
protected
list: tasmlist;
procedure parse_packed_array_def(def: tarraydef);
procedure parse_arraydef(def:tarraydef);override;

View File

@ -28,7 +28,7 @@
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="227">
<Units Count="228">
<Unit0>
<Filename Value="pp.pas"/>
<IsPartOfProject Value="True"/>
@ -667,6 +667,7 @@
<Unit137>
<Filename Value="fppu.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="fppu"/>
</Unit137>
<Unit138>
<Filename Value="gendef.pas"/>
@ -679,6 +680,7 @@
<Unit140>
<Filename Value="htypechk.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="htypechk"/>
</Unit140>
<Unit141>
<Filename Value="impdef.pas"/>
@ -707,6 +709,7 @@
<Unit147>
<Filename Value="nbas.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="nbas"/>
</Unit147>
<Unit148>
<Filename Value="ncgbas.pas"/>
@ -748,6 +751,7 @@
<Unit157>
<Filename Value="ngtcon.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ngtcon"/>
</Unit157>
<Unit158>
<Filename Value="nobj.pas"/>
@ -897,6 +901,7 @@
<Unit194>
<Filename Value="ppu.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ppu"/>
</Unit194>
<Unit195>
<Filename Value="procinfo.pas"/>
@ -1021,6 +1026,7 @@
<Unit224>
<Filename Value="x86\ni86mem.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ni86mem"/>
</Unit224>
<Unit225>
<Filename Value="x86\symi86.pas"/>
@ -1030,7 +1036,13 @@
<Unit226>
<Filename Value="x86\symx86.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="symx86"/>
</Unit226>
<Unit227>
<Filename Value="i8086\n8086tcon.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="n8086tcon"/>
</Unit227>
</Units>
</ProjectOptions>
<CompilerOptions>