]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgfortran/generated/minloc1_8_i2.c
Update copyright years.
[thirdparty/gcc.git] / libgfortran / generated / minloc1_8_i2.c
index f20d1387523d8dbc85d15af1cadc3e2c911bcac4..ba5e54dd31677e04c093b0ae0c0cf26ae16f0fe3 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementation of the MINLOC intrinsic
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2024 Free Software Foundation, Inc.
    Contributed by Paul Brook <paul@nowt.org>
 
 This file is part of the GNU Fortran runtime library (libgfortran).
@@ -109,12 +109,7 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray,
 
       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
-       {
-         /* Make sure we have a zero-sized array.  */
-         GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
-         return;
-
-       }
+       return;
     }
   else
     {
@@ -258,6 +253,16 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_i2 (retarray, array, pdim, back);
+#else
+      minloc1_8_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -270,8 +275,8 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
     }
 
   len = GFC_DESCRIPTOR_EXTENT(array,dim);
-  if (len <= 0)
-    return;
+  if (len < 0)
+    len = 0;
 
   mbase = mask->base_addr;
 
@@ -329,15 +334,9 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
-       {
-         /* Make sure we have a zero-sized array.  */
-         GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
-         return;
-       }
-      else
-       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
+       return;
     }
   else
     {
@@ -480,7 +479,7 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_i2 (retarray, array, pdim, back);
@@ -537,14 +536,9 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
-       {
-         /* Make sure we have a zero-sized array.  */
-         GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
-         return;
-       }
-      else
-       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
+       return;
     }
   else
     {