https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102541
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tobias Burnus <bur...@gcc.gnu.org>: https://gcc.gnu.org/g:eb92cd57a1ebe7cd7589bdbec34d9ae337752ead commit r12-4346-geb92cd57a1ebe7cd7589bdbec34d9ae337752ead Author: Tobias Burnus <tob...@codesourcery.com> Date: Tue Oct 12 09:56:08 2021 +0200 Fortran: Various CLASS + assumed-rank fixed [PR102541] Starting point was PR102541, were a previous patch caused an invalid e->ref access for class. When testing, it turned out that for CLASS to CLASS the code was never executed - additionally, issues appeared for optional and a bogus error for -fcheck=all. In particular: There were a bunch of issues related to optional CLASS, can have the 'attr.dummy' set in CLASS_DATA (sym) - but sometimes also in 'sym'!?! Additionally, gfc_variable_attr could return pointer = 1 for nonpointers when the expr is no longer "var" but "var%_data". PR fortran/102541 gcc/fortran/ChangeLog: * check.c (gfc_check_present): Handle optional CLASS. * interface.c (gfc_compare_actual_formal): Likewise. * trans-array.c (gfc_trans_g77_array): Likewise. * trans-decl.c (gfc_build_dummy_array_decl): Likewise. * trans-types.c (gfc_sym_type): Likewise. * primary.c (gfc_variable_attr): Fixes for dummy and pointer when 'class%_data' is passed. * trans-expr.c (set_dtype_for_unallocated, gfc_conv_procedure_call): For assumed-rank dummy, fix setting rank for dealloc/notassoc actual and setting ubound to -1 for assumed-size actuals. gcc/testsuite/ChangeLog: * gfortran.dg/assumed_rank_24.f90: New test.