This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/47240] segfault with procedure pointer component


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |janus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-10 09:10:34 UTC ---
Seemingly the TREE generation does not honor that "coefficients%tfunc1(1)%p" is
a pointer.

If one has:

  subroutine evaluate_tensor_coefficient (tfunc, ...
    procedure (dum_tfunc) :: tfunc

Using
  call evaluate_tensor_coefficient (dum_tfunc, ... )
works while
  call evaluate_tensor_coefficient (coefficients%tfunc1(1)%p, ...)
fails.

However, if one make the dummy argument a POINTER, it works:
  subroutine evaluate_tensor_coefficient (tfunc, ...
    procedure (dum_tfunc), POINTER :: tfunc
when calling
  call evaluate_tensor_coefficient (coefficients%tfunc1(1)%p, ...)


One also sees this if one looks at the dump:

(*(struct tfunc_p[0:] * restrict)
coefficients.tfunc1.data)[coefficients.tfunc1.offset + 1].p = dum_tfunc;

Assigns the address of "dum_tfunc" to the function pointer
"coefficients%tfunc1(1)%p"

but in the call the again the address is taken - rather than passing the
pointer as is - the first "&" should only appear if the argument is a function
pointer and not just a function.

    evaluate_tensor_coefficient (&(*(struct tfunc_p[0:] * restrict)
coefficients->tfunc1.data)[coefficients->tfunc1.offset + 1].p, &parm.17);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]