From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21307 invoked by alias); 24 Jan 2012 15:28:27 -0000 Received: (qmail 21299 invoked by uid 22791); 24 Jan 2012 15:28:26 -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; Tue, 24 Jan 2012 15:28:13 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/51970] [OOP] gimplification failed for polymorphic MOVE_ALLOC Date: Tue, 24 Jan 2012 16:03: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-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus 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-01/txt/msg02803.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51970 --- Comment #3 from Tobias Burnus 2012-01-24 15:27:43 UTC --- Created attachment 26443 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26443 Draft patch for trans-intrinsic.c There are two issues: a) from_expr->rank *and* to_expr->rank are 0 instead of 1. That's a variant of the issue of PR 51977. b) trans-intrinsic.c's conv_move_alloc does not properly handle polymorphic arrays. For (b) a draft patch is attached. TODO: Regtest it, try combinations of TYPE and CLASS, try CLASS with allocatable components - and CLASS components. To use it, you need to either fix issue (a) or you can try the following hack: --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -2726,0 +2727,5 @@ gfc_check_move_alloc (gfc_expr *from, gfc_expr *to) + /* THIS IS A HACK! */ + if (from->ts.type == BT_CLASS && CLASS_DATA (from)->attr.dimension) + from->rank = CLASS_DATA (from)->as->rank; + if (to->ts.type == BT_CLASS && CLASS_DATA (to)->attr.dimension) + to->rank = CLASS_DATA (to)->as->rank;