spawn -ignore SIGHUP /home/dave/gnu/gcc/objdir64/./gcc/xg++ -shared-libgcc -B/ho me/dave/gnu/gcc/objdir64/./gcc -nostdinc++ -L/home/dave/gnu/gcc/objdir64/hppa64- hp-hpux11.11/libstdc++-v3/src -L/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/ libstdc++-v3/src/.libs -L/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/libstdc ++-v3/libsupc++/.libs -B/opt/gnu64/gcc/gcc-13/hppa64-hp-hpux11.11/bin/ -B/opt/gn u64/gcc/gcc-13/hppa64-hp-hpux11.11/lib/ -isystem /opt/gnu64/gcc/gcc-13/hppa64-hp -hpux11.11/include -isystem /opt/gnu64/gcc/gcc-13/hppa64-hp-hpux11.11/sys-includ e -fchecking=1 -B/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/ src/.libs -fmessage-length=0 -fno-show-column -ffunction-sections -fdata-section s -O2 -g -DLOCALEDIR="." -nostdinc++ -I/home/dave/gnu/gcc/objdir64/hppa64-hp-hpu x11.11/libstdc++-v3/include/hppa64-hp-hpux11.11 -I/home/dave/gnu/gcc/objdir64/hp pa64-hp-hpux11.11/libstdc++-v3/include -I/home/dave/gnu/gcc/gcc/libstdc++-v3/lib supc++ -I/home/dave/gnu/gcc/gcc/libstdc++-v3/include/backward -I/home/dave/gnu/g cc/gcc/libstdc++-v3/testsuite/util /home/dave/gnu/gcc/gcc/libstdc++-v3/testsuite /27_io/basic_ofstream/open/char/noreplace.cc -include bits/stdc++.h -fdiagnostic s-plain-output ./libtestc++.a -lm -o ./noreplace.exe PASS: 27_io/basic_ofstream/open/char/noreplace.cc (test for excess errors) Setting LD_LIBRARY_PATH to :/home/dave/gnu/gcc/objdir64/gcc:/home/dave/gnu/gcc/o bjdir64/hppa64-hp-hpux11.11/./libstdc++-v3/../libatomic/.libs:/home/dave/gnu/gcc /objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/../libgomp/.libs:/home/dave/gnu/gcc /objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/.libs::/home/dave/gnu/gcc/objdi r64/gcc:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/../libato mic/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/../libg omp/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/.li bs::/home/dave/gnu/gcc/objdir64/gcc:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11 .11/./libstdc++-v3/../libatomic/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux 11.11/./libstdc++-v3/../libgomp/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux 11.11/./libstdc++-v3/src/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/. /libatomic/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libatomic/.li bs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libatomic/.libs:/home/dave/ gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libatomic/.libs:/home/dave/gnu/gcc/objdir 64/hppa64-hp-hpux11.11/./libatomic/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-h pux11.11/./libatomic/.libs::/home/dave/gnu/gcc/objdir64/gcc:/home/dave/gnu/gcc/o bjdir64/hppa64-hp-hpux11.11/./libstdc++-v3/../libatomic/.libs:/home/dave/gnu/gcc /objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/../libgomp/.libs:/home/dave/gnu/gcc /objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/.libs:/home/dave/gnu/gcc/objdir 64/hppa64-hp-hpux11.11/./libatomic/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libatomic/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libatomic/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libatomic/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libatomic/.libs:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libatomic/.libs Execution timeout is: 300 spawn [open ...] /home/dave/gnu/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/noreplace.cc:28: int main(): Assertion '! of.is_open()' failed. FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test Similar fail: /home/dave/gnu/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_ofstream/open/wchar_t/ noreplace.cc:28: int main(): Assertion '! of.is_open()' failed. FAIL: 27_io/basic_ofstream/open/wchar_t/noreplace.cc execution test
That test expects fopen("noreplace", "wx") to fail if the file already exists. Does this fail too? #include <stdio.h> #include <stddef.h> #include <assert.h> int main() { FILE* f = fopen("noreplace", "w"); assert(f != NULL); fclose(f); f = fopen("noreplace", "wx"); assert(f == NULL); }
I suspect hpux does not implement a c11 fopen but only a c99 one .. "x" was only added for c11 . Hpux11.11 came out in 2009 after all.
But then wouldn't using "x" with fopen fail, return NULL, and set errno to EINVAL? It shouldn't just ignore the "x".
My assumption was that targets that don't support exclusive mode for fopen would fail in exactly that way, and so using std::ios::noreplace would be "conservatively unsupported". That is, it would always fail to open the file, even if it doesn't exist. That seems acceptable. But this test FAIL suggests that the flag is just silently ignored, allowing non-exclusive access to the file. That is not acceptable, since the flag *appears* to work, but fails to establish the required invariant. Maybe we need #ifndef __hpux__ around the declaration and all uses of std::ios::noreplace.
Ignoring unknown fopen flags is traditional behavior which is still present today, both in BSD and GNU. Only the first character is actually checked and rejected if unknown.
Bah.
I think we need to make __cpp_lib_ios_noreplace depend on some new macro that is undefined by default, and defined manually in os_defines.h when we know it works. The won't work for musl though, as it uses the generic os_defines.h