public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
@ 2023-01-05 20:03 danglin at gcc dot gnu.org
  2023-01-06  9:40 ` [Bug libstdc++/108305] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: danglin at gcc dot gnu.org @ 2023-01-05 20:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305

            Bug ID: 108305
           Summary: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc
                    execution test
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
  Target Milestone: ---
              Host: hppa64-hp-hpux11.11
            Target: hppa64-hp-hpux11.11
             Build: hppa64-hp-hpux11.11

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
  2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
@ 2023-01-06  9:40 ` redi at gcc dot gnu.org
  2023-01-06  9:51 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-06  9:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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);
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
  2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
  2023-01-06  9:40 ` [Bug libstdc++/108305] " redi at gcc dot gnu.org
@ 2023-01-06  9:51 ` pinskia at gcc dot gnu.org
  2023-01-06 11:04 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-06  9:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
  2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
  2023-01-06  9:40 ` [Bug libstdc++/108305] " redi at gcc dot gnu.org
  2023-01-06  9:51 ` pinskia at gcc dot gnu.org
@ 2023-01-06 11:04 ` redi at gcc dot gnu.org
  2023-01-06 11:09 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-06 11:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
But then wouldn't using "x" with fopen fail, return NULL, and set errno to
EINVAL?

It shouldn't just ignore the "x".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
  2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-06 11:04 ` redi at gcc dot gnu.org
@ 2023-01-06 11:09 ` redi at gcc dot gnu.org
  2023-01-06 13:32 ` schwab@linux-m68k.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-06 11:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
  2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-06 11:09 ` redi at gcc dot gnu.org
@ 2023-01-06 13:32 ` schwab@linux-m68k.org
  2023-01-06 13:46 ` redi at gcc dot gnu.org
  2023-08-16 10:43 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: schwab@linux-m68k.org @ 2023-01-06 13:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305

--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> ---
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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
  2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-01-06 13:32 ` schwab@linux-m68k.org
@ 2023-01-06 13:46 ` redi at gcc dot gnu.org
  2023-08-16 10:43 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-06 13:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-01-06
             Status|UNCONFIRMED                 |NEW

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Bah.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
  2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-01-06 13:46 ` redi at gcc dot gnu.org
@ 2023-08-16 10:43 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-08-16 10:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-08-16 10:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
2023-01-06  9:40 ` [Bug libstdc++/108305] " redi at gcc dot gnu.org
2023-01-06  9:51 ` pinskia at gcc dot gnu.org
2023-01-06 11:04 ` redi at gcc dot gnu.org
2023-01-06 11:09 ` redi at gcc dot gnu.org
2023-01-06 13:32 ` schwab@linux-m68k.org
2023-01-06 13:46 ` redi at gcc dot gnu.org
2023-08-16 10:43 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).