[gfortran] Fix PR 21912: handle negative steps in implied-do-loop in array constructor

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Sun Jun 5 13:25:00 GMT 2005


The issue was that for an implied do-loop with a negative step value, say
'i=n,1,-1', the exit condition would be 'i > 1' instead of 'i < 1', because we
would always generate a GT_EXPR instead of checking the direction in which
we're going.

The fix is straightforward, but since I was touching that function, I slightly
restructured it to make it IMO more readable.

Bubblestrapped and tested.  OK for 4.0 and mainline?  I'll commit a testcase
alongside this.

- Tobi

2005-06-05  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>

	PR fortran/21912
	* trans-array.c (gfc_trans_array_constructor_value): Slightly reorder.
	Generate correct exit condition in case of negative steps in
	implied-do loops.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: constructor.diff
Type: text/x-patch
Size: 3354 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050605/cf1d1406/attachment.bin>


More information about the Fortran mailing list