From 29a5d3267cc3329ed313bdf3e6b8d59e659260fc Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 21 Apr 2021 19:51:22 +0000 Subject: [PATCH] * moved warning about suspicious comp assignment to type check pass, catches also assignments of constants git-svn-id: trunk@49242 - --- .gitattributes | 1 + compiler/ncnv.pas | 4 ++++ compiler/x86/nx86cnv.pas | 5 ----- tests/tbf/tb0274.pp | 8 ++++++++ 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 tests/tbf/tb0274.pp diff --git a/.gitattributes b/.gitattributes index e7c89e8773..024d18e56e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12858,6 +12858,7 @@ tests/tbf/tb0270.pp svneol=native#text/pascal tests/tbf/tb0271.pp svneol=native#text/pascal tests/tbf/tb0272.pp svneol=native#text/plain tests/tbf/tb0273.pp svneol=native#text/pascal +tests/tbf/tb0274.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 diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index f115685a3d..5f5cb3f4cb 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -1630,6 +1630,10 @@ implementation include(flags,nf_is_currency); typecheckpass(left); end; + { comp is handled by the fpu but not a floating type point } + if is_fpucomp(resultdef) and not(is_fpucomp(left.resultdef)) and + not (nf_explicit in flags) then + Message(type_w_convert_real_2_comp); end else include(flags,nf_is_currency); diff --git a/compiler/x86/nx86cnv.pas b/compiler/x86/nx86cnv.pas index 91ea652eb4..805c8c5a96 100644 --- a/compiler/x86/nx86cnv.pas +++ b/compiler/x86/nx86cnv.pas @@ -72,11 +72,6 @@ implementation function tx86typeconvnode.first_real_to_real : tnode; begin first_real_to_real:=nil; - { comp isn't a floating type } - if (tfloatdef(resultdef).floattype=s64comp) and - (tfloatdef(left.resultdef).floattype<>s64comp) and - not (nf_explicit in flags) then - CGMessage(type_w_convert_real_2_comp); if use_vectorfpu(resultdef) then expectloc:=LOC_MMREGISTER else diff --git a/tests/tbf/tb0274.pp b/tests/tbf/tb0274.pp new file mode 100644 index 0000000000..4749726510 --- /dev/null +++ b/tests/tbf/tb0274.pp @@ -0,0 +1,8 @@ +{ %fail } +{ %opt=-Sew } +var + c : comp; + +begin + c:=123.123; +end.