http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47565
Summary: [4.6 Regression][OOP] Segfault with TBP Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org CC: ja...@gcc.gnu.org Follow up to bug 47455 comment 4. The following program works with gfortran 4.5 but with gfortran 4.6 it segfaults at run time at the marked line. Using a normal function call instead of a TBP call works as well. ==20391== Jump to the invalid address stated on the next line ==20391== at 0x0: ??? ==20391== by 0x400C49: MAIN__ (444.f90:27) ==20391== by 0x400C7F: main (444.f90:25) The dump shows the following difference between working and failing: - this->_data->y = *find_y (); + this->_data->y = *this->_vptr->find_y (); If one compares this with a working call and POINTER attribute (cf. attachment 23130 to bug 47455 comment 4), one sees: ! Working: this->_data->x = this->_vptr->find_x (...) ! Failing: this->_data->y = *this->_vptr->find_y (...) Note the extra "*". module class_t type :: tx integer, dimension(:), allocatable :: i end type tx type :: t type(tx) :: y contains procedure :: calc procedure, nopass :: find_y end type t contains subroutine calc(this) class(t) :: this ! WORKS: ! this%y = find_y() ! Segfaults: this%y = this%find_y() ! Segfault at run time print *, allocated(this%y%i) end subroutine calc function find_y() result(res) type(tx), allocatable :: res allocate(res) end function find_y end module class_t use class_t type(t) :: x call x%calc() end