Преглед изворни кода

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

git-svn-id: trunk@49242 -

florian пре 4 година
родитељ
комит
29a5d3267c
4 измењених фајлова са 13 додато и 5 уклоњено
  1. 1 0
      .gitattributes
  2. 4 0
      compiler/ncnv.pas
  3. 0 5
      compiler/x86/nx86cnv.pas
  4. 8 0
      tests/tbf/tb0274.pp

+ 1 - 0
.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

+ 4 - 0
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);

+ 0 - 5
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

+ 8 - 0
tests/tbf/tb0274.pp

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