https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78833
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |jvdelisle at gcc dot gnu.org Resolution|--- |INVALID --- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- Yes, the bug is in your program. After failing to open the subsequent write statements are assuming default open which is by definition, sequentiial, so the error message is correct. On the initial failure your program should not attempt any writes and probably should gracefully exit.