diff mbox

[fortran] PR fortran/46978 wrong-code with transpose(reshape(...))

Message ID 201012222145.30120.mikael.morin@sfr.fr
State New
Headers show

Commit Message

Mikael Morin Dec. 22, 2010, 8:45 p.m. UTC
Hello,

I'm going to commit the patch below as obvious, once the regression test has 
finished.

Historical note: this has changed several times already in the past:
 - Revision 162276: n -> dim
     At that time n and dim were guaranteed to be equal so it didn't matter, 
     but I suppose transpose was already in sight then.
 - Revision 164112: dim -> n
     This revision introduced a linear to[] array with transpose already taken
     into account, so n had to be used for that part. One part was still using 
     loop->to[], so it shouldn't have been changed (it is the cause of the 
     regression). Yet again, it didn't matter at the time. 
 - Revision 164205: This is the regression
     Starting from here, the dimensions can be transposed, so n and dim can be
     different.

Mikael


2010-12-22  Mikael Morin  <mikael.morin@gcc.gnu.org>

	PR fortran/46978
	Revert part of revision 164112
	* trans-array.c (gfc_trans_create_temp_array):
	Set loop n'th upper bound from (possibly transposed) array's dim bounds.





2010-12-22  Mikael Morin  <mikael@gcc.gnu.org

	PR fortran/46978
	* gfortran.dg/transpose_intrinsic_func_call_1.f90: New test.

Comments

Mikael Morin Dec. 23, 2010, 1:40 p.m. UTC | #1
On Wednesday 22 December 2010 21:45:28 Mikael Morin wrote:
> Hello,
> 
> I'm going to commit the patch below as obvious, once the regression test
> has finished.

Committed revisions 168206 (code) and 168207 (test)
diff mbox

Patch

Index: trans-array.c
===================================================================
--- trans-array.c	(revision 168130)
+++ trans-array.c	(working copy)
@@ -851,8 +851,8 @@  gfc_trans_create_temp_array (stmtblock_t * pre, st
 	     of the descriptor fields.  */
 	  tmp = fold_build2_loc (input_location,
 		MINUS_EXPR, gfc_array_index_type,
-		gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[n]),
-		gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[n]));
+		gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[dim]),
+		gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[dim]));
 	  loop->to[n] = tmp;
 	  continue;
 	}