]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgfortran/generated/all_l16.c
Introduce xmallocarray, an overflow checking variant of xmalloc.
[thirdparty/gcc.git] / libgfortran / generated / all_l16.c
index a23001b56aeb3ba655b2c5abfc4d1b594daa6a67..a9f85b4bfed258e738b46d49b9e5e66235dae709 100644 (file)
@@ -101,8 +101,7 @@ all_l16 (gfc_array_l16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_16) * 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_l16 (gfc_array_l16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
     }
   else
     {