From patchwork Sat Feb 2 14:41:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 1035454 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-495182-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=netcologne.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="q3FuKTdq"; dkim=pass (2048-bit key; unprotected) header.d=netcologne.de header.i=@netcologne.de header.b="VeMQHRf0"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43sGrQ4hNZz9sNM for ; Sun, 3 Feb 2019 01:41:37 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=W8aPtowYIQn2l90WTn5JAi4znJYDBvI5PYB+u26OYmnbJCj3pL n3Z7nqwOdFTdNOzg87FKFtHCILZujnQkikK3TKsAUMuzVlnp5loFV3oiFZqLIZ/K h5ut1XuJEfjnfEzOaYR9Yin5SgQCA/2cddQrgFAcez74cp2h82GEkgZP0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=DktaYnG9zbg/noDOeOmOIIEOk4o=; b=q3FuKTdqhqsxtRRejlOe Nnnf6ioPcxmOch9qYA0ScSIgLO8wAbzWLVKtqmFSw2wVgl7n5MVA8unhWgOYQ7nZ B+zpNz8VgQnxaHX09IMiRodDj91vqpwujZzwFqS5ByZt7WAylZa41CW90wPwSNVU e6yWB9UkUArghaCDd+ilVuI= Received: (qmail 60800 invoked by alias); 2 Feb 2019 14:41:26 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 60783 invoked by uid 89); 2 Feb 2019 14:41:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=H*F:U*tkoenig, HX-Envelope-From:sk:tkoenig, transfer X-HELO: cc-smtpout1.netcologne.de Received: from cc-smtpout1.netcologne.de (HELO cc-smtpout1.netcologne.de) (89.1.8.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 02 Feb 2019 14:41:24 +0000 Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id 4F70E131B0; Sat, 2 Feb 2019 15:41:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1549118480; bh=SFayQVg5/9RhgiMrkx1InahyANUE6bSRy13nORMlzuY=; h=To:From:Subject:Message-ID:Date:From; b=VeMQHRf0NO0llFtbtFbVscHiJoTrCQHQiou7cm/wlYhcUcijZiTMxMlloIkWiq2m8 SzaPTQOIfWg8222EZ70jPWVVWnc4kXODE+QNZjo8Qe9Ek3sDMZPIMBteTfscOOE+QL SU3Fs+nugEwnfGCOO7mFwDdLAkuhB2J1vBHSv4+XqX28P8fiJdbLXIxjgyGkvrid0z C6a/sklBRC6S6zYc2S30AKQIN0wBplYC8URTvCjunvBJS1h0LJVwOgorzRf+bj5cOy uJRQHNBdQO5upaa0fkMLfkwdrpDlpk875K9yO9M44fNVKl0jm1m9ho5SC3IVlaFb92 hNkMjO72Oj4JQ== Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id 4050411E57; Sat, 2 Feb 2019 15:41:20 +0100 (CET) Received: from [78.35.153.43] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.6.0) (envelope-from ) id 5c55ac10-01b0-7f0000012729-7f000001e9f2-1 for ; Sat, 02 Feb 2019 15:41:20 +0100 Received: from [192.168.178.68] (xdsl-78-35-153-43.nc.de [78.35.153.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA; Sat, 2 Feb 2019 15:41:19 +0100 (CET) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] Fix PR 88298 Message-ID: <486124b7-1df0-c772-4145-f0402b355438@netcologne.de> Date: Sat, 2 Feb 2019 15:41:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 Hi, the attached patch fixes a 7/8/9 regression where a conversion warning was emitted for DIM. The problem was that the no-warn flag had not been passed down to the arithmetic conversion routines, which is solved here by adding and using a flag in gfc_expr. Regression-tested. OK for affected branches? Regards Thomas 2019-02-02 Thomas Koenig PR fortran/88298 * 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 PR fortran/88298 * gfortran.dg/warn_conversion_10.f90: New test. Index: arith.c =================================================================== --- arith.c (Revision 268432) +++ arith.c (Arbeitskopie) @@ -2061,7 +2061,7 @@ gfc_int2int (gfc_expr *src, int kind) 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); Index: gfortran.h =================================================================== --- gfortran.h (Revision 268432) +++ gfortran.h (Arbeitskopie) @@ -2168,6 +2168,9 @@ typedef struct gfc_expr unsigned int do_not_resolve_again : 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 Index: intrinsic.c =================================================================== --- intrinsic.c (Revision 268432) +++ intrinsic.c (Arbeitskopie) @@ -5028,6 +5028,8 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespe if (ts->type == BT_UNKNOWN) goto bad; + expr->do_not_warn = ! wflag; + /* NULL and zero size arrays get their type here, unless they already have a typespec. */ if ((expr->expr_type == EXPR_NULL