From patchwork Mon Aug 20 18:50:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 178915 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]) by ozlabs.org (Postfix) with SMTP id 1B6B62C00A6 for ; Tue, 21 Aug 2012 04:50:35 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1346093436; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=hmzRKhaVbkLgB6H7uCAj hXQlkj0=; b=YOb6srnU1GObmoWSs72DyadYd2pcu1feuuDICeWwAF5AweDfDqSy NlOTtP51UnTTtfw1zKLR4P+ljEQCyIMBC3A740qMRKFuZwfkMNCYD5JgCJz7pE1k rKP8E2DO3AncRKYpwWD+MYT74hL32phrd2xii5Dp5woH1ys9tYxDhrE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Tz1zhuuULMYfhlMkAkndbY0gEjcxLpLvR090RugqQAh97PkXWmWflf9q/GApYo kCTe84aEFlGWoAY/NAXUVSLBhC4od9fYqa1MGMYHgyGaccRv5S1XBe+NPCUqShwx OhZY9NqSPAPUYASbdIXlqU7BvXeccNX31v60d3PzXac+M=; Received: (qmail 9631 invoked by alias); 20 Aug 2012 18:50:26 -0000 Received: (qmail 9613 invoked by uid 22791); 20 Aug 2012 18:50:24 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Aug 2012 18:50:09 +0000 Received: from [192.168.178.22] (port-92-204-67-8.dynamic.qsc.de [92.204.67.8]) by mx01.qsc.de (Postfix) with ESMTP id 8022A3CC83; Mon, 20 Aug 2012 20:50:07 +0200 (CEST) Message-ID: <503286DF.7080203@net-b.de> Date: Mon, 20 Aug 2012 20:50:07 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Thomas Koenig CC: fortran@gcc.gnu.org, gcc-patches Subject: Re: [Patch, Fortran] PR54301 - add warning for pointer might outlive its target References: <50311112.3060908@net-b.de> <50313C4B.4040801@netcologne.de> <50313E08.6070600@net-b.de> <503161AB.4090802@netcologne.de> <5031CFBC.5020306@net-b.de> <50327927.5050206@netcologne.de> In-Reply-To: <50327927.5050206@netcologne.de> 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 Hi Thomas, Thomas Koenig wrote: > do you think that -Wtarget-lifetime should be included with -Wall? > I think so, because the code flagged is certainly invalid, and likely > to cause random errors. I concur. However, that's what the current version in the trunk does: -Wall implies -Wtarget-lifetime. On the other hand, I just realized that "attr.result" is not set if the function symbols is also its result symbol – hence, there is no warning for: function f() integer, pointer :: f integer, target :: t f => t end I think the following patch will fix that. I will package, regtest and commit it later. Tobias || lvalue->symtree->n.sym->attr.in_common; --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3673,6 +3673,7 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue) warn = lvalue->symtree->n.sym->attr.dummy || lvalue->symtree->n.sym->attr.result + || lvalue->symtree->n.sym->attr.function || lvalue->symtree->n.sym->attr.host_assoc || lvalue->symtree->n.sym->attr.use_assoc