]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix PR 119928, formal arguments used to wrongly inferred for CLASS.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 6 May 2025 16:05:41 +0000 (18:05 +0200)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 6 May 2025 16:07:06 +0000 (18:07 +0200)
commite7a2b8b76ae0c8f1e49c780aa82ebb5f0325f515
tree5d23930741fa16f8e8620cf8c2bc325496c766ad
parent76c882e341cb330a4e9f677a8c3541d573820255
Fix PR 119928, formal arguments used to wrongly inferred for CLASS.

The problem was indeed that generating a formal from an actual
arglist is a bad idea when classes are involved.  Fixed in the
attached patch.  I think it still makes sense to remove the checks
when the other attributes are present (or PR96073 may come back
in different guise, even if I have to test case at present).
I have also converted the test to a run-time check.

gcc/fortran/ChangeLog:

PR fortran/119928
* interface.cc (gfc_check_dummy_characteristics): Do not issue
error if one dummy symbol has been generated from an actual
argument and the other one has OPTIONAL, INTENT, ALLOCATABLE,
POINTER, TARGET, VALUE, ASYNCHRONOUS or CONTIGUOUS.
(gfc_get_formal_from_actual_arglist): Do nothing if symbol
is a class.

gcc/testsuite/ChangeLog:

PR fortran/119928
* gfortran.dg/interface_60.f90: New test.
gcc/fortran/interface.cc
gcc/testsuite/gfortran.dg/interface_60.f90 [new file with mode: 0644]