Patchwork [fortran,2/11] Inline transpose part 1

login
register
mail settings
Submitter Mikael Morin
Date Sept. 4, 2010, 2:21 p.m.
Message ID <4C8255D2.4020002@sfr.fr>
Download mbox | patch
Permalink /patch/63780/
State New
Headers show

Comments

Mikael Morin - Sept. 4, 2010, 2:21 p.m.
Obvious and not absolutely necessary:
As we are using n to access the loop bounds, let's stop on the loop 
dimension instead of the array dimension.
I've added an assert to check that it is effectively the same.
The trans-stmt.c change is there to prevent the assert from triggering.
OK for trunk?
2010-09-03  Mikael Morin  <mikael@gcc.gnu.org>

	* trans-array.c (gfc_trans_create_temp_array): Assert loop dimension
	and info dimension are the same. Loop over loop dimension.
	* trans-stmt.c (gfc_conv_elemental_dependencies): Set loop dimension

Patch

diff --git a/trans-array.c b/trans-array.c
index 7cd890e..5902aff 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -733,6 +733,7 @@  gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
   int dim;
 
   gcc_assert (info->dimen > 0);
+  gcc_assert (loop->dimen == info->dimen);
 
   if (gfc_option.warn_array_temp && where)
     gfc_warning ("Creating array temporary at %L", where);
@@ -786,15 +787,15 @@  gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
 
   /* If there is at least one null loop->to[n], it is a callee allocated 
      array.  */
-  for (n = 0; n < info->dimen; n++)
+  for (n = 0; n < loop->dimen; n++)
     if (loop->to[n] == NULL_TREE)
       {
 	size = NULL_TREE;
 	break;
       }
 
-  for (n = 0; n < info->dimen; n++)
-     {
+  for (n = 0; n < loop->dimen; n++)
+    {
       dim = info->dim[n];
 
       if (size == NULL_TREE)
diff --git a/trans-stmt.c b/trans-stmt.c
index 29b3322..f058a2d 100644
--- a/trans-stmt.c
+++ b/trans-stmt.c
@@ -240,6 +240,7 @@  gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
 	  /* Make a local loopinfo for the temporary creation, so that
 	     none of the other ss->info's have to be renormalized.  */
 	  gfc_init_loopinfo (&tmp_loop);
+	  tmp_loop.dimen = info->dimen;
 	  for (n = 0; n < info->dimen; n++)
 	    {
 	      tmp_loop.to[n] = loopse->loop->to[n];