diff --git a/.gitattributes b/.gitattributes index dbb5e5887a..34f44c09a1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index 1a249540d0..a386029ba5 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -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; diff --git a/tests/webtbs/tw4902.pp b/tests/webtbs/tw4902.pp new file mode 100644 index 0000000000..51c76c9af7 --- /dev/null +++ b/tests/webtbs/tw4902.pp @@ -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.