From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10292 invoked by alias); 15 Dec 2012 16:27:36 -0000 Received: (qmail 10053 invoked by uid 48); 15 Dec 2012 16:27:14 -0000 From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/53876] [4.8 Regression] [OOP] ICE with class array Date: Sat, 15 Dec 2012 16:27: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: X-Bugzilla-Severity: normal X-Bugzilla-Who: pault at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: pault at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: CC AssignedTo 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/msg01567.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53876 Paul Thomas changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org AssignedTo|unassigned at gcc dot |pault at gcc dot gnu.org |gnu.org | --- Comment #4 from Paul Thomas 2012-12-15 16:27:12 UTC --- Tobias, Your analysis is completely correct. > > /* Set the data. */ > ctree = gfc_class_data_get (var); Inserting parmse->expr = fold_convert (TREE_TYPE (ctree), parmse->expr); before this line fixes the problem. > gfc_add_modify (&parmse->pre, ctree, parmse->expr); > > ....snip... > The problem is that the LHS and the RHS have a different type. Both are > pointers to a record_type, which contains "genes" (type "array1_real(kind=4)") > as component. > > However, the decl for both the record type and the "genes" type is different > (only their respective canonical type is the same). which is why the above works. > I wonder whether it has something to do with restricted and not. (See also PR > 45586). Though, as marking all variables as TARGET doesn't help, I might also > be off track. I will try to understand why the regression occurred. However, the above fix is perfectly OK. The testcase of comment 2 works with the above. The original needs a call to the constructor before the assignment in the main program to avoid the runtime fault. After I have got the unlimited polymorphic patch out of the way, I will submit this fix (my tree is too poluted right no :-) ) Cheers Paul