Fortran: Fix for class defined operators [PR99125].
authorPaul Thomas <pault@gcc.gnu.org>
Sat, 13 Mar 2021 11:39:57 +0000 (11:39 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Sat, 13 Mar 2021 11:39:57 +0000 (11:39 +0000)
commit7987beec679898cfa75839551d55ae5234a216bd
treea22adf3ab5449404f386e1d1a8fe256253e945ce
parentbbdf59fdbc2ce41ccfac807b15cf3fac7b465a56
Fortran: Fix for class defined operators [PR99125].

2021-03-13  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/99125
* trans-array.c (gfc_conv_expr_descriptor): For deferred length
length components use the ss_info string length instead of
gfc_get_expr_charlen. Make sure that the deferred string length
is a variable before assigning to it. Otherwise use the expr.
* trans-expr.c (gfc_conv_string_length): Make sure that the
deferred string length is a variable before assigning to it.

gcc/testsuite/
PR fortran/99125
* gfortran.dg/alloc_deferred_comp_1.f90: New test.
gcc/fortran/trans-array.c
gcc/fortran/trans-expr.c
gcc/testsuite/gfortran.dg/alloc_deferred_comp_1.f90 [new file with mode: 0644]