From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12676 invoked by alias); 1 Feb 2011 13:01:01 -0000 Received: (qmail 12665 invoked by uid 22791); 1 Feb 2011 13:01:00 -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, 01 Feb 2011 13:00:56 +0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47565] [4.6 Regression][OOP] Segfault with TBP X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran 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-Changed-Fields: Status Last reconfirmed Ever Confirmed 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: Tue, 01 Feb 2011 13:01: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-02/txt/msg00074.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47565 janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2011.02.01 13:00:47 Ever Confirmed|0 |1 --- Comment #1 from janus at gcc dot gnu.org 2011-02-01 13:00:47 UTC --- Modified test case: module class_t contains function find_y() result(res) integer, allocatable :: res print *,"find_y" allocate(res) end function end module program p use class_t type :: t procedure(find_y), pointer, nopass :: ppc contains procedure, nopass :: find_y end type class(t), allocatable :: this integer :: y allocate(this) this%ppc => find_y ! (1) ordinary procedure (works) y = find_y() print *, y ! (2) procedure pointer component (works) y = this%ppc() print *, y ! (3) type-bound procedure (fails) y = this%find_y() ! segfault at run time print *, y end This shows that the PPC call also works nicely, while the TBP does not. The dump for all three calls looks ok: y = *find_y (); y = *this._data->ppc (); y = *this._vptr->find_y (); The problem seems to be that the initialization for the TBP is missing in the vtab: static struct __vtype_p_T __vtab_p_T = {._hash=31520549, ._size=8, ._extends=0B, ._def_init=&__def_init_p_T, ._copy=__copy_p_T}; When removing the allocatable attribute of 'find_y', one correctly gets: static struct __vtype_p_T __vtab_p_T = {._hash=31520549, ._size=8, ._extends=0B, ._def_init=&__def_init_p_T, ._copy=__copy_p_T, .find_y=find_y};