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  <jb@gcc.gnu.org>

	* intrinsics/random.c (getosrandom): Don't try to use rand_s on
	CYGWIN.

From-SVN: r245755
This commit is contained in:
Janne Blomqvist 2017-02-27 13:13:49 +02:00
parent 57fa080bf6
commit 9449b70019
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2017-02-27 Janne Blomqvist <jb@gcc.gnu.org>
* intrinsics/random.c (getosrandom): Don't try to use rand_s on
CYGWIN.
2017-02-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/79382

View File

@ -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]);