* moved warning about suspicious comp assignment to type check pass, catches also

assignments of constants

git-svn-id: trunk@49242 -
This commit is contained in:
florian 2021-04-21 19:51:22 +00:00
parent 02ec94c818
commit 29a5d3267c
4 changed files with 13 additions and 5 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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);

View File

@ -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

8
tests/tbf/tb0274.pp Normal file
View File

@ -0,0 +1,8 @@
{ %fail }
{ %opt=-Sew }
var
c : comp;
begin
c:=123.123;
end.