+2019-02-02 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/88298
+ Backport from trunk
+ * arith.c (gfc_int2int): Do not warn if src->do_not_warn is set.
+ * gfortran.h (gfc_expr): Add flag do_not_warn.
+ * intrinsic.c (gfc_convert_type_warn): Set expr->do_not_warn if
+ no warning is desired.
+
2019-02-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/57048
gfc_convert_mpz_to_signed (result->value.integer,
gfc_integer_kinds[k].bit_size);
- if (warn_conversion && kind < src->ts.kind)
+ if (warn_conversion && !src->do_not_warn && kind < src->ts.kind)
gfc_warning_now (OPT_Wconversion, "Conversion from %qs to %qs at %L",
gfc_typename (&src->ts), gfc_typename (&result->ts),
&src->where);
/* Will require finalization after use. */
unsigned int must_finalize : 1;
+ /* Set this if no warning should be given somewhere in a lower level. */
+
+ unsigned int do_not_warn : 1;
/* If an expression comes from a Hollerith constant or compile-time
evaluation of a transfer statement, it may have a prescribed target-
memory representation, and these cannot always be backformed from
if (ts->type == BT_UNKNOWN)
goto bad;
+ expr->do_not_warn = ! wflag;
+
/* NULL and zero size arrays get their type here. */
if (expr->expr_type == EXPR_NULL
|| (expr->expr_type == EXPR_ARRAY && expr->value.constructor == NULL))
+2019-02-02 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/88298
+ Backport from trunk
+ * gfortran.dg/warn_conversion_10.f90: New test.
+
2019-02-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/57048
--- /dev/null
+! { dg-do compile }
+! { dg-options "-fno-range-check -Wconversion" }
+! PR 88298 - this used to warn unnecessarily. Original test case by
+! Harald Anlauf.
+subroutine bug (j, js)
+ integer :: j, js(3,2)
+ js(:,:) = cshift (js(:,:), shift=j, dim=1)
+end subroutine bug