]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/fortran/gfortran.h
PR fortran/93340 - fix missed substring simplifications
authorHarald Anlauf <anlauf@gmx.de>
Thu, 14 Jan 2021 19:25:33 +0000 (20:25 +0100)
committerHarald Anlauf <anlauf@gmx.de>
Thu, 14 Jan 2021 19:25:33 +0000 (20:25 +0100)
commitbdd1b1f55529da00b867ef05a53a08fbfc3d1c2e
treef17fdbfa2b6eee1ecd66faa80e0292f69fef5c2c
parent3651c1b5c9c0960e50f00ca5b59d144b8a586b5d
PR fortran/93340 - fix missed substring simplifications

Substrings were not reduced early enough for use in initializations,
such as DATA statements.  Add an early simplification for substrings
with constant starting and ending points.

gcc/fortran/ChangeLog:

* gfortran.h (gfc_resolve_substring): Add prototype.
* primary.c (match_string_constant): Simplify substrings with
constant starting and ending points.
* resolve.c: Rename resolve_substring to gfc_resolve_substring.
(gfc_resolve_ref): Use renamed function gfc_resolve_substring.

gcc/testsuite/ChangeLog:

* substr_10.f90: New test.
* substr_9.f90: New test.
gcc/fortran/gfortran.h
gcc/fortran/primary.c
gcc/fortran/resolve.c
gcc/testsuite/substr_10.f90 [new file with mode: 0644]
gcc/testsuite/substr_9.f90 [new file with mode: 0644]