https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93599
Bug ID: 93599 Summary: [9/10 regression] Bug in fortran asynchronous I/O wait function Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: seurer at gcc dot gnu.org Target Milestone: --- The test case testsuite/libgomp.fortran/async_io_4.f90 fails erratically on powerpc64 often with thousands, even tens of thousands, of successful runs between failures. It fails on both LE and BE and on power 7, 8, and 9. Looking at the gcc test results mailing list I see a few failures for this on aarch64 and even one for x86 as well though I do not know if it is the same issue. >From testing today the failures have occurred since the test case was added in gcc 9 in svn revision r263750 which is g:2b4c90656132abb8b8ad155d345c7d4fbf1687c9, r9-2544. This revision is Author: Nicolas Koenig <koeni...@gcc.gnu.org> Date: Tue Aug 21 18:48:59 2018 +0000 re PR fortran/25829 ([F03] Asynchronous IO support) When it fails it always fails at the "stop 1" (see below). It looks like the call "wait (20)" is what is not working as when it hits the stop 1 the value of the variable "i" is still 41. The test case actually doesn't fail (I hesitate to say it works) if built with a compiler from before this revision. (note the test case was actually added in this revision) Before the revision the call to wait becomes: bl _gfortran_st_wait 0x00000000100009a0 00000035.plt_call._gfortran_st_wait@@GFORTRAN_8 after the revision it becomes bl _gfortran_st_wait_async 0x0000000010000b20 00000035.plt_call._gfortran_st_wait_async@@GFORTRAN_9 I am not sure if that is something in the fortran library or what. Shortened test case from testsuite/libgomp.fortran/async_io_4.f90: ! { dg-do run { target fd_truncate } } !TODO: Move these testcases to gfortran testsuite ! once compilation with pthreads is supported there ! Test BACKSPACE for synchronous and asynchronous I/O program main integer i, n, nr real x(10), y(10) ! PR libfortran/20068 open (20, status='scratch', asynchronous="yes") write (20,*, asynchronous="yes" ) 1 write (20,*, asynchronous="yes") 2 write (20,*, asynchronous="yes") 3 rewind (20) i = 41 read (20,*, asynchronous="yes") i wait (20) if (i .ne. 1) stop 1 end program