summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2017-02-27 11:13:49 +0000
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2017-02-27 11:13:49 +0000
commit1ff3ef783c6e43e69a3fc909379406237ee4911d (patch)
treea7433a4ff626cf6ecfe26b62ade74373c9bcc0d4 /libgfortran
parent12420a15c2f638f8e65b76a46a37f59bda8670dc (diff)
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245755 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/intrinsics/random.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 4cdb3b4f2521..0485e6f698be 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -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
diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c
index d4f5b82f0b49..380368793628 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]);