From patchwork Sun Nov 10 21:26:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Blomqvist X-Patchwork-Id: 1192673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-512906-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="pVMxW664"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iI/C+WfT"; 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 47B6Xh1XwCz9sNx for ; Mon, 11 Nov 2019 08:27:13 +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:from :to:cc:subject:date:message-id; q=dns; s=default; b=gc1hKrWm7LN8 VE9UrGD2/Po1jzKf8cV/iNuW+XrfNJhBJGJDb7tmI8X9oJfiDa72uxif7HeSCOh/ 1im99j8DpyvKr+FMhDzPLrIM6GDBXsNC6MG/Mt2nYU0jocsNJ+X8aVnmM2LO1Pt7 sRsdUVUvh9GNU2mK82MPZNxi+fcT258= 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:from :to:cc:subject:date:message-id; s=default; bh=zUAiAlvldObyjcZ6mx +jS0Ubphw=; b=pVMxW664eU6XDDAzadPsd/mfdXd4/1O/cujIh0UQic/b2ZMIHp nXOUUrCQy6k99XtPWIm+nFHcdD4seKG2jGJ2001fDCc1y2saaiHFO4/Xgnxh7RF4 B08XRvEOciArks97Efgc4c0ac9sO/uVcVKvbhdStFO62UxcwA/LXfBVW8= Received: (qmail 106020 invoked by alias); 10 Nov 2019 21:27:02 -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 105997 invoked by uid 89); 10 Nov 2019 21:27:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=gfc_warning, opt_wsurprising, OPT_Wsurprising X-HELO: mail-lf1-f50.google.com Received: from mail-lf1-f50.google.com (HELO mail-lf1-f50.google.com) (209.85.167.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 10 Nov 2019 21:27:00 +0000 Received: by mail-lf1-f50.google.com with SMTP id z24so5346383lfh.6; Sun, 10 Nov 2019 13:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=eg/seHAB3GD4o4lVDcADs72C5oKjn8vJ9pMsNUoPCFE=; b=iI/C+WfTAGFVgxM4wAsugu6jUHVbEfzfjxov7ij1MsI6TshO5+3Xczhz3XkUIrt2K6 IMx7I+ApPk2vnolloTsovS1LN9sfejsxw1rqS7otkwiG7cTKEq+pKiqnbtEUyg3uzUyU NZd1/xZqBLSu0EtVlRIjcxnVq9H+jqA1Nq715KJa52vwoKF3QojL+4MMHUusPf6xHaYn TbC4gObxzMwxMS1la01FzRS2vUlaZLGPHbWJCCB9gNhjIrWTE4BIDxNlh8cu899UkuAQ /PZwXRiadVknZwH1Om5cxtc9wYsLeGHPgMn0y9TY548fsMj+n/YgmM8pLOup+E3A46Fl hPtg== Received: from ws.lan (88-114-247-254.elisa-laajakaista.fi. [88.114.247.254]) by smtp.gmail.com with ESMTPSA id t13sm2988589ljo.70.2019.11.10.13.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Nov 2019 13:26:56 -0800 (PST) From: Janne Blomqvist To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Janne Blomqvist Subject: [PATCH, committed] Don't print warning when moving to static with -fno-automatic Date: Sun, 10 Nov 2019 23:26:50 +0200 Message-Id: <20191110212650.2710-1-blomqvist.janne@gmail.com> As part of PR 91413, GFortran now prints a warning when a variable is moved from the stack to static storage. However, when the user explicitly specifies that all local variables should be put in static storage with the -fno-automatic option, don't print this warning. Regtested on x86_64-pc-linux-gnu, committed r278027 as obvious. gcc/fortran/ChangeLog: 2019-11-10 Janne Blomqvist PR fortran/91413 * trans-decl.c (gfc_finish_var_decl): Don't print warning when -fno-automatic is enabled. --- gcc/fortran/trans-decl.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index ffa61111316..76e1c7a8453 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -746,15 +746,16 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) || sym->attr.allocatable) && !DECL_ARTIFICIAL (decl)) { - gfc_warning (OPT_Wsurprising, - "Array %qs at %L is larger than limit set by" - " %<-fmax-stack-var-size=%>, moved from stack to static" - " storage. This makes the procedure unsafe when called" - " recursively, or concurrently from multiple threads." - " Consider using %<-frecursive%>, or increase the" - " %<-fmax-stack-var-size=%> limit, or change the code to" - " use an ALLOCATABLE array.", - sym->name, &sym->declared_at); + if (flag_max_stack_var_size > 0) + gfc_warning (OPT_Wsurprising, + "Array %qs at %L is larger than limit set by" + " %<-fmax-stack-var-size=%>, moved from stack to static" + " storage. This makes the procedure unsafe when called" + " recursively, or concurrently from multiple threads." + " Consider using %<-frecursive%>, or increase the" + " %<-fmax-stack-var-size=%> limit, or change the code to" + " use an ALLOCATABLE array.", + sym->name, &sym->declared_at); TREE_STATIC (decl) = 1;