mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 21:06:11 +02:00
+ Fix for bug #3207 from Peter
This commit is contained in:
parent
1563d986c5
commit
04a69ced17
@ -495,6 +495,7 @@ implementation
|
||||
begin
|
||||
resultloc:=procdefinition.funcret_paraloc[callerside];
|
||||
cgsize:=resultloc.size;
|
||||
|
||||
{ structured results are easy to handle....
|
||||
needed also when result_no_used !! }
|
||||
if (procdefinition.proctypeoption<>potype_constructor) and
|
||||
@ -504,8 +505,9 @@ implementation
|
||||
if location.loc<>LOC_REFERENCE then
|
||||
internalerror(200304241);
|
||||
end
|
||||
else
|
||||
{ ansi/widestrings must be registered, so we can dispose them }
|
||||
else if resulttype.def.needs_inittable then
|
||||
if resulttype.def.needs_inittable then
|
||||
begin
|
||||
{ the FUNCTION_RESULT_REG is already allocated }
|
||||
if not assigned(funcretnode) then
|
||||
@ -532,9 +534,20 @@ implementation
|
||||
cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference);
|
||||
cg.ungetregister(exprasmlist,hregister);
|
||||
end;
|
||||
|
||||
{ When the result is not used we need to finalize the result and
|
||||
can release the temp }
|
||||
if not(cnf_return_value_used in callnodeflags) then
|
||||
begin
|
||||
cg.g_finalize(exprasmlist,resulttype.def,location.reference,false);
|
||||
tg.ungetiftemp(exprasmlist,location.reference)
|
||||
end;
|
||||
end
|
||||
else
|
||||
{ normal (ordinal,float,pointer) result value }
|
||||
begin
|
||||
{ we have only to handle the result if it is used }
|
||||
else if (cnf_return_value_used in callnodeflags) then
|
||||
if (cnf_return_value_used in callnodeflags) then
|
||||
begin
|
||||
location.loc:=resultloc.loc;
|
||||
case resultloc.loc of
|
||||
@ -608,11 +621,17 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
{$ifdef x86}
|
||||
{ release FPU stack }
|
||||
if resultloc.loc=LOC_FPUREGISTER then
|
||||
emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
|
||||
{$endif x86}
|
||||
if cgsize<>OS_NO then
|
||||
paramanager.freeparaloc(exprasmlist,resultloc);
|
||||
location_reset(location,LOC_VOID,OS_NO);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure tcgcallnode.release_para_temps;
|
||||
@ -1024,26 +1043,6 @@ implementation
|
||||
|
||||
{ release temps of paras }
|
||||
release_para_temps;
|
||||
|
||||
{ if return value is not used }
|
||||
if (not(cnf_return_value_used in callnodeflags)) and (not is_void(resulttype.def)) then
|
||||
begin
|
||||
if location.loc in [LOC_CREFERENCE,LOC_REFERENCE] then
|
||||
begin
|
||||
{ data which must be finalized ? }
|
||||
if (resulttype.def.needs_inittable) then
|
||||
cg.g_finalize(exprasmlist,resulttype.def,location.reference,false);
|
||||
{ release unused temp }
|
||||
tg.ungetiftemp(exprasmlist,location.reference)
|
||||
end
|
||||
else if location.loc=LOC_FPUREGISTER then
|
||||
begin
|
||||
{$ifdef x86}
|
||||
{ release FPU stack }
|
||||
emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
|
||||
{$endif x86}
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -1264,7 +1263,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.172 2004-07-11 19:01:13 peter
|
||||
Revision 1.173 2004-07-12 10:47:42 michael
|
||||
+ Fix for bug 3207 from Peter
|
||||
|
||||
Revision 1.172 2004/07/11 19:01:13 peter
|
||||
* comps are passed in int registers
|
||||
|
||||
Revision 1.171 2004/07/09 23:41:04 jonas
|
||||
|
Loading…
Reference in New Issue
Block a user