From: Janne Blomqvist Date: Mon, 27 Feb 2017 11:13:49 +0000 (+0200) Subject: Don't try to use rand_s on CYGWIN X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9449b700197b1d120d194cefe294f44460c0adab;p=gcc.git Don't try to use rand_s on CYGWIN CYGWIN seems to include _mingw.h and thus __MINGW64_VERSION_MAJOR is defined even though rand_s is not available. Thus add an extra check for __CYGWIN__. 2017-02-27 Janne Blomqvist * intrinsics/random.c (getosrandom): Don't try to use rand_s on CYGWIN. From-SVN: r245755 --- diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 4cdb3b4f252..0485e6f698b 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2017-02-27 Janne Blomqvist + + * intrinsics/random.c (getosrandom): Don't try to use rand_s on + CYGWIN. + 2017-02-16 Paul Thomas PR fortran/79382 diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c index d4f5b82f0b4..38036879362 100644 --- a/libgfortran/intrinsics/random.c +++ b/libgfortran/intrinsics/random.c @@ -304,7 +304,7 @@ static int getosrandom (void *buf, size_t buflen) { /* rand_s is available in MinGW-w64 but not plain MinGW. */ -#ifdef __MINGW64_VERSION_MAJOR +#if defined(__MINGW64_VERSION_MAJOR) && !defined(__CYGWIN__) unsigned int* b = buf; for (unsigned i = 0; i < buflen / sizeof (unsigned int); i++) rand_s (&b[i]);