This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[Patch, fortran] PR69566 - Failure of SELECT TYPE with unlimited polymorphic function result


Dear All,

This bug was caused by 'associate name' and 'associate entity'
expressions being incomplete when the 'selector' was an intrinsic
function result. I tried to fix this at source, in match_select _type
and gfc_get_variable_expr, but caused a vast number of breakages.
Undoubtedly, this would be the ecologically sound way to proceed but
applying fixups in resolve_select_type, gfc_conv_class_to_class and
trans_associate_var proved to be the path of least resistance.

Depending on which form of select type is used, the defective
expressions either lacked the correct value for rank, a full array
reference, a symbol with an array spec or had type BT_DERIVED for a
polymorphic symbol; these either singly or in combination depending of
the form of select type.

The patch, taken with the ChangeLogs, is fairly self-explanatory.
Please note that I have suppressed whitespace changes (suppression of
trailing blanks), so use patch with the -l option.

Bootstraps and regtests on FC21/x86_64 - OK for trunk?

Best regards

Paul

2016-10-18  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/69566
    * resolve.c (fixup_array_ref): New function.
    (resolve_select_type): Gather up the rank and array reference,
    if any, from the selector. Fix up the 'associate name' and the
    'associate entities' as necessary.
    * trans-expr.c (gfc_conv_class_to_class): If the symbol backend
    decl is a FUNCTION_DECL, use the 'fake_result_decl' instead.
    * trans-stmt.c (trans_associate_var): Extend 'unlimited' to
    include expressions which are themsleves not unlimited
    polymorphic but the symbol is.

2016-10-18  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/69566
    * gfortran.dg/select_type_37.f03: New test.

Attachment: check.diff
Description: Text document


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