[libcxx-commits] [libcxx] [openmp] [libc++] basic_ios<wchar_t> cannot store fill character WCHAR_MAX (PR #89305)

Xing Xue via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 12 07:58:54 PDT 2024


================
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Test that weof as a wchar_t value can be set as the fill character.
+
+// UNSUPPORTED: no-wide-characters
+// REQUIRES: target=powerpc{{(64)?}}-ibm-aix || target=s390x-ibm-zos || libcpp-abi-version=2
----------------
xingxue-ibm wrote:

@ldionne The test case fails the CI on various targets after `REQUIRES` is removed. This is because without it, it goes through `libcpp-abi-version=1` path and therefore, uses class `_SentinelValueFill` for these targets. Setting the `__fill_val_` to `WEOF` causes the `os.fill()` call in `assert` to re-initialize `__fill_val` with `widen(` `)` and uses it as the return value and therefore, fails the assert.

As per discussion with @daltenty, we think it is wrong to set `WEOF` for the test because it is not a valid wide character. We should use `WCHAR_MAX` instead. By setting `WCHAR_MAX`, we can test the implementation on AIX and zOS where `WEOF` is the same as `WCHAR_MAX` as well as on other targets without `REQUIRES`. The test case would fail on other targets if `WEOF` is also the same as `WCHAR_MAX`.

https://github.com/llvm/llvm-project/pull/89305


More information about the libcxx-commits mailing list