$ cat sleep.f call sleep(3) end $ ./bin/gfortran.exe sleep.f $ time a real 0m0.040s user 0m0.010s sys 0m0.010s
sleep simply doesn't work. We should include <windows.h> and use Sleep (note the capital S). Proposed patch (but this needs another patch to define TARGET_IS_MINGW): Index: intrinsics/sleep.c =================================================================== RCS file: /cvsroot/gcc/gcc/libgfortran/intrinsics/sleep.c,v retrieving revision 1.2 diff -p -u -r1.2 sleep.c --- intrinsics/sleep.c 17 Aug 2005 02:48:54 -0000 1.2 +++ intrinsics/sleep.c 9 Sep 2005 21:26:01 -0000 @@ -39,6 +39,14 @@ Boston, MA 02110-1301, USA. */ #include <unistd.h> #endif +#ifdef TARGET_IS_MINGW +# include <windows.h> +# ifdef sleep +# undef sleep +# endif +# define sleep(x) Sleep(1000*(x)) +#endif + /* SUBROUTINE SLEEP(SECONDS) INTEGER, INTENT(IN) :: SECONDS -- Summary: [mingw32] sleep malfunction Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: patch Severity: normal Priority: P2 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: i386-mingw32 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23802