]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: fix parsing of type parameter inquiries of substrings [PR101735]
authorHarald Anlauf <anlauf@gmx.de>
Tue, 27 May 2025 17:23:16 +0000 (19:23 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Tue, 3 Jun 2025 17:06:54 +0000 (19:06 +0200)
commit25e46423bdfdf6e14cc1bc753f05b3b4fb5e8cc8
tree9e2f0a6972148b7e4d57b85a385000f5ae71f8e2
parent1299fd36ddc3e26309b5194b22d706eef17d0a90
Fortran: fix parsing of type parameter inquiries of substrings [PR101735]

Handling of type parameter inquiries of substrings failed to due either
parsing issues or not following or handling reference chains properly.

PR fortran/101735

gcc/fortran/ChangeLog:

* expr.cc (find_inquiry_ref): If an inquiry reference applies to
a substring, use that, and calculate substring length if needed.
* primary.cc (extend_ref): Also handle attaching to end of
reference chain for appending.
(gfc_match_varspec): Discrimate between arrays of character and
substrings of them.  If a substring is taken from a character
component of a derived type, get the proper typespec so that
inquiry references work correctly.
(gfc_match_rvalue): Handle corner case where we hit a seemingly
dangling '%' and missed an inquiry reference. Try another match.

gcc/testsuite/ChangeLog:

* gfortran.dg/inquiry_type_ref_7.f90: New test.

(cherry picked from commit 787a8dec1acedf5561c8ee43bed0b3653fca150d)
gcc/fortran/expr.cc
gcc/fortran/primary.cc
gcc/testsuite/gfortran.dg/inquiry_type_ref_7.f90 [new file with mode: 0644]