From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22517 invoked by alias); 18 Dec 2011 16:57:53 -0000 Received: (qmail 22504 invoked by uid 22791); 18 Dec 2011 16:57:52 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Dec 2011 16:57:38 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/51610] New: [OOP] Class container does not properly handle POINTER and TARGET Date: Sun, 18 Dec 2011 18:34:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: accepts-invalid, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: 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: 2011-12/txt/msg02003.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51610 Bug #: 51610 Summary: [OOP] Class container does not properly handle POINTER and TARGET Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: accepts-invalid, rejects-valid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org CC: janus@gcc.gnu.org, pault@gcc.gnu.org Blocks: 51605 The following program compiles - but it is invalid. 1. The TARGET attribute is required for "b" and "c" But if one tries to set it, one gets an error. Expected: One can mark them as TARGET and without one gets an error for the CALL. 2. The "ptr => x" is invalid as "x" is not TARGET but no error is printed. 3. If one swaps the "x" and the "z" lines, one gets the error: ptr => x 1 Error: Non-POINTER in pointer association context (pointer assignment) But one get also an error for the "ptr => y" and "ptr => z" lines. Related is PR 51605: SELECT TYPE's associate-name needs to set TARGET attribute type t end type t class(t), allocatable :: a(:), b(:), c(:) ! Bogus error: Error: Duplicate TARGET attribute specified ! target :: a, b, c allocate (a(1), b(1), c(1)) ! Requires: TARGET attribute - call test(a, b, c) ! possibly not correctly diagnosed contains subroutine test(x, y, z) class(t), pointer, intent(in) :: z(:) class(t), target :: y(3) class(t) :: x(3) class(t), pointer :: ptr(:) ptr => x ! Invalid: "x" is not a TARGET ptr => y ! Valid: "x" is a TARGET ptr => z ! Valid: "z" is a POINTER end subroutine end