]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgfortran/m4/ifunction.m4
re PR fortran/35995 (ANY, ALL, and COUNT errors for zero sized sections)
[thirdparty/gcc.git] / libgfortran / m4 / ifunction.m4
index 5ab2952a49127baee4c7480363702e46854681be..edf3c77d05cb237b47b962b4b3f34791aba73f6d 100644 (file)
@@ -39,12 +39,15 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
   index_type len;
   index_type delta;
   index_type dim;
+  int continue_loop;
 
   /* Make dim zero based to avoid confusion.  */
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len < 0)
+    len = 0;
   delta = array->dim[dim].stride;
 
   for (n = 0; n < dim; n++)
@@ -131,7 +134,8 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
   base = array->data;
   dest = retarray->data;
 
-  while (base)
+  continue_loop = 1;
+  while (continue_loop)
     {
       const atype_name * restrict src;
       rtype_name result;
@@ -169,8 +173,8 @@ define(FINISH_ARRAY_FUNCTION,
           if (n == rank)
             {
               /* Break out of the look.  */
-              base = NULL;
-              break;
+             continue_loop = 0;
+             break;
             }
           else
             {