[patch, fortran] Fix PR 43072

Thomas Koenig tkoenig@netcologne.de
Tue Jan 15 21:58:00 GMT 2019


Hello world,

the attached patch fixes a missed optimization where a substring equal
in length to the original variable currently leads to an unneeded
temporary.

Regression-tested. OK for trunk?

Regards

	Thomas

2019-01-15  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/43072
	* resolve.c (resolve_array_ref): Add equal_length argument; set it
	if the length of the substring equals that of the orignal
	variable.
	(resolve_ref): Remove the substring if it is equal in length
	length to the original variable, unless it is an EXPR_SUBSTRING).

2019-01-15  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/43072
	* gfortran.dg/actual_array_substr_3.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2.diff
Type: text/x-patch
Size: 1896 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20190115/f1fde17b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: actual_array_substr_3.f90
Type: text/x-fortran
Size: 342 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20190115/f1fde17b/attachment-0001.bin>


More information about the Fortran mailing list