* fixed crash with empty array constructor

This commit is contained in:
peter 1999-05-31 12:42:43 +00:00
parent c4334007df
commit e79d80a971

View File

@ -731,15 +731,18 @@ implementation
if not p^.cargs then if not p^.cargs then
begin begin
reset_reference(p^.location.reference); reset_reference(p^.location.reference);
{ Allocate always a temp, also if no elements are required, to
ensure that location is valid (PFV) }
if parraydef(p^.resulttype)^.highrange=-1 then if parraydef(p^.resulttype)^.highrange=-1 then
begin gettempofsizereference(8,p^.location.reference)
end
else else
gettempofsizereference((parraydef(p^.resulttype)^.highrange+1)*8,p^.location.reference); gettempofsizereference((parraydef(p^.resulttype)^.highrange+1)*8,p^.location.reference);
href:=p^.location.reference; href:=p^.location.reference;
end; end;
hp:=p; hp:=p;
while assigned(hp) do while assigned(hp) do
begin
if assigned(hp^.left) then
begin begin
secondpass(hp^.left); secondpass(hp^.left);
if codegenerror then if codegenerror then
@ -750,7 +753,8 @@ implementation
lt:=hp^.left^.resulttype; lt:=hp^.left^.resulttype;
case lt^.deftype of case lt^.deftype of
enumdef, enumdef,
orddef : begin orddef :
begin
if (lt^.deftype=enumdef) or if (lt^.deftype=enumdef) or
is_integer(lt) then is_integer(lt) then
vtype:=vtInteger vtype:=vtInteger
@ -761,22 +765,27 @@ implementation
if (lt^.deftype=orddef) and (porddef(lt)^.typ=uchar) then if (lt^.deftype=orddef) and (porddef(lt)^.typ=uchar) then
vtype:=vtChar; vtype:=vtChar;
end; end;
floatdef : begin floatdef :
begin
vtype:=vtExtended; vtype:=vtExtended;
vaddr:=true; vaddr:=true;
end; end;
procvardef, procvardef,
pointerdef : begin pointerdef :
begin
if is_pchar(lt) then if is_pchar(lt) then
vtype:=vtPChar vtype:=vtPChar
else else
vtype:=vtPointer; vtype:=vtPointer;
end; end;
classrefdef : vtype:=vtClass; classrefdef :
objectdef : begin vtype:=vtClass;
objectdef :
begin
vtype:=vtObject; vtype:=vtObject;
end; end;
stringdef : begin stringdef :
begin
if is_shortstring(lt) then if is_shortstring(lt) then
begin begin
vtype:=vtString; vtype:=vtString;
@ -816,6 +825,7 @@ implementation
emit_mov_loc_ref(hp^.left^.location,href); emit_mov_loc_ref(hp^.left^.location,href);
inc(href.offset,4); inc(href.offset,4);
end; end;
end;
{ load next entry } { load next entry }
hp:=hp^.right; hp:=hp^.right;
end; end;
@ -825,7 +835,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.59 1999-05-27 19:44:14 peter Revision 1.60 1999-05-31 12:42:43 peter
* fixed crash with empty array constructor
Revision 1.59 1999/05/27 19:44:14 peter
* removed oldasm * removed oldasm
* plabel -> pasmlabel * plabel -> pasmlabel
* -a switches to source writing automaticly * -a switches to source writing automaticly