diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2018-10-15 16:31:15 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2018-10-15 16:31:15 +0000 |
commit | e60f68ec460bc5b33a6f75caac9667bf978f37d8 (patch) | |
tree | 3cdf05c071e53c16a1aa96b96c259221366c7d1e /gcc/fortran/trans-expr.c | |
parent | 72551c683ce3ae89835216851473863c6d4ef27f (diff) | |
download | gcc-e60f68ec460bc5b33a6f75caac9667bf978f37d8.zip gcc-e60f68ec460bc5b33a6f75caac9667bf978f37d8.tar.gz gcc-e60f68ec460bc5b33a6f75caac9667bf978f37d8.tar.bz2 |
re PR fortran/87566 (ICE with class(*) and select)
2018-10-15 Paul Thomas <pault@gcc.gnu.org>
Tobias Burnus <burnus@gcc.gnu.org>
PR fortran/87566
* resolve.c (resolve_assoc_var): Add missing array spec for
class associate names.
(resolve_select_type): Handle case where last typed component
of the selector has a different type to the expression.
* trans-expr.c (gfc_find_and_cut_at_last_class_ref): Replace
call to gfc_expr_to_initialize with call to gfc_copy_expr.
(gfc_conv_class_to_class): Guard assignment to 'len' field
against case where zero constant is supplied.
2018-10-15 Paul Thomas <pault@gcc.gnu.org>
Tobias Burnus <burnus@gcc.gnu.org>
PR fortran/87566
* gfortran.dg/select_type_44.f90: New test.
* gfortran.dg/associate_42.f90: New test.
Co-Authored-By: Tobias Burnus <burnus@gcc.gnu.org>
From-SVN: r265171
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 37052b6..7a5091b 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -394,7 +394,7 @@ gfc_find_and_cut_at_last_class_ref (gfc_expr *e) e->ref = NULL; } - base_expr = gfc_expr_to_initialize (e); + base_expr = gfc_copy_expr (e); /* Restore the original tail expression. */ if (class_ref) @@ -1131,7 +1131,8 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts, /* Return the len component, except in the case of scalarized array references, where the dynamic type cannot change. */ - if (!elemental && full_array && copyback) + if (!elemental && full_array && copyback + && (UNLIMITED_POLY (e) || VAR_P (tmp))) gfc_add_modify (&parmse->post, tmp, fold_convert (TREE_TYPE (tmp), ctree)); } |