From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18188 invoked by alias); 6 Dec 2018 22:56:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 18139 invoked by uid 89); 6 Dec 2018 22:56:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=HTo:U*tkoenig, H*f:sk:a268303, prescribed, translatable 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; Thu, 06 Dec 2018 22:56:23 +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 wB6MuLk4014871 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 6 Dec 2018 14:56:21 -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 wB6MuKQI014870; Thu, 6 Dec 2018 14:56:20 -0800 (PST) (envelope-from sgk) Date: Thu, 06 Dec 2018 22:56:00 -0000 From: Steve Kargl To: Thomas Koenig Cc: Fritz Reese , fortran , gcc-patches Subject: Re: Fortran patches Message-ID: <20181206225620.GA14703@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20181205045945.GA40221@troutmask.apl.washington.edu> <20181206000315.GA47513@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2018-12/txt/msg00414.txt.bz2 On Thu, Dec 06, 2018 at 08:02:43PM +0100, Thomas Koenig wrote: > >>> PR fortran/88139 > >>> * dump-parse-tree.c (write_proc): Alternate return. > >> I dissent with this patch. The introduced error is meaningless and, as > >> mentioned by comment #3 in the PR, avoiding the ICE in dump-parse-tree > >> is not directly the issue. The code should be rejected in parsing. In > >> gcc-8.1 the invalid code is accepted (without an ICE) even without the > >> -fc-prototypes flag: I haven't finished building the compiler with > >> your changes yet to see whether that is still true afterwards, but at > >> least the test case doesn't try this, so I strongly suspect the patch > >> is incomplete to fix the PR. > > > > Comment #3 does not contain a patch to fix the problem elsewhere. > > I know :-) > > > In F2003, 15.2.6 "Interoperability of procedures and procedure interfaces", > > I cannot find a prohibition on an alternate return in a subroutine > > interface with BIND(C). > > I also does not allow this, and does not offer a valid interpretation > of what it should mean. > > If it has a meaning, it should be translatable into something prescribed > by the standard with -fc-prototypes. > > I have assigned the error to myself, so I will not forget to fix > it before the gcc 9 release. > I have asked on c.l.f. It seems NAG rejects alternate return mixed with bind(c). FortranFan provided a complete testcase: subroutine foo(*) bind(C, name='f') end subroutine foo program p interface subroutine bar(*) bind(C, name='f') end subroutine bar end interface call bar( *10 ) print *, "Return following 'bar' invocation: jumping to 20" go to 20 10 print *, "THIS IS UNEXPECTED: Alternate return to 10 after bar" 20 continue stop end program p NAG rejects it. Intel, PGI, and gfortran accept it. -- Steve