From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16302 invoked by alias); 3 Dec 2013 23:03:50 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 16235 invoked by uid 48); 3 Dec 2013 23:03:47 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/58099] [4.8/4.9 Regression] [F03] over-zealous procedure-pointer error checking Date: Tue, 03 Dec 2013 23:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: janus at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg00238.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58099 --- Comment #27 from Tobias Burnus --- (In reply to Tobias Burnus from comment #26) > A: "The specific intrinsic procedure itself retains the elemental property > (so a reference using its own name can be elemental), but the dummy > procedure or procedure pointer associated with it is not elemental and so > cannot be used to reference the specific intrinsic procedure elementally." Thus, the following code is invalid: interface elemental real function x(y) ! Valid external procedure real, intent(in) :: y end function x end interface ! pointer :: x ! < comment aside: this proc-ptr would violate C1218 intrinsic :: sin call foo(sin) contains subroutine foo(z) procedure(x) :: z ! INVALID per C1218 ! procedure(sin) :: z ! Valid - but not elemental ... print *, z([1.,2.,3.]) ! ... hence this invalid too for "procedure(sin)::z" end subroutine foo end See also: "12.5.2.9 Actual arguments associated with dummy procedure entities [...] If the interface of a dummy procedure is explicit, its characteristics as a procedure (12.3.1) shall be the same as those of its effective argument, except that a pure effective argument may be associated with a dummy argument that is not pure and an elemental intrinsic actual procedure may be associated with a dummy procedure (which cannot be elemental)." [The parenthesis is a consequence of C1218, see comment 26 for the quote.] Thus: * I think we need a check for elemental as dummy argument and reject it * For the patch (comment 18), I wonder whether whether one should leave out the "elemental" assignment and just do the "pure" assignment.