From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3062 invoked by alias); 20 Aug 2013 13:07:24 -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 3046 invoked by uid 48); 20 Aug 2013 13:07:23 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/57590] [OOP] wrong code with class variables of different shapes Date: Tue, 20 Aug 2013 13:07: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: wrong-code 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-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: 2013-08/txt/msg01036.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57590 --- Comment #4 from janus at gcc dot gnu.org --- (In reply to janus from comment #3) > I think in general it's ok to use the same class container type for all of > them, but we should not fix the array spec of the _data component at compile > time (but use something like AS_ASSUMED_SHAPE instead?). In fact the following simple patch makes the test case produce the expected output: Index: gcc/fortran/class.c =================================================================== --- gcc/fortran/class.c (revision 201871) +++ gcc/fortran/class.c (working copy) @@ -637,6 +637,8 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_a c->attr.codimension = attr->codimension; c->attr.abstract = fclass->attr.abstract; c->as = (*as); + if (c->as->type == AS_EXPLICIT) + c->as->type = AS_ASSUMED_SHAPE; c->initializer = NULL; /* Add component '_vptr'. */ Will check if this survives a regtest.