From 2f60a01fecbed30885e54a91503c968f874fb953 Mon Sep 17 00:00:00 2001 From: pierre Date: Fri, 11 Jan 2019 09:08:57 +0000 Subject: [PATCH] Merge of commit 40521. ------------------------------------------------------------------------ r40521 | pierre | 2018-12-11 08:47:59 +0000 (Tue, 11 Dec 2018) | 1 line Modify tbs/tb0588.pp to check that a warning is issued about non-initialized return value, moved to tbf directory ------------------------------------------------------------------------ --- Merging r40521 into '.': D tests/tbs/tb0588.pp A tests/tbf/tb0588.pp --- Recording mergeinfo for merge of r40521 into '.': U . git-svn-id: branches/fixes_3_2@40840 - --- .gitattributes | 2 +- tests/tbf/tb0588.pp | 32 ++++++++++++++++++++++++++++++++ tests/tbs/tb0588.pp | 21 --------------------- 3 files changed, 33 insertions(+), 22 deletions(-) create mode 100644 tests/tbf/tb0588.pp delete mode 100644 tests/tbs/tb0588.pp diff --git a/.gitattributes b/.gitattributes index 6a38b4bea2..f4959369a3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10952,6 +10952,7 @@ tests/tbf/tb0262.pp svneol=native#text/pascal tests/tbf/tb0263.pp svneol=native#text/pascal tests/tbf/tb0264.pp svneol=native#text/pascal tests/tbf/tb0265.pp svneol=native#text/pascal +tests/tbf/tb0588.pp svneol=native#text/pascal tests/tbf/ub0115.pp svneol=native#text/plain tests/tbf/ub0149.pp svneol=native#text/plain tests/tbf/ub0158a.pp svneol=native#text/plain @@ -11543,7 +11544,6 @@ tests/tbs/tb0584.pp svneol=native#text/pascal tests/tbs/tb0585.pp svneol=native#text/pascal tests/tbs/tb0586.pp svneol=native#text/pascal tests/tbs/tb0587.pp svneol=native#text/plain -tests/tbs/tb0588.pp svneol=native#text/pascal tests/tbs/tb0589.pp svneol=native#text/pascal tests/tbs/tb0590.pp svneol=native#text/pascal tests/tbs/tb0591.pp svneol=native#text/pascal diff --git a/tests/tbf/tb0588.pp b/tests/tbf/tb0588.pp new file mode 100644 index 0000000000..48927d702f --- /dev/null +++ b/tests/tbf/tb0588.pp @@ -0,0 +1,32 @@ +{ %FAIL } +{ %opt=-O4 -Sew } + +{ This code can generate trouble because + uninitialized retrun value in f method + can have a pattern that generates a + floating point exception later. + + As core decided not to generate an error in such cases, + this test was modified to al least test that a warning + is issued about non-initialized return value. } + +{$mode objfpc} +uses + sysutils; +type + tmyclass = class + function f : double;virtual; + end; + +function tmyclass.f : double; + begin + end; + +var + myclass : tmyclass; +begin + myclass:=tmyclass.create; + writeln(myclass.f+myclass.f+myclass.f); + myclass.free; + writeln('ok'); +end. diff --git a/tests/tbs/tb0588.pp b/tests/tbs/tb0588.pp deleted file mode 100644 index 94b1b936d0..0000000000 --- a/tests/tbs/tb0588.pp +++ /dev/null @@ -1,21 +0,0 @@ -{ %opt=-O4 } -{$mode objfpc} -uses - sysutils; -type - tmyclass = class - function f : double;virtual; - end; - -function tmyclass.f : double; - begin - end; - -var - myclass : tmyclass; -begin - myclass:=tmyclass.create; - writeln(myclass.f+myclass.f+myclass.f); - myclass.free; - writeln('ok'); -end.