On Sun, Mar 12, 2017 at 10:46 PM, Janne Blomqvist <blomqvist.ja...@gmail.com> wrote: > On Sun, Mar 12, 2017 at 7:26 PM, NightStrike <nightstr...@gmail.com> wrote: >> On Mon, Feb 27, 2017 at 6:15 AM, Janne Blomqvist >> <blomqvist.ja...@gmail.com> wrote: >>> 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__. >>> >>> Thanks to Tim Prince and Nightstrike for bringing this issue to my >>> attention. >>> >>> Committed as r245755. >>> >>> 2017-02-27 Janne Blomqvist <j...@gcc.gnu.org> >>> >>> * intrinsics/random.c (getosrandom): Don't try to use rand_s on >>> CYGWIN. >> >> 1) There was no patch attached to the email. > > Oh, sorry. Well, you can see it at > https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=245755 > >> 2) As mentioned on IRC, I don't think this is the right fix. The real >> problem is that time_1.h includes windows.h on CYGWIN, which it >> shouldn't be doing. This then pollutes the translation unit with all >> sorts of MINGW-isms that aren't exactly appropriate for cygwin. >> Removing the include in time_1.h and then adjusting a few ifdefs in >> system_clock.c that also had the same bug fixes the problem. The >> testsuite is running right now on this. > > It used to be something like that, but IIRC there were some complaints > about SYSTEM_CLOCK on cygwin that were due to the cygwin > clock_gettime() or something like that, and after some discussion with > someone who knows something about cygwin/mingw (since you apparently > have no memory of it, I guess it was Kai), it was decided to use > GetTickCount & QPC also on cygwin.
I searched a bit, and it seems the culprit is the thread starting at https://gcc.gnu.org/ml/fortran/2013-04/msg00033.html So it turned out that clock_gettime(CLOCK_MONOTONIC, ...) always returned 0 on cygwin, hence the code was changed to use the windows API functions GetTickCount and QPC also on cygwin at https://gcc.gnu.org/ml/fortran/2013-04/msg00124.html https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56919 -- Janne Blomqvist