Hi Paul, On 24.02.21 15:05, Paul Richard Thomas via Fortran wrote:
This problem was caused by the compiler attempting to use 0 as an lvalue and to assign 0 to it.
I did recall the problem – and indeed: PR95868. The trans-array.c patch does effectively the same as mine there, some other use of 'tmp' but otherwise ... The trans-expr patch, I didn't have; unfortunately, it does not solve the other issues of my PR, either. (Thus, if you are interested in continuing the len=: work ...) [Once that PR is fixed, trans-openmp.c has to updated for it as well.]
Understandably, this upset the gimplifer quite a bit :-) The fix is to use the ss_info string length for deferred length character components, where the hidden string length component has been used. The use of a constant as an lvalue is prevented by checking that the expression string length is a variable. Regtests on FC33/x86_64 - OK for all three branches?
LGTM. Thanks for the patch! Tobias
Fortran: Fix for class defined operators [PR99125]. 2021-02-23 Paul Thomas <pa...@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.
----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf