/* Implementation of the RESHAPE intrinsic
- Copyright 2002, 2006, 2007, 2009, 2012 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran runtime library (libgfortran).
ret->offset = 0;
if (unlikely (rs < 1))
- alloc_size = 1;
+ alloc_size = 0;
else
- alloc_size = rs * sizeof (GFC_REAL_10);
+ alloc_size = rs;
- ret->base_addr = internal_malloc_size (alloc_size);
+ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}