From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10348 invoked by alias); 21 May 2011 20:33:32 -0000 Received: (qmail 10338 invoked by uid 22791); 21 May 2011 20:33:31 -0000 X-SWARE-Spam-Status: No, hits=-2.7 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; Sat, 21 May 2011 20:33:18 +0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/48699] [4.6/4.7 Regression] [OOP] MOVE_ALLOC inside SELECT TYPE 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: janus at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: janus 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 Date: Sat, 21 May 2011 20:57:00 -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 X-SW-Source: 2011-05/txt/msg01883.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48699 --- Comment #11 from janus at gcc dot gnu.org 2011-05-21 20:09:07 UTC --- (In reply to comment #9) > program testmv1 > > type bar > end type > > type, extends(bar) :: bar2 > end type > > class(bar), allocatable :: sm > type(bar2), allocatable :: sm2 > > allocate(sm2) > call move_alloc(sm2,sm) > > end program > > > /tmp/ccSfRlZ5.o:(.data+0x38): undefined reference to `__copy_testmv1_Bar2.1582' The problem here simply is that the vtab is constructed too late (only at translation stage), so that the __copy routine is never generated. The following obvious patch fixes it: Index: gcc/fortran/check.c =================================================================== --- gcc/fortran/check.c (Revision 174000) +++ gcc/fortran/check.c (Arbeitskopie) @@ -2588,6 +2588,10 @@ gfc_check_move_alloc (gfc_expr *from, gfc_expr *to return FAILURE; } + /* Make sure the vtab is present. */ + if (to->ts.type == BT_CLASS) + gfc_find_derived_vtab (from->ts.u.derived); + return SUCCESS; }