]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix parsing of substring refs in coarrays. [PR51815]
authorAndre Vehreschild <vehre@gcc.gnu.org>
Tue, 1 Oct 2024 07:30:59 +0000 (09:30 +0200)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Tue, 8 Oct 2024 11:51:38 +0000 (13:51 +0200)
commit0ad2c76bea20dbeac753f10df6f9f86d142348d4
tree3fb3d3b848a8654a986718cf58c5340c8bff246c
parent9252fc398c86ec0eac2c56283e2ded8ea6cfb70c
Fix parsing of substring refs in coarrays. [PR51815]

The parser was greadily taking the substring ref as an array ref because
an array_spec was present.  Fix this by only parsing the coarray (pseudo)
ref when no regular array is present.

gcc/fortran/ChangeLog:

PR fortran/51815

* array.cc (gfc_match_array_ref): Only parse coarray part of
ref.
* match.h (gfc_match_array_ref): Add flag.
* primary.cc (gfc_match_varspec): Request only coarray ref
parsing when no regular array is present.  Report error on
unexpected additional ref.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr102532.f90: Fix dg-errors: Add new error.
* gfortran.dg/coarray/substring_1.f90: New test.
gcc/fortran/array.cc
gcc/fortran/match.h
gcc/fortran/primary.cc
gcc/testsuite/gfortran.dg/coarray/substring_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr102532.f90