From patchwork Tue Jan 15 20:20:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Kargl X-Patchwork-Id: 1025436 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-494099-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=troutmask.apl.washington.edu Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="xza2BV0k"; 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 43fMDP4Qq2z9sBZ for ; Wed, 16 Jan 2019 07:21:08 +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:date :from:to:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=Aji4WQw5XNaniIfKOUbGfZ44PTRtkr5TgqleM3d1TJr 5sHycQCVbI7TIDeN33/B270NC1vsa98FdG36uQxRCF/4u8QWJYyYcxptKub75jYV RiH8KbDT84Ce3sbxcWVAxrYEy90e68PlooVLO/Fui1sCu741UOOJgoDzLpZr25L8 = 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:date :from:to:subject:message-id:reply-to:mime-version:content-type; s=default; bh=X/HGkA15gKNA8lRrlg1zgRgsnzc=; b=xza2BV0kIXbMGpm+m 6OaPkGA5CuyzWjA0EGFxbK82izelr/q2xxOaxvJn/zkIP1KUGRzQu1+M5WsOS6wA /Y+Mz+hgybycQwTT+dBLoyPYjPoXPVnMv+AZoJiAsR6vnFSlScGV9Gqg6w7ZjYun ctA149KAdbJdeMIcB9YjvemXaU= Received: (qmail 23931 invoked by alias); 15 Jan 2019 20:21:01 -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 23903 invoked by uid 89); 15 Jan 2019 20:21:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=H*MI:edu, gfc_symbol, attr.function, UD:function X-HELO: troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Jan 2019 20:20:59 +0000 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id x0FKKvhI029839 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 15 Jan 2019 12:20:57 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id x0FKKv1g029838; Tue, 15 Jan 2019 12:20:57 -0800 (PST) (envelope-from sgk) Date: Tue, 15 Jan 2019 12:20:57 -0800 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [Committed] PR fortran/81849 -- Host associated vaiables in RESULT spec Message-ID: <20190115202057.GA29797@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) I've committed the following patch as obvious. 2019-01-15 Steven G. Kargl PR fortran/81849 * resolve.c (resolve_symbol): Host associated varaibles can appear in the specification statement of a RESULT array. 2019-01-15 Steven G. Kargl PR fortran/81849 * gfortran.dg/pr81849.f90: New test. Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 267945) +++ gcc/fortran/resolve.c (working copy) @@ -15345,7 +15345,7 @@ resolve_symbol (gfc_symbol *sym) /* Set the formal_arg_flag so that check_conflict will not throw an error for host associated variables in the specification expression for an array_valued function. */ - if (sym->attr.function && sym->as) + if ((sym->attr.function || sym->attr.result) && sym->as) formal_arg_flag = true; saved_specification_expr = specification_expr; Index: gcc/testsuite/gfortran.dg/pr81849.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr81849.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr81849.f90 (working copy) @@ -0,0 +1,16 @@ +! { dg-do run } +! PR fortran/81849 +program p + implicit none + integer :: n=3 + if (any(g() /= f())) stop 1 + contains + function g() + real g(n) + g = 7 + end function g + function f() result(r) + real r(n) + r = 7 + end function f +end program