]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Various CLASS + assumed-rank fixed [PR102541]
authorTobias Burnus <tobias@codesourcery.com>
Tue, 12 Oct 2021 07:58:45 +0000 (09:58 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Tue, 12 Oct 2021 07:58:45 +0000 (09:58 +0200)
commit595deb6b894431dbc3a03d83ece10f0640964ff8
treed0fb2b189fd504d1b1c516fe1f81386c57a78706
parent377a7aaeb9d5cce6521e5c2ca3e284897dbed7e2
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.

(cherry picked from commit eb92cd57a1ebe7cd7589bdbec34d9ae337752ead)
gcc/fortran/ChangeLog.omp
gcc/fortran/check.c
gcc/fortran/interface.c
gcc/fortran/primary.c
gcc/fortran/trans-array.c
gcc/fortran/trans-decl.c
gcc/fortran/trans-expr.c
gcc/fortran/trans-types.c
gcc/testsuite/ChangeLog.omp
gcc/testsuite/gfortran.dg/assumed_rank_24.f90 [new file with mode: 0644]