diff options
author | Andre Vehreschild <vehre@gcc.gnu.org> | 2024-10-01 09:30:59 +0200 |
---|---|---|
committer | Andre Vehreschild <vehre@gcc.gnu.org> | 2024-10-08 13:51:38 +0200 |
commit | 0ad2c76bea20dbeac753f10df6f9f86d142348d4 (patch) | |
tree | 3fb3d3b848a8654a986718cf58c5340c8bff246c /gcc/fortran/match.h | |
parent | 9252fc398c86ec0eac2c56283e2ded8ea6cfb70c (diff) | |
download | gcc-0ad2c76bea20dbeac753f10df6f9f86d142348d4.zip gcc-0ad2c76bea20dbeac753f10df6f9f86d142348d4.tar.gz gcc-0ad2c76bea20dbeac753f10df6f9f86d142348d4.tar.bz2 |
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.
Diffstat (limited to 'gcc/fortran/match.h')
-rw-r--r-- | gcc/fortran/match.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h index 84d84b8..2c76afb 100644 --- a/gcc/fortran/match.h +++ b/gcc/fortran/match.h @@ -317,7 +317,8 @@ match gfc_match_init_expr (gfc_expr **); /* array.cc. */ match gfc_match_array_spec (gfc_array_spec **, bool, bool); -match gfc_match_array_ref (gfc_array_ref *, gfc_array_spec *, int, int); +match gfc_match_array_ref (gfc_array_ref *, gfc_array_spec *, int, int, + bool = false); match gfc_match_array_constructor (gfc_expr **); /* interface.cc. */ |