Преглед на файлове

* fixed tests/webtbf/tb0041 broken by r7603: check whether ordinals
are compatible before optimizing the checks away

git-svn-id: trunk@7616 -

Jonas Maebe преди 18 години
родител
ревизия
51ebaa592f
променени са 1 файла, в които са добавени 12 реда и са изтрити 4 реда
  1. 12 4
      compiler/nadd.pas

+ 12 - 4
compiler/nadd.pas

@@ -387,8 +387,12 @@ implementation
          begin
          begin
            if a>0 then
            if a>0 then
          ... always evaluates to true. (DM)}
          ... always evaluates to true. (DM)}
-        else if is_constintnode(left) and (right.resultdef.typ=orddef)
-            {workaround for u64bit bugs} and (Torddef(right.resultdef).ordtype<>u64bit) then
+        else if is_constintnode(left) and (right.resultdef.typ=orddef) and
+            { all type limits are stored using tconstexprint = int64   }
+            { currently, so u64bit support would need extra type casts }
+            (Torddef(right.resultdef).ordtype<>u64bit) and
+            { don't ignore type checks }
+            is_subequal(left.resultdef,right.resultdef) then
             begin
             begin
               t:=nil;
               t:=nil;
               lv:=Tordconstnode(left).value;
               lv:=Tordconstnode(left).value;
@@ -427,8 +431,12 @@ implementation
                   exit;
                   exit;
                 end
                 end
             end
             end
-          else if (left.resultdef.typ=orddef) and is_constintnode(right)
-            {workaround for u64bit bugs} and (Torddef(left.resultdef).ordtype<>u64bit) then
+          else if (left.resultdef.typ=orddef) and is_constintnode(right) and
+              { all type limits are stored using tconstexprint = int64   }
+              { currently, so u64bit support would need extra type casts }
+              (Torddef(left.resultdef).ordtype<>u64bit) and
+              { don't ignore type checks }
+              is_subequal(left.resultdef,right.resultdef) then
             begin
             begin
               t:=nil;
               t:=nil;
               rv:=Tordconstnode(right).value;
               rv:=Tordconstnode(right).value;