[Patch, fortran] PR fortran/51250 bug with sum(,dim,mask)

Mikael Morin mikael.morin@sfr.fr
Thu Nov 24 22:53:00 GMT 2011


Hello,

this patch fixes a regression introduced by my recent inline sum change(s).

This change:
http://gcc.gnu.org/viewcvs?view=revision&revision=180895
inserts a loop in gfc_trans_create_temp_array from:

   if (size == NULL_TREE)
     for (n = 0; n < ss->loop->dimen; n++)

to:

   if (size == NULL_TREE)
     for (s = ss; s; s = s->parent)
       for (n = 0; n < s->loop->dimen; n++)

That is we take care of array dimensions scattered in more than one loop.
As a result of this, usages of 'ss' (before the patch the only one loop's 
array info, and after it the innermost loop's one) have to be replaced with 
usages of 's' (the current loop's one).

One of them was forgotten, resulting in loops with library-allocated arrays 
geting the wrong shape (that from the innermost loop).
This patch fixes it.

Regression tested on x86_64-unknown-linux-gnu. OK for trunk?

Mikael
-------------- next part --------------
2011-11-24  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/51250
	PR fortran/43829
	* trans-array.c (gfc_trans_create_temp_array): Get dimension from
	the right gfc_ss struct.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr51250_1.diff
Type: text/x-patch
Size: 577 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111124/aa0cdc82/attachment.bin>
-------------- next part --------------
2011-11-24  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/51250
	PR fortran/43829
	* gfortran.dg/inline_sum_3.f90: New test.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: inline_sum_3.f90
Type: text/x-fortran
Size: 921 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111124/aa0cdc82/attachment-0001.bin>


More information about the Fortran mailing list