From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27484 invoked by alias); 18 Oct 2011 07:23:44 -0000 Received: (qmail 27467 invoked by uid 22791); 18 Oct 2011 07:23:42 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_TM 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; Tue, 18 Oct 2011 07:23:28 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/50410] [4.6/4.7 Regression] ICE in record_reference Date: Tue, 18 Oct 2011 07:23: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: ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.2 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: 2011-10/txt/msg01743.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50410 --- Comment #9 from Tobias Burnus 2011-10-18 07:23:10 UTC --- >>From the standard: "C568 (R536) A data-i-do-object or a variable that appears as a data-stmt-object shall not be an object designator in which a pointer appears other than as the entire rightmost part-ref." "C567 (R536) A variable whose designator appears as a data-stmt-object or a data-i-do-object shall not be a dummy argument, accessed by use or host association, in a named common block unless the DATA statement is in a block data program unit, in blank common, a function name, a function result name, an automatic object, or an allocatable variable." To be fixed beyond the patch of attachment 25534 * ICE below (1) for init of DT with default init * ICE below (2) with structure constructor, which initializes a pointer (plus: test cases, revised error message wording) * (3) Pointer init in DATA: Also "initial-data-target" is allowed For the pointer init, see also PR 45290. ! =============== (1) ======================= module m type t integer :: a = 7 end type t type t2 integer :: b end type t2 end module m use m implicit type(t)(x), type(t2)(y) ! ICE in trans: ! Invalid as "nonpointer object has default initialization" DATA x%a/8/ ! OK: !DATA y%b/5/ !type(t2) :: y = t2(7) ! { dg-error "initializer already appears in a DATA statement" } end ! ============= (2) ========================= module m type t integer :: a integer, pointer :: bar end type t end module m subroutine test() use m type(t) :: x ! = t(4, null()) ! OK DATA x/t(4, null())/ ! ICE in the middle end end subroutine test ! ============= (3) ========================= type t integer, pointer :: ptr end type t integer, target, save :: tgt ! Version A: !type(t) :: x = t(tgt) ! Rejected with "has not been declared or is a variable, ! which does not reduce to a constant expression" ! Version 2 type(t) :: x DATA x%ptr /tgt/ ! error "must be a PARAMETER in DATA statement" tgt = 7 print *, ptr end