فهرست منبع

* tmoddivnode.pass_typecheck: in the case of unsigned div/mod positive_const, check also the upper bound of the const, so it doesn't get truncated

git-svn-id: branches/i8086@24247 -
nickysn 12 سال پیش
والد
کامیت
1312fd72f2
1فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 4 2
      compiler/nmat.pas

+ 4 - 2
compiler/nmat.pas

@@ -245,7 +245,8 @@ implementation
          { (webtbs/tw8870)                                                                }
          if (rd.ordtype in [u8bit,u16bit,u32bit,u64bit]) and
             ((is_constintnode(left) and
-              (tordconstnode(left).value >= 0)) or
+              (tordconstnode(left).value >= 0) and
+              (tordconstnode(left).value <= get_max_value(rd))) or
              (not is_signed(ld) and
               (rd.size >= ld.size))) then
            begin
@@ -254,7 +255,8 @@ implementation
            end;
          if (ld.ordtype in [u8bit,u16bit,u32bit,u64bit]) and
             ((is_constintnode(right) and
-              (tordconstnode(right).value >= 0)) or
+              (tordconstnode(right).value >= 0) and
+              (tordconstnode(right).value <= get_max_value(ld))) or
              (not is_signed(rd) and
               (ld.size >= rd.size))) then
           begin