* load a dummy value on the fpu stack in the epilog of functions

which return a real but which never assigned anything to the function
    result (since the caller will pop it off again) (x86-only, bug #4902)

git-svn-id: trunk@3016 -
This commit is contained in:
Jonas Maebe 2006-03-22 21:32:48 +00:00
parent a446c578ef
commit 1e3137c315
3 changed files with 26 additions and 1 deletions

1
.gitattributes vendored
View File

@ -6760,6 +6760,7 @@ tests/webtbs/tw4893a.pp svneol=native#text/plain
tests/webtbs/tw4893b.pp svneol=native#text/plain
tests/webtbs/tw4893c.pp svneol=native#text/plain
tests/webtbs/tw4898.pp -text
tests/webtbs/tw4902.pp -text
tests/webtbs/tw4922.pp svneol=native#text/plain
tests/webtbs/ub1873.pp svneol=native#text/plain
tests/webtbs/ub1883.pp svneol=native#text/plain

View File

@ -1258,7 +1258,15 @@ implementation
else
internalerror(200405025);
end;
end;
end
{$ifdef x86}
else
begin
{ the caller will pop a value off the cpu stack }
if (funcretloc.loc = LOC_FPUREGISTER) then
list.concat(taicpu.op_none(A_FLDZ));
end;
{$endif x86}
end;

16
tests/webtbs/tw4902.pp Normal file
View File

@ -0,0 +1,16 @@
{ Source provided for Free Pascal Bug Report 4902 }
{ Submitted by "Yu Hang" on 2006-03-14 }
{ e-mail: cosechy@gmail.com }
function x:real;
begin
end;
begin
x;
{anything here}
writeln(1);
writeln(2);
writeln(3);
{crash here}
writeln(1.0)
end.