[Bug fortran/47240] [F03] segfault with procedure pointer component

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 10 20:34:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47240

--- Comment #3 from janus at gcc dot gnu.org 2011-01-10 20:27:29 UTC ---
Reduced test case:

  type t
    procedure (fun), pointer, nopass :: p
  end type
  type(t) :: x
  x%p => fun
  print *, evaluate (x%p)
contains
  real function fun ()
    fun = 0
  end function
  real function evaluate ( dummy )
    procedure(fun) :: dummy
    evaluate = dummy ()
  end function
end

Like the original test case, this gives a segfault at runtime. Looking at the
dump, the wrong part is

      D.1540 = evaluate (&x.p);

We should not take the address of x.p here, but just pass it as is.



More information about the Gcc-bugs mailing list