public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47565] New: [4.6 Regression][OOP] Segfault with TBP
@ 2011-02-01  8:49 burnus at gcc dot gnu.org
  2011-02-01 13:01 ` [Bug fortran/47565] " janus at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-02-01  8:49 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: janus@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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-02 18:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-01  8:49 [Bug fortran/47565] New: [4.6 Regression][OOP] Segfault with TBP burnus at gcc dot gnu.org
2011-02-01 13:01 ` [Bug fortran/47565] " janus at gcc dot gnu.org
2011-02-01 13:39 ` janus at gcc dot gnu.org
2011-02-01 15:00 ` janus at gcc dot gnu.org
2011-02-01 15:01 ` janus at gcc dot gnu.org
2011-02-02 18:33 ` dnovillo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).