From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 934 invoked by alias); 21 Dec 2014 14:14: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 890 invoked by uid 48); 21 Dec 2014 14:14:45 -0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/60357] [F08] structure constructor with unspecified values for allocatable components Date: Sun, 21 Dec 2014 14:14: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: 4.9.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: dominiq at lps dot ens.fr X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: janus at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: 2014-12/txt/msg02503.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60357 --- Comment #5 from Dominique d'Humieres --- The patch in comment 2 needs to be update to --- ../_clean/gcc/fortran/primary.c 2014-12-16 22:27:14.000000000 +0100 +++ gcc/fortran/primary.c 2014-12-21 14:50:53.000000000 +0100 @@ -2367,6 +2367,13 @@ build_actual_constructor (gfc_structure_ return false; value = gfc_copy_expr (comp->initializer); } + else if (comp->attr.allocatable) + { + if (!gfc_notify_std (GFC_STD_F2008, "No initializer for " + "allocatable component '%s' given in the structure " + "constructor at %C", comp->name)) + return false; + } else if (!comp->attr.deferred_parameter) { gfc_error ("No initializer for component %qs given in the" Note that while program testerprog use testmod Type(A) :: Me allocate(Me%y) Me = A(X=1, y=2) print *, Me%y end program gives Program received signal SIGSEGV: Segmentation fault - invalid memory reference. program testerprog use testmod Type(A) :: Me Me = A(X=1, y=2) print *, Me%x, Me%y end program gives 1 2 i.e., 'allocate(Me%y)' conflicts with Me = A(X=1, y=2). May be this expected.