From patchwork Sat Dec 3 09:35:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janus Weil X-Patchwork-Id: 702290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3tW5W92zJfz9t0t for ; Sat, 3 Dec 2016 20:36:18 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ZhFeIhn5"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; q=dns; s=default; b=v2QINQudPRg8KuxI2j vIc0zBHU7u39iixNJdDCF9zVCix0ahmxKRTnlNmdpViwCv70Ut0IY0vNBkAk9sn7 pm8PelpSwUd4GR8NYX5Zf4RcuD/PjPpGADtfwe/yey/b6QTyDs1kwiTtWROlP7LV aBqrlKqbUxpcUf3whugn9sQlo= 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 :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; s=default; bh=nfWnkUNNyFfyoH9ZFjgVw01l i7s=; b=ZhFeIhn5F1IFgCgHK284Wp1768zE7Magp/CmhbSEFlsAKfr4MJWix7dG vWawkS41HG3fdsPwBXHqn08YpoP4gqHvH/vQgG4wzc70S6gXelyAOfuudBGVFF2O TXeFxrQkixX61W0MF1c91K0R+zaEYjyZl6RsDbC2MX48Mhj/EdE= Received: (qmail 23828 invoked by alias); 3 Dec 2016 09:36:08 -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 23763 invoked by uid 89); 3 Dec 2016 09:36:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:2111, HX-Received:Sat, surely X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-yw0-f180.google.com Received: from mail-yw0-f180.google.com (HELO mail-yw0-f180.google.com) (209.85.161.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 03 Dec 2016 09:35:57 +0000 Received: by mail-yw0-f180.google.com with SMTP id r204so230813867ywb.0; Sat, 03 Dec 2016 01:35:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=CsczRUFNJVIFBewxlEjaAGKRHxbiDZRvS1hyXvd7VYY=; b=X7McZUq5RLIY9qETHpKz6B+VTr/elzUnyEHn7ujJbsELLS929ZkzZ24IWHlwIjBgyU 3KQZKEN9jX4bsqIIKut5L74awoqIZaqY3MhcHfuOPxO2d0kZc+Si2JOagroR+bLLJq4f oXeWrA6nSkrV03kd672hJTBXsFODcjjOS/lgfLoYuHThKjUknP57yWdQUR7lCbDkbIT/ g5MdMB9Tpld8wqUa5EkFfc50CJhG2USNndRlF1bar/yBObFGHbkcpyU+uJqk6LSU9WKU wwyXbKBbnd28IZWP4TxLL43BuZy0m7BZ0dRLS5ycWE1+ELv804vMo3a3D74IF4hbAnOP nScw== X-Gm-Message-State: AKaTC00WRqRYdoFJMvEYQ7THVx4AYU5R8XK1BA7XYvR5C/JlQYnFrYD4+35BwjhBxxt2zZKlrz1OWqyb6Z740Q== X-Received: by 10.129.57.86 with SMTP id g83mr46647181ywa.247.1480757756006; Sat, 03 Dec 2016 01:35:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.51.145 with HTTP; Sat, 3 Dec 2016 01:35:55 -0800 (PST) In-Reply-To: References: From: Janus Weil Date: Sat, 3 Dec 2016 10:35:55 +0100 Message-ID: Subject: Re: [Patch, Fortran, OOP] PR 58175: Incorrect warning message on scalar finalizer To: gfortran , gcc-patches I have just committed as obvious a minor addition here: https://gcc.gnu.org/viewcvs?rev=243218&root=gcc&view=rev It deals with an extended test case that was only reported after the initial fix. Cheers, Janus 2016-11-29 15:16 GMT+01:00 Janus Weil : > Committed as r242960. > > > > 2016-11-28 14:36 GMT+01:00 Janus Weil : >> Hi all, >> >> the attached patch was posted on bugzilla by Tobias three years ago, >> but left unattended since then. It is simple, works well (fixing a >> bogus warning) and regtests cleanly on x86_64-linux-gnu. >> >> If no one objects, I will commit this to trunk by tomorrow. >> >> Cheers, >> Janus >> >> >> >> 2016-11-28 Tobias Burnus >> >> PR fortran/58175 >> * resolve.c (gfc_resolve_finalizers): Properly detect scalar finalizers. >> >> 2016-11-28 Janus Weil >> >> PR fortran/58175 >> * gfortran.dg/finalize_30.f90: New test case. Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 243217) +++ gcc/fortran/resolve.c (working copy) @@ -12517,7 +12517,7 @@ error: /* Warn if we haven't seen a scalar finalizer procedure (but we know there were nodes in the list, must have been for arrays. It is surely a good idea to have a scalar version there if there's something to finalize. */ - if (warn_surprising && result && !seen_scalar) + if (warn_surprising && derived->f2k_derived->finalizers && !seen_scalar) gfc_warning (OPT_Wsurprising, "Only array FINAL procedures declared for derived type %qs" " defined at %L, suggest also scalar one", Index: gcc/testsuite/gfortran.dg/finalize_30.f90 =================================================================== --- gcc/testsuite/gfortran.dg/finalize_30.f90 (revision 243217) +++ gcc/testsuite/gfortran.dg/finalize_30.f90 (working copy) @@ -10,6 +10,8 @@ module ct contains final :: aD end type + type, extends(a) :: a1 + end type contains subroutine aD(self) type(a), intent(inout) :: self