[Bug fortran/57843] Polymorphic assignment for derived type is resolved with parent's generic instead of its own
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 8 17:00:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57843
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to John from comment #0)
> The code below does not do what's expected when compiled with gfortran-4.9
> (i.e., to print "this is right" instead of "what am I doing here?" every
> time the polymorphic assignment is invoked, and also printing the assigned
> values at the end, instead of the default ones.
I get the same result with Cray's ftn 8.1.8. (Except that it prints "1 @� 0,
0." at the end - instead of "1 0 0.00000000"; that's most likely uninitialized
memory, possibly a bug in the crayftn compiler [or something else].)
> Maybe I still don't understand the semantics behind Fortran 2003+'s
> type-bound assignment (so I apologize in advance if this is not a bug), but
> it seems to me that the assign_itemType procedure is being used for
> assignment, even though it doesn't satisfy the requirement of exact type for
> the "right" argument ---is polymorphism being resolved at compile time even
> for dynamic cases?
I believe the generic resolution (assignment, operator but also "generic") is
done at the compile time - which gives type bound procedure ("procedure ::
name"). The only run-time component is whether the type-bound procedure of the
basic type or of the extended type is called.
I have to admit that I haven't yet studied the test case to see whether there
is a problem or not.
More information about the Gcc-bugs
mailing list