OSDN Git Service

PR fortran/26025
[pf3gnuchains/gcc-fork.git] / gcc / tree-chrec.c
index f36fc9b..a74a49c 100644 (file)
@@ -1162,7 +1162,10 @@ convert_affine_scev (struct loop *loop, tree type,
         -- must_check_src_overflow is true, and the range of TYPE is superset
            of the range of CT -- i.e., in all cases except if CT signed and
            TYPE unsigned.
-         -- both CT and TYPE have the same precision and signedness.  */
+         -- both CT and TYPE have the same precision and signedness, and we
+           verify instead that the source does not overflow (this may be
+           easier than verifying it for the result, as we may use the
+           information about the semantics of overflow in CT).  */
       if (must_check_src_overflow)
        {
          if (TYPE_UNSIGNED (type) && !TYPE_UNSIGNED (ct))
@@ -1172,7 +1175,10 @@ convert_affine_scev (struct loop *loop, tree type,
        }
       else if (TYPE_UNSIGNED (ct) == TYPE_UNSIGNED (type)
               && TYPE_PRECISION (ct) == TYPE_PRECISION (type))
-       must_check_rslt_overflow = false;
+       {
+         must_check_rslt_overflow = false;
+         must_check_src_overflow = true;
+       }
       else
        must_check_rslt_overflow = true;
     }