[patch, fortran] Fix PR 85631, wrong size checking with allocatable arrays

Thomas Koenig tkoenig@netcologne.de
Fri Jun 8 19:12:00 GMT 2018


Hello world,

the attached patch fixes a bug which was uncovered by the PR in
a matmul regression.

The problem is that bounds checking on the LHS with reallocation on
assignment makes no sense, and the original flag was not set for
the case in question.

I added both the original test and the reduced test to the single test
case.

OK for trunk?

Regards

	Thomas

2018-06-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/85631
	* trans.h (gfc_ss): Add field no_bounds_check.
	* trans-array.c (gfc_conv_ss_startstride): If flag_realloc_lhs and
	ss->no_bounds_check is set, do not use runtime checks.
	* trans-expr.c (gfc_trans_assignment_1): Set lss->no_bounds_check
	for reallocatable lhs.

2018-06-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/85631
	* gfortran.dg/bounds_check_20.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p1.diff
Type: text/x-patch
Size: 1795 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20180608/91d9a80a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bounds_check_20.f90
Type: text/x-fortran
Size: 672 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20180608/91d9a80a/attachment-0001.bin>


More information about the Fortran mailing list