diff mbox

[fortran,2/5] PR 45648: Inline transpose part 2: Take transposed dimensions into account whilst checking for full array

Message ID 20100920222130.27269.44792@gimli.local
State New
Headers show

Commit Message

Mikael Morin Sept. 20, 2010, 10:21 p.m. UTC
We have to take into account the fact that we can access an array transposed when checking whether an array reference is a reference to a full array. 

OK for trunk ?
2010-09-20  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/45648
	* trans-array.c (gfc_conv_expr_descriptor): Unset full if we are
	accessing dimensions in reversed order.

Comments

Paul Richard Thomas Sept. 21, 2010, 1:50 p.m. UTC | #1
Mikael,

This is OK.

What would be the consequence of putting the additional code in
gfc_full_array_ref_p?

Cheers

Paul

On 9/21/10, Mikael Morin <mikael.morin@sfr.fr> wrote:
> We have to take into account the fact that we can access an array transposed
> when checking whether an array reference is a reference to a full array.
>
> OK for trunk ?
>
>
>
Mikael Morin Sept. 21, 2010, 3:43 p.m. UTC | #2
On Tuesday 21 September 2010 15:50:55 Paul Richard Thomas wrote:
> Mikael,
> 
> This is OK.
> 
> What would be the consequence of putting the additional code in
> gfc_full_array_ref_p?

Hello, 

this is not possible (at least with the current code) as info->ref doesn't 
have the order in which dimensions are accessed (which is in info->dim). 
Besides, there is a distinction between the array itself which is full and 
transpose(array) which is not. Thus, I think it is better to keep the code 
separated. 

Thanks for the review.
Mikael
diff mbox

Patch

diff --git a/trans-array.c b/trans-array.c
index f15b53e..52e6d2a 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -5216,6 +5216,14 @@  gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
 	full = gfc_full_array_ref_p (info->ref, NULL);
 
       if (full)
+	for (n = 0; n < info->dimen; n++)
+	  if (info->dim[n] != n)
+	    {
+	      full = 0;
+	      break;
+	    }
+
+      if (full)
 	{
 	  if (se->direct_byref && !se->byref_noassign)
 	    {