]> 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, 27 May 2025 19:42:03 +0000 (21:42 +0200)
commit787a8dec1acedf5561c8ee43bed0b3653fca150d
treec7e279aff19a53d40f912b3a398370ebfa6f3d42
parent83aa09e90487b52c1772eeffc4af577ee70536f1
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.
gcc/fortran/expr.cc
gcc/fortran/primary.cc
gcc/testsuite/gfortran.dg/inquiry_type_ref_7.f90 [new file with mode: 0644]