[Bug fortran/64397] [OOP] Runtime segfault with type-bound assignment and parenthesis

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 23 22:19:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64397

--- Comment #3 from janus at gcc dot gnu.org ---
Actually one can reduce it even further:


program main

  type :: my_integer
    real, allocatable :: x(:)
  end type
  type(my_integer) :: a

  a=my_integer([1])
  write (*,*) "A"
  call ass(a)
  write (*,*) "B"
  call ass((a))
  write (*,*) "C"

contains

  subroutine ass(b)
    class(my_integer), intent(in) :: b
    print *,'called ass'
  end subroutine

end


This program does not do anything useful any more, but it still shows the same
segfault at/after the call to "ass((a))":

$ ./a.out 
 A
 called ass
 B
 called ass

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.


Making 'b' a TYPE instead of a CLASS makes the error go away.



More information about the Gcc-bugs mailing list