https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113922
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- POSIX definition of read: https://pubs.opengroup.org/onlinepubs/009604599/functions/read.html >Before any action described below is taken, and if nbyte is zero, the read() >function may detect and return errors as described below. In the absence of >errors, or if error detection is not performed, the read() function shall >return zero and have no other results. So yes it does look like the use of write_only access is incorrect ...