[libcxx-commits] [libcxx] [libc++][AIX] Marking the tests UNSUPPORTED as the current implementation of fopen w+bx overrides ios::noreplace (PR #188425)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 25 09:47:39 PDT 2026
https://github.com/Himadhith updated https://github.com/llvm/llvm-project/pull/188425
>From 2e9a6f695f923d12b7fa59bab03961e312df28a6 Mon Sep 17 00:00:00 2001
From: himadhith <himadhith.v at ibm.com>
Date: Wed, 25 Mar 2026 05:17:26 -0400
Subject: [PATCH 1/2] [libc++][AIX] Marking the tests UNSUPPORTED as the
current implementation of fopen w+bx overrides ios::noreplace
---
.../fstreams/filebuf.members/open_pointer.pass.cpp | 3 ++-
.../file.streams/fstreams/fstream.cons/pointer.pass.cpp | 3 ++-
.../fstreams/fstream.members/open_pointer.pass.cpp | 3 ++-
.../file.streams/fstreams/ofstream.cons/pointer.pass.cpp | 3 ++-
.../fstreams/ofstream.members/open_pointer.pass.cpp | 3 ++-
5 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
index 9f617dc1e5a89..c680f69ca5472 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
@@ -13,7 +13,8 @@
// In C++23 and later, this test requires support for P2467R1 in the dylib (a3f17ba3febbd546f2342ffc780ac93b694fdc8d)
// XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18
-// XFAIL: LIBCXX-AIX-FIXME
+// fopen() with "w+bx" mode ignores the 'x' (exclusive) flag, allowing existing files to be opened and truncated, breaking C++23 ios_base::noreplace functionality.
+// UNSUPPORTED: target={{.*}}-aix{{.*}}
#include <fstream>
#include <cassert>
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
index 2e0ebcd684d79..51aa221938a44 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
@@ -16,7 +16,8 @@
// In C++23 and later, this test requires support for P2467R1 in the dylib (a3f17ba3febbd546f2342ffc780ac93b694fdc8d)
// XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18
-// XFAIL: LIBCXX-AIX-FIXME
+// fopen() with "w+bx" mode ignores the 'x' (exclusive) flag, allowing existing files to be opened and truncated, breaking C++23 ios_base::noreplace functionality.
+// UNSUPPORTED: target={{.*}}-aix{{.*}}
#include <fstream>
#include <cassert>
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
index 0d83d681b1dfc..20954f047a7aa 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
@@ -16,7 +16,8 @@
// In C++23 and later, this test requires support for P2467R1 in the dylib (a3f17ba3febbd546f2342ffc780ac93b694fdc8d)
// XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18
-// XFAIL: LIBCXX-AIX-FIXME
+// fopen() with "w+bx" mode ignores the 'x' (exclusive) flag, allowing existing files to be opened and truncated, breaking C++23 ios_base::noreplace functionality.
+// UNSUPPORTED: target={{.*}}-aix{{.*}}
#include <fstream>
#include <cassert>
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
index fbb03f1e85841..86b0bf246cb03 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
@@ -16,7 +16,8 @@
// In C++23 and later, this test requires support for P2467R1 in the dylib (a3f17ba3febbd546f2342ffc780ac93b694fdc8d)
// XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18
-// XFAIL: LIBCXX-AIX-FIXME
+// fopen() with "w+bx" mode ignores the 'x' (exclusive) flag, allowing existing files to be opened and truncated, breaking C++23 ios_base::noreplace functionality.
+// UNSUPPORTED: target={{.*}}-aix{{.*}}
#include <fstream>
#include <cassert>
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
index 73a474277a933..e91dc452440a5 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
@@ -16,7 +16,8 @@
// In C++23 and later, this test requires support for P2467R1 in the dylib (a3f17ba3febbd546f2342ffc780ac93b694fdc8d)
// XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18
-// XFAIL: LIBCXX-AIX-FIXME
+// fopen() with "w+bx" mode ignores the 'x' (exclusive) flag, allowing existing files to be opened and truncated, breaking C++23 ios_base::noreplace functionality.
+// UNSUPPORTED: target={{.*}}-aix{{.*}}
#include <fstream>
#include <cassert>
>From 6f724ec7db627f23c7d6c2c6be9170c1a9fc152b Mon Sep 17 00:00:00 2001
From: himadhith <himadhith.v at ibm.com>
Date: Wed, 25 Mar 2026 14:23:08 -0400
Subject: [PATCH 2/2] Modifying the test to expect the result as valid
---
.../filebuf.members/open_pointer.pass.cpp | 21 ++++++++++++++-----
.../fstreams/fstream.cons/pointer.pass.cpp | 21 ++++++++++++++-----
.../fstream.members/open_pointer.pass.cpp | 21 ++++++++++++++-----
.../fstreams/ofstream.cons/pointer.pass.cpp | 21 ++++++++++++++-----
.../ofstream.members/open_pointer.pass.cpp | 21 ++++++++++++++-----
5 files changed, 80 insertions(+), 25 deletions(-)
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
index c680f69ca5472..cf09dad1b8aa6 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
@@ -13,9 +13,6 @@
// In C++23 and later, this test requires support for P2467R1 in the dylib (a3f17ba3febbd546f2342ffc780ac93b694fdc8d)
// XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18
-// fopen() with "w+bx" mode ignores the 'x' (exclusive) flag, allowing existing files to be opened and truncated, breaking C++23 ios_base::noreplace functionality.
-// UNSUPPORTED: target={{.*}}-aix{{.*}}
-
#include <fstream>
#include <cassert>
#include "test_macros.h"
@@ -76,7 +73,14 @@ int main(int, char**)
{
std::filebuf f;
f.open(tmp.c_str(), mode);
- assert(!f.is_open()); // since it already exists
+ bool should_fail = true;
+# if defined(_AIX)
+ if (mode == (std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::noreplace |
+ std::ios_base::binary)) {
+ should_fail = false; // AIX bug: Allowing it to pass for wb+x until fixed
+ }
+# endif
+ assert(f.is_open() != should_fail);
}
{
@@ -95,7 +99,14 @@ int main(int, char**)
{
std::wfilebuf f;
f.open(tmp.c_str(), mode);
- assert(!f.is_open()); // since it already exists
+ bool should_fail = true;
+# if defined(_AIX)
+ if (mode == (std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::noreplace |
+ std::ios_base::binary)) {
+ should_fail = false; // AIX bug: Allowing it to pass for wb+x until fixed
+ }
+# endif
+ assert(f.is_open() != should_fail);
}
{
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
index 51aa221938a44..f2d36a0b73896 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
@@ -16,9 +16,6 @@
// In C++23 and later, this test requires support for P2467R1 in the dylib (a3f17ba3febbd546f2342ffc780ac93b694fdc8d)
// XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18
-// fopen() with "w+bx" mode ignores the 'x' (exclusive) flag, allowing existing files to be opened and truncated, breaking C++23 ios_base::noreplace functionality.
-// UNSUPPORTED: target={{.*}}-aix{{.*}}
-
#include <fstream>
#include <cassert>
@@ -92,7 +89,14 @@ int main(int, char**)
{
std::fstream f(tmp.c_str(), mode);
- assert(!f.is_open()); // since it already exists
+ bool should_fail = true;
+# if defined(_AIX)
+ if (mode == (std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::noreplace |
+ std::ios_base::binary)) {
+ should_fail = false; // AIX bug: Allowing it to pass for wb+x until fixed
+ }
+# endif
+ assert(f.is_open() != should_fail);
}
{
@@ -109,7 +113,14 @@ int main(int, char**)
{
std::wfstream f(tmp.c_str(), mode);
- assert(!f.is_open()); // since it already exists
+ bool should_fail = true;
+# if defined(_AIX)
+ if (mode == (std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::noreplace |
+ std::ios_base::binary)) {
+ should_fail = false; // AIX bug: Allowing it to pass for wb+x until fixed
+ }
+# endif
+ assert(f.is_open() != should_fail);
}
{
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
index 20954f047a7aa..342c5c594ae48 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
@@ -16,9 +16,6 @@
// In C++23 and later, this test requires support for P2467R1 in the dylib (a3f17ba3febbd546f2342ffc780ac93b694fdc8d)
// XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18
-// fopen() with "w+bx" mode ignores the 'x' (exclusive) flag, allowing existing files to be opened and truncated, breaking C++23 ios_base::noreplace functionality.
-// UNSUPPORTED: target={{.*}}-aix{{.*}}
-
#include <fstream>
#include <cassert>
#include "test_macros.h"
@@ -75,7 +72,14 @@ int main(int, char**)
{
std::fstream f;
f.open(tmp.c_str(), mode);
- assert(!f.is_open()); // since it already exists
+ bool should_fail = true;
+# if defined(_AIX)
+ if (mode == (std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::noreplace |
+ std::ios_base::binary)) {
+ should_fail = false; // AIX bug: Allowing it to pass for wb+x until fixed
+ }
+# endif
+ assert(f.is_open() != should_fail);
}
{
@@ -94,7 +98,14 @@ int main(int, char**)
{
std::wfstream f;
f.open(tmp.c_str(), mode);
- assert(!f.is_open()); // since it already exists
+ bool should_fail = true;
+# if defined(_AIX)
+ if (mode == (std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::noreplace |
+ std::ios_base::binary)) {
+ should_fail = false; // AIX bug: Allowing it to pass for wb+x until fixed
+ }
+# endif
+ assert(f.is_open() != should_fail);
}
{
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
index 86b0bf246cb03..048113e7f55eb 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
@@ -16,9 +16,6 @@
// In C++23 and later, this test requires support for P2467R1 in the dylib (a3f17ba3febbd546f2342ffc780ac93b694fdc8d)
// XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18
-// fopen() with "w+bx" mode ignores the 'x' (exclusive) flag, allowing existing files to be opened and truncated, breaking C++23 ios_base::noreplace functionality.
-// UNSUPPORTED: target={{.*}}-aix{{.*}}
-
#include <fstream>
#include <cassert>
#include <ios>
@@ -146,7 +143,14 @@ int main(int, char**)
{
std::ofstream f(tmp.c_str(), mode);
- assert(!f.is_open()); // since it already exists
+ bool should_fail = true;
+# if defined(_AIX)
+ if (mode == (std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::noreplace |
+ std::ios_base::binary)) {
+ should_fail = false; // AIX bug: Allowing it to pass for wb+x until fixed
+ }
+# endif
+ assert(f.is_open() != should_fail);
}
{
@@ -163,7 +167,14 @@ int main(int, char**)
{
std::wofstream f(tmp.c_str(), mode);
- assert(!f.is_open()); // since it already exists
+ bool should_fail = true;
+# if defined(_AIX)
+ if (mode == (std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::noreplace |
+ std::ios_base::binary)) {
+ should_fail = false; // AIX bug: Allowing it to pass for wb+x until fixed
+ }
+# endif
+ assert(f.is_open() != should_fail);
}
{
diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
index e91dc452440a5..4ab28b4ceeac1 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
@@ -16,9 +16,6 @@
// In C++23 and later, this test requires support for P2467R1 in the dylib (a3f17ba3febbd546f2342ffc780ac93b694fdc8d)
// XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18
-// fopen() with "w+bx" mode ignores the 'x' (exclusive) flag, allowing existing files to be opened and truncated, breaking C++23 ios_base::noreplace functionality.
-// UNSUPPORTED: target={{.*}}-aix{{.*}}
-
#include <fstream>
#include <cassert>
#include "test_macros.h"
@@ -83,7 +80,14 @@ int main(int, char**)
{
std::ofstream f;
f.open(tmp.c_str(), mode);
- assert(!f.is_open()); // since it already exists
+ bool should_fail = true;
+# if defined(_AIX)
+ if (mode == (std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::noreplace |
+ std::ios_base::binary)) {
+ should_fail = false; // AIX bug: Allowing it to pass for wb+x until fixed
+ }
+# endif
+ assert(f.is_open() != should_fail);
}
{
@@ -102,7 +106,14 @@ int main(int, char**)
{
std::wofstream f;
f.open(tmp.c_str(), mode);
- assert(!f.is_open()); // since it already exists
+ bool should_fail = true;
+# if defined(_AIX)
+ if (mode == (std::ios_base::in | std::ios_base::out | std::ios_base::trunc | std::ios_base::noreplace |
+ std::ios_base::binary)) {
+ should_fail = false; // AIX bug: Allowing it to pass for wb+x until fixed
+ }
+# endif
+ assert(f.is_open() != should_fail);
}
{
std::remove(tmp.c_str());
More information about the libcxx-commits
mailing list