/* Specific implementation of the UNPACK intrinsic
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2020 Free Software Foundation, Inc.
Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>, based on
unpack_generic.c by Paul Brook <paul@nowt.org>.
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
-#include <stdlib.h>
-#include <assert.h>
#include <string.h>
rs *= extent[n];
}
ret->offset = 0;
- ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4));
+ ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4));
}
else
{
dim = GFC_DESCRIPTOR_RANK (ret);
+ /* Initialize to avoid -Wmaybe-uninitialized complaints. */
+ rstride[0] = 1;
for (n = 0; n < dim; n++)
{
count[n] = 0;
rs *= extent[n];
}
ret->offset = 0;
- ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4));
+ ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4));
}
else
{
dim = GFC_DESCRIPTOR_RANK (ret);
+ /* Initialize to avoid -Wmaybe-uninitialized complaints. */
+ rstride[0] = 1;
for (n = 0; n < dim; n++)
{
count[n] = 0;