]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgfortran/m4/iforeach-s.m4
re PR fortran/82995 (Segmentation fault passing optional argument to intrinsic sum...
[thirdparty/gcc.git] / libgfortran / m4 / iforeach-s.m4
index 19bb23bd4ee640e2ec58e1ff3af338a376c9533a..b841d1519c5b9a99849f6958d7430c05ce0de9c4 100644 (file)
@@ -135,6 +135,16 @@ m'name`'rtype_qual`_'atype_code` ('rtype` * const restrict retarray,
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      name`'rtype_qual`_'atype_code (retarray, array, back, len);
+#else
+      name`'rtype_qual`_'atype_code (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -261,7 +271,7 @@ void
   index_type n;
   'rtype_name *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       name`'rtype_qual`_'atype_code (retarray, array, back, len);