https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65200
Bug ID: 65200 Summary: Handle EPERM when opening files Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran Assignee: unassigned at gcc dot gnu.org Reporter: jb at gcc dot gnu.org In some cases at least Linux can return an EPERM rather than EACCES error in case opening a file fails, see https://stackoverflow.com/questions/28696539/fortran-open-call-differs-on-nfsv3-vs-nfsv4 Based on some googling, the distinction between EACCES and EPERM are something like - EACCESS: Insufficient privilege. E.g. do the same as root and this should work. - EPERM: Operation not permitted. That is, no matter the privilege level, this isn't allowed. E.g. truncating a file opened with O_APPEND and such. but as can be seen in the URL above, both seem to be used depending on various details. This should be a simple fix in io/unix.c.