summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-04-21 19:51:22 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-04-21 19:51:22 +0000
commitde2e3396159b746f3a9178a59b144ce9cd1c06fd (patch)
treed4e8f20ad2647793bb87364074ee11f5f72e461c
parentd92dcde98b200093dd9547dc7610210aca94cbd9 (diff)
downloadfpc-de2e3396159b746f3a9178a59b144ce9cd1c06fd.tar.gz
* moved warning about suspicious comp assignment to type check pass, catches also
assignments of constants git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@49242 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--compiler/ncnv.pas4
-rw-r--r--compiler/x86/nx86cnv.pas5
-rw-r--r--tests/tbf/tb0274.pp8
3 files changed, 12 insertions, 5 deletions
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.