https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94849
--- Comment #4 from Rachel Mant <rachel at rachelmant dot com> --- Glibc, MSVCRT and other CRTs all check for this condition in userspace and NOP it by short-circuiting the call with a return of nullptr. MSVCRT even documents this (https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen?view=vs-2019) I agree that the fopen() man page leaves it as unspecified behaviour however. That said.. this is not actually fopen() itself, but its 64-bit cousin fopen64(). Again, Glibc and other CRTs agree to handle a nullptr file argument by NOP'ing the call and returning nullptr.