Don't try to use rand_s on CYGWIN
[gcc.git] / libgfortran / intrinsics / eoshift0.c
index f4cd424f06199ebbf0a8783464816f943a2b349c..53a9a89f5f9760e72250da18f35e0a0ecce8983c 100644 (file)
@@ -1,5 +1,5 @@
 /* Generic implementation of the EOSHIFT intrinsic
-   Copyright 2002, 2005, 2007, 2009, 2012 Free Software Foundation, Inc.
+   Copyright (C) 2002-2017 Free Software Foundation, Inc.
    Contributed by Paul Brook <paul@nowt.org>
 
 This file is part of the GNU Fortran runtime library (libgfortran).
@@ -24,8 +24,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
 #include "libgfortran.h"
-#include <stdlib.h>
-#include <assert.h>
 #include <string.h>
 
 /* TODO: make this work for large shifts when
@@ -86,8 +84,8 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
 
         }
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
     }
   else if (unlikely (compile_options.bounds_check))
     {