From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14570 invoked by alias); 9 Jan 2013 09:44:28 -0000 Received: (qmail 12992 invoked by uid 48); 9 Jan 2013 09:44:08 -0000 From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/54286] [4.8 Regression] Accepts invalid proc-pointer assignments involving proc-ptr function result Date: Wed, 09 Jan 2013 09:44: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-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: pault at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: pault at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2013-01/txt/msg00747.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54286 --- Comment #3 from Paul Thomas 2013-01-09 09:44:07 UTC --- Please find below my interpretation of the validity or not of the testcase for this PR. > The following test is probably invalid, but not rejected by recent trunk > versions: > > > type :: t > procedure(a), pointer, nopass :: p > end type > > type(t) :: x > procedure(iabs), pointer :: pp > > x%p => a ! ok [A] I believe that this is invalid because the interfaces do not match procedure(iabs), pointer => integer pointer procedure (integer formal) It strikes me as being a moot point as to whetehr or not the processor is required to report it though, on the gorunds that "anything goes" with pointers! That said, the interface check is easy to implement. > x%p => a(1) ! invalid, but not rejected by 4.8 [B] This is valid: procedure(iabs), pointer => pointer to integer procedure(iabs) It has the pleasing property of providing the correct result for print *, x%p(-99) .eq. iabs(-99) > > pp => a(2) ! ok [B] applies - it also gives the correct result. > pp => a ! invalid, but not rejected by 4.8 [A] applies - invalid. > > contains > > function a (c) result (b) > integer, intent(in) :: c > procedure(iabs), pointer :: b > b => iabs > end function > > end Interestingly, both invalid lines run and provide results that are consistent with INT (loc (iabs)) :-) Paul