]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgfortran/generated/all_l1.c
Introduce xmallocarray, an overflow checking variant of xmalloc.
[thirdparty/gcc.git] / libgfortran / generated / all_l1.c
index ed956227cd750e9eafdb49e8807281550645e8d6..0f008b97dcbfdb0b8442fb1096be1f458aa99fc8 100644 (file)
@@ -101,8 +101,7 @@ all_l1 (gfc_array_l1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ all_l1 (gfc_array_l1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
     }
   else
     {