This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47240] segfault with procedure pointer component
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 10 Jan 2011 09:10:36 +0000
- Subject: [Bug fortran/47240] segfault with procedure pointer component
- Auto-submitted: auto-generated
- References: <bug-47240-4@http.gcc.gnu.org/bugzilla/>
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);