Patchwork [fortran,17/22] Various minor fixups

login
register
mail settings
Submitter Mikael Morin
Date Oct. 5, 2010, 10:11 a.m.
Message ID <20101005100948.1836.25172@gimli.local>
Download mbox | patch
Permalink /patch/66809/
State New
Headers show

Comments

Mikael Morin - Oct. 5, 2010, 10:11 a.m.
This factorizes calls to gfc_advance_se_ss_chain into gfc_conv_tmp_array_ref.
2010-10-04  Mikael Morin  <mikael@gcc.gnu.org>

	* trans-array.c (gfc_conv_tmp_array_ref): Add factorized call to
	gfc_advance_se_ss_chain.
	* trans-expr.c (gfc_conv_subref_array_ref, gfc_conv_procedure_call,
	gfc_conv_array_constructor_expr, gfc_trans_assignment_1): Remove
	calls to gfc_advance_se_ss_chain after gfc_conv_tmp_array_ref.
	* trans-intrinsic.c (gfc_conv_intrinsic_function): Ditto.
	* trans-stmt.c (gfc_trans_where_assign, gfc_trans_where_3): Ditto.

Patch

diff --git a/trans-array.c b/trans-array.c
index b32c3ec..df1ac2f 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -2545,6 +2545,7 @@  gfc_conv_tmp_array_ref (gfc_se * se)
 {
   se->string_length = se->ss->string_length;
   gfc_conv_scalarized_array_ref (se, NULL);
+  gfc_advance_se_ss_chain (se);
 }
 
 
diff --git a/trans-expr.c b/trans-expr.c
index a6837c9..d662d20 100644
--- a/trans-expr.c
+++ b/trans-expr.c
@@ -2354,7 +2354,6 @@  gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
   gfc_conv_expr (&rse, expr);
 
   gfc_conv_tmp_array_ref (&lse);
-  gfc_advance_se_ss_chain (&lse);
 
   if (intent != INTENT_OUT)
     {
@@ -2829,7 +2828,6 @@  gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
 
 	      /* Access the previously obtained result.  */
 	      gfc_conv_tmp_array_ref (se);
-	      gfc_advance_se_ss_chain (se);
 	      return 0;
 	    }
 	}
@@ -3977,7 +3975,6 @@  gfc_conv_array_constructor_expr (gfc_se * se, gfc_expr * expr)
   gcc_assert (se->ss->expr == expr && se->ss->type == GFC_SS_CONSTRUCTOR);
 
   gfc_conv_tmp_array_ref (se);
-  gfc_advance_se_ss_chain (se);
 }
 
 
@@ -5679,7 +5676,6 @@  gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
   if (l_is_temp)
     {
       gfc_conv_tmp_array_ref (&lse);
-      gfc_advance_se_ss_chain (&lse);
       if (expr2->ts.type == BT_CHARACTER)
 	lse.string_length = string_length;
     }
@@ -5730,7 +5726,6 @@  gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
 	  lse.ss = lss;
 
 	  gfc_conv_tmp_array_ref (&rse);
-	  gfc_advance_se_ss_chain (&rse);
 	  gfc_conv_expr (&lse, expr1);
 
 	  gcc_assert (lse.ss == gfc_ss_terminator
diff --git a/trans-intrinsic.c b/trans-intrinsic.c
index 6e9bfaf..a43bfc2 100644
--- a/trans-intrinsic.c
+++ b/trans-intrinsic.c
@@ -6089,11 +6089,8 @@  gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr)
 
     case GFC_ISYM_TRANSFER:
       if (se->ss && se->ss->useflags)
-	{
-	  /* Access the previously obtained result.  */
-	  gfc_conv_tmp_array_ref (se);
-	  gfc_advance_se_ss_chain (se);
-	}
+	/* Access the previously obtained result.  */
+	gfc_conv_tmp_array_ref (se);
       else
 	gfc_conv_intrinsic_transfer (se, expr);
       break;
diff --git a/trans-stmt.c b/trans-stmt.c
index 82cddd7..12ebe4a 100644
--- a/trans-stmt.c
+++ b/trans-stmt.c
@@ -3740,10 +3740,7 @@  gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
   /* Translate the expression.  */
   gfc_conv_expr (&rse, expr2);
   if (lss != gfc_ss_terminator && loop.temp_ss != NULL)
-    {
-      gfc_conv_tmp_array_ref (&lse);
-      gfc_advance_se_ss_chain (&lse);
-    }
+    gfc_conv_tmp_array_ref (&lse);
   else
     gfc_conv_expr (&lse, expr1);
 
@@ -3796,7 +3793,6 @@  gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
           lse.ss = lss;
 
           gfc_conv_tmp_array_ref (&rse);
-          gfc_advance_se_ss_chain (&rse);
           gfc_conv_expr (&lse, expr1);
 
           gcc_assert (lse.ss == gfc_ss_terminator
@@ -4201,10 +4197,7 @@  gfc_trans_where_3 (gfc_code * cblock, gfc_code * eblock)
 
   gfc_conv_expr (&tsse, tsrc);
   if (tdss != gfc_ss_terminator && loop.temp_ss != NULL)
-    {
-      gfc_conv_tmp_array_ref (&tdse);
-      gfc_advance_se_ss_chain (&tdse);
-    }
+    gfc_conv_tmp_array_ref (&tdse);
   else
     gfc_conv_expr (&tdse, tdst);
 
@@ -4212,12 +4205,9 @@  gfc_trans_where_3 (gfc_code * cblock, gfc_code * eblock)
     {
       gfc_conv_expr (&esse, esrc);
       if (edss != gfc_ss_terminator && loop.temp_ss != NULL)
-        {
-          gfc_conv_tmp_array_ref (&edse);
-          gfc_advance_se_ss_chain (&edse);
-        }
+	gfc_conv_tmp_array_ref (&edse);
       else
-        gfc_conv_expr (&edse, edst);
+	gfc_conv_expr (&edse, edst);
     }
 
   tstmt = gfc_trans_scalar_assign (&tdse, &tsse, tdst->ts, false, false, true);