From 6af8284719d151087a1c1e4da210cc5a9fa4a478 Mon Sep 17 00:00:00 2001 From: Mark Eggleston Date: Mon, 27 Jul 2020 15:28:50 +0100 Subject: Fortran : Don't warn for LOGICAL kind conversion PR96319 LOGICAL values will always fit regardless of kind so there is no need for warnings. 2020-07-29 Mark Eggleston gcc/fortran/ PR fortran/96319 * intrinsic.c (gfc_convert_type_warn): Add check for LOGICAL type so that warnings are not output. 2020-07-29 Mark Eggleston gcc/testsuite/ PR fortran/96319 * gfortran.dg/pr96319.f90: New test. --- gcc/fortran/intrinsic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 3518a4e..ef33587 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -5245,8 +5245,10 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag, { /* Larger kinds can hold values of smaller kinds without problems. Hence, only warn if target kind is smaller than the source - kind - or if -Wconversion-extra is specified. */ - if (expr->expr_type != EXPR_CONSTANT) + kind - or if -Wconversion-extra is specified. LOGICAL values + will always fit regardless of kind so ignore conversion. */ + if (expr->expr_type != EXPR_CONSTANT + && ts->type != BT_LOGICAL) { if (warn_conversion && from_ts.kind > ts->kind) gfc_warning_now (OPT_Wconversion, "Possible change of value in " -- cgit v1.1