This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran] [11/21] Remove coarray support in the scalarizer: Support 0-rank loop in gfc_conv_ss_startstride


We are going to remove the gfc_loopinfo::codimen field.
The following assertion in gfc_conv_ss_startstride:
  gcc_assert (loop->dimen + loop->codimen != 0);
is going to fail for scalar coarrays when updated to
  gcc_assert (loop->dimen != 0);

However, gfc_conv_expr_descriptor, requires (if we don't want to rewrite it
completely) that the expression's gfc_ss struct passes through the scalarizer
(in the scalar coarray case, it will do nothing but get the descriptor).

This patch changes the assertion so that zero rank loops are accepted.

OK?

Attachment: no_coarray_in_scalarizer-11.CL
Description: Text document

diff --git a/trans-array.c b/trans-array.c
index ee5761b..067fe0b 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -3279,8 +3279,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
 
   loop->dimen = 0;
   /* Determine the rank of the loop.  */
-  for (ss = loop->ss;
-       ss != gfc_ss_terminator && loop->dimen == 0; ss = ss->loop_chain)
+  for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
     {
       switch (ss->type)
 	{
@@ -3290,7 +3289,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
 	case GFC_SS_COMPONENT:
 	  loop->dimen = ss->data.info.dimen;
 	  loop->codimen = ss->data.info.codimen;
-	  break;
+	  goto done;
 
 	/* As usual, lbound and ubound are exceptions!.  */
 	case GFC_SS_INTRINSIC:
@@ -3300,14 +3299,14 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
 	    case GFC_ISYM_UBOUND:
 	      loop->dimen = ss->data.info.dimen;
 	      loop->codimen = 0;
-	      break;
+	      goto done;
 
 	    case GFC_ISYM_LCOBOUND:
 	    case GFC_ISYM_UCOBOUND:
 	    case GFC_ISYM_THIS_IMAGE:
 	      loop->dimen = ss->data.info.dimen;
 	      loop->codimen = ss->data.info.codimen;
-	      break;
+	      goto done;
 
 	    default:
 	      break;
@@ -3320,8 +3319,9 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
 
   /* We should have determined the rank of the expression by now.  If
      not, that's bad news.  */
-  gcc_assert (loop->dimen + loop->codimen != 0);
+  gcc_unreachable ();
 
+done:
   /* Loop over all the SS in the chain.  */
   for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]