mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 19:29:18 +02:00
* fixed loading of procvar of object when the object is initialized
with 0
This commit is contained in:
parent
8b2fb4187e
commit
e0bcfca509
@ -143,7 +143,6 @@ implementation
|
||||
{ normal variable }
|
||||
else
|
||||
begin
|
||||
symtabletype:=symtable.symtabletype;
|
||||
{ in case it is a register variable: }
|
||||
if tvarsym(symtableentry).reg<>R_NO then
|
||||
begin
|
||||
@ -165,9 +164,12 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
{ first handle local and temporary variables }
|
||||
if (symtabletype in [parasymtable,inlinelocalsymtable,
|
||||
inlineparasymtable,localsymtable]) then
|
||||
symtabletype:=symtable.symtabletype;
|
||||
case symtabletype of
|
||||
localsymtable,
|
||||
parasymtable,
|
||||
inlinelocalsymtable,
|
||||
inlineparasymtable :
|
||||
begin
|
||||
location.reference.base:=procinfo.framepointer;
|
||||
if (symtabletype in [inlinelocalsymtable,
|
||||
@ -210,9 +212,27 @@ implementation
|
||||
end;
|
||||
location.reference.base:=hregister;
|
||||
end;
|
||||
end
|
||||
else
|
||||
case symtabletype of
|
||||
|
||||
if (symtabletype in [parasymtable,inlineparasymtable]) then
|
||||
begin
|
||||
{ in case call by reference, then calculate. Open array
|
||||
is always an reference! }
|
||||
if (tvarsym(symtableentry).varspez in [vs_var,vs_out]) or
|
||||
is_open_array(tvarsym(symtableentry).vartype.def) or
|
||||
is_array_of_const(tvarsym(symtableentry).vartype.def) or
|
||||
paramanager.push_addr_param(tvarsym(symtableentry).vartype.def,
|
||||
(tprocdef(symtable.defowner).proccalloption in [pocall_cdecl,pocall_cppdecl])) then
|
||||
begin
|
||||
if hregister=R_NO then
|
||||
hregister:=rg.getaddressregister(exprasmlist);
|
||||
{ we need to load only an address }
|
||||
location.size:=OS_ADDR;
|
||||
cg.a_load_loc_reg(exprasmlist,location,hregister);
|
||||
location_reset(location,LOC_REFERENCE,newsize);
|
||||
location.reference.base:=hregister;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
globalsymtable,
|
||||
staticsymtable :
|
||||
begin
|
||||
@ -249,25 +269,6 @@ implementation
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{ cdecl procedure }
|
||||
is_cdecl:=(symtabletype=parasymtable) and
|
||||
(tprocdef(symtable.defowner).proccalloption in [pocall_cdecl,pocall_cppdecl]);
|
||||
{ in case call by reference, then calculate. Open array
|
||||
is always an reference! }
|
||||
if (tvarsym(symtableentry).varspez in [vs_var,vs_out]) or
|
||||
is_open_array(tvarsym(symtableentry).vartype.def) or
|
||||
is_array_of_const(tvarsym(symtableentry).vartype.def) or
|
||||
((tvarsym(symtableentry).varspez=vs_const) and
|
||||
paramanager.push_addr_param(tvarsym(symtableentry).vartype.def,is_cdecl)) then
|
||||
begin
|
||||
if hregister=R_NO then
|
||||
hregister:=rg.getaddressregister(exprasmlist);
|
||||
{ we need to load only an address }
|
||||
location.size:=OS_ADDR;
|
||||
cg.a_load_loc_reg(exprasmlist,location,hregister);
|
||||
location_reset(location,LOC_REFERENCE,newsize);
|
||||
location.reference.base:=hregister;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
procsym:
|
||||
@ -292,7 +293,9 @@ implementation
|
||||
if left.nodetype=typen then
|
||||
begin
|
||||
{ there is no instance, we return 0 }
|
||||
cg.a_load_const_ref(exprasmlist,OS_ADDR,0,location.reference);
|
||||
href:=location.reference;
|
||||
inc(href.offset,POINTER_SIZE);
|
||||
cg.a_load_const_ref(exprasmlist,OS_ADDR,0,href);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -944,7 +947,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.26 2002-08-25 19:25:18 peter
|
||||
Revision 1.27 2002-09-01 12:15:40 peter
|
||||
* fixed loading of procvar of object when the object is initialized
|
||||
with 0
|
||||
|
||||
Revision 1.26 2002/08/25 19:25:18 peter
|
||||
* sym.insert_in_data removed
|
||||
* symtable.insertvardata/insertconstdata added
|
||||
* removed insert_in_data call from symtable.insert, it needs to be
|
||||
|
Loading…
Reference in New Issue
Block a user