]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/fortran/class.cc
Fortran: fix CLASS attribute handling [PR106856]
authorHarald Anlauf <anlauf@gmx.de>
Thu, 2 Mar 2023 21:37:14 +0000 (22:37 +0100)
committerHarald Anlauf <anlauf@gmx.de>
Sun, 5 Mar 2023 20:10:39 +0000 (21:10 +0100)
commit6aa1f40a3263741d964ef4716e85a0df5cec83b6
tree4ee01f9ce824da43fcad405312812ffd318ef782
parentca27d765f1d88a0f9d625b3519b6a8b1f8b19cc7
Fortran: fix CLASS attribute handling [PR106856]

gcc/fortran/ChangeLog:

PR fortran/106856
* class.cc (gfc_build_class_symbol): Handle update of attributes of
existing class container.
(gfc_find_derived_vtab): Fix several memory leaks.
(find_intrinsic_vtab): Ditto.
* decl.cc (attr_decl1): Manage update of symbol attributes from
CLASS attributes.
* primary.cc (gfc_variable_attr): OPTIONAL shall not be taken or
updated from the class container.
* symbol.cc (free_old_symbol): Adjust management of symbol versions
to not prematurely free array specs while working on the declation
of CLASS variables.

gcc/testsuite/ChangeLog:

PR fortran/106856
* gfortran.dg/interface_41.f90: Remove dg-pattern from valid testcase.
* gfortran.dg/class_74.f90: New test.
* gfortran.dg/class_75.f90: New test.

Co-authored-by: Tobias Burnus <tobias@codesourcery.com>
gcc/fortran/class.cc
gcc/fortran/decl.cc
gcc/fortran/primary.cc
gcc/fortran/symbol.cc
gcc/testsuite/gfortran.dg/class_74.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/class_75.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/interface_41.f90