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};