[Bug fortran/54667] [OOP] gimplification failure with c_f_pointer
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Sep 22 08:55:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54667
--- Comment #2 from janus at gcc dot gnu.org 2012-09-22 08:53:51 UTC ---
The question is if it is really valid. At first sight both F03 and F08 only
specify that FPTR, i.e. the second argument to C_F_POINTER, shall be a pointer
with INTENT(OUT).
However, there are additional constraints depending on the actual value of
CPTR:
"(1) If the value of CPTR is the C address of an interoperable data
entity, FPTR shall be a data pointer with type and type parame-
ters interoperable with the type of the entity. ..."
"(2) If the value of CPTR is the result of a reference to C LOC with a
noninteroperable argument X, FPTR shall be a nonpolymorphic
scalar pointer with the same type and type parameters as X. ..."
While it would be nontrivial to fully enforce these constraints by a runtime
check, I think they might effectively mean that FPTR must not be polymorphic:
In the second case this constraint is spelled out explicitly, and the first
case demands that FPTR shall be interoperable. But polymorphic objects are by
definition not interoperable.
More information about the Gcc-bugs
mailing list