Browse Source

* 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 năm trước cách đây
mục cha
commit
51ebaa592f
1 tập tin đã thay đổi với 12 bổ sung4 xóa
  1. 12 4
      compiler/nadd.pas

+ 12 - 4
compiler/nadd.pas

@@ -387,8 +387,12 @@ implementation
          begin
            if a>0 then
          ... 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
               t:=nil;
               lv:=Tordconstnode(left).value;
@@ -427,8 +431,12 @@ implementation
                   exit;
                 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
               t:=nil;
               rv:=Tordconstnode(right).value;