]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Fix select type regression due to r14-9489 [PR114874]
authorPaul Thomas <pault@gcc.gnu.org>
Fri, 17 May 2024 14:19:26 +0000 (15:19 +0100)
committerPaul Thomas <pault@gcc.gnu.org>
Fri, 17 May 2024 14:19:26 +0000 (15:19 +0100)
commit5f5074fe7aaf9524defb265299a985eecba7f914
treeec0756373bbfea1846b67a0c57c1488a3ef947b7
parent1accf4454a2ab57c4d681d1f6db332c46c61c058
Fortran: Fix select type regression due to r14-9489 [PR114874]

2024-05-17  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/114874
* gfortran.h: Add 'assoc_name_inferred' to gfc_namespace.
* match.cc (gfc_match_select_type): Set 'assoc_name_inferred'
in select type namespace if the selector has inferred type.
* primary.cc (gfc_match_varspec): If a select type temporary
is apparently scalar and a left parenthesis has been detected,
check the current namespace has 'assoc_name_inferred' set. If
so, set inferred_type.
* resolve.cc (resolve_variable): If the namespace of a select
type temporary is marked with 'assoc_name_inferred' call
gfc_fixup_inferred_type_refs to ensure references are OK.
(gfc_fixup_inferred_type_refs): Catch invalid array refs..

gcc/testsuite/
PR fortran/114874
* gfortran.dg/pr114874_1.f90: New test for valid code.
* gfortran.dg/pr114874_2.f90: New test for invalid code.
gcc/fortran/gfortran.h
gcc/fortran/match.cc
gcc/fortran/primary.cc
gcc/fortran/resolve.cc
gcc/testsuite/gfortran.dg/pr114874_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr114874_2.f90 [new file with mode: 0644]