From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22483 invoked by alias); 28 Dec 2012 21:53:57 -0000 Received: (qmail 22449 invoked by uid 48); 28 Dec 2012 21:53:39 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/55825] [OOP] Bogus rank error with CLASS pointer assignment using structure constructors Date: Fri, 28 Dec 2012 21:53: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: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: 2012-12/txt/msg02409.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55825 --- Comment #5 from janus at gcc dot gnu.org 2012-12-28 21:53:38 UTC --- There are problems with handling CLASS components in gfc_trans_subcomponent_assign: Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (revision 194743) +++ gcc/fortran/trans-expr.c (working copy) @@ -5934,11 +5934,14 @@ gfc_trans_subcomponent_assign (tree dest, gfc_comp gfc_start_block (&block); - if (cm->attr.pointer || cm->attr.proc_pointer) + if (cm->attr.pointer || cm->attr.proc_pointer + || (cm->ts.type == BT_CLASS && CLASS_DATA (cm)->attr.pointer)) { gfc_init_se (&se, NULL); /* Pointer component. */ - if (cm->attr.dimension && !cm->attr.proc_pointer) + if ((cm->attr.dimension + || (cm->ts.type == BT_CLASS && CLASS_DATA (cm)->attr.dimension)) + && !cm->attr.proc_pointer) { /* Array pointer. */ if (expr->expr_type == EXPR_NULL) However, this is not enough. The test case still gives an ICE.