[libcxx-commits] [PATCH] D146294: [libcxx] Fix crash in std::stringstream with payload >= INT_MAX
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun May 7 11:37:15 PDT 2023
Mordante added inline comments.
================
Comment at: libcxx/test/std/input.output/string.streams/stringstream.members/gcount.pass.cpp:19
+int main(int, char**) {
+#if __SIZE_WIDTH__ == 64
+ std::stringstream ss;
----------------
azat wrote:
> Mordante wrote:
> > Why is this needed? Can't you just compare that an int is 32-bit?
> >
> > I ideally I would rather make the test unsupported on platform that are not used. Otherwise this test gives a false sense of doing something.
> >
> > Maybe we should add a feature in `libcxx/utils/libcxx/test/features.py` Something like `can-test-gcount` Then we only enable it on 64-bit platforms where int is a 32-bit value. WDYT?
> Yeah, I did not like it either, but that was simpler.
>
> I don't think that introducing special flag only for one test will be a good choice however.
> What do you think about something like this instead:
>
> ```
> // UNSUPPORTED: target={{.*}}32{{.*}}
> ```
>
> But this will not work for some arches (not sure that they are added to CI), i.e. `x86`.
>
> So instead I could add a separate parameter `libcxx/utils/libcxx/test/params.py` something like `size_t_bytes`, although I'm not sure is there an easy way to extract this in python, maybe you have an idea?
The tests are also used outside libc++ so even when we don't test x86, other might test that platform.
I don't mind adding a feature for a few test test. We already have precedence for them. For example
1 user host-has-gdb-with-python
2 users for glibc-old-ru_RU-decimal-point
2 users for win32-broken-printf-g-precision
I'm not well enough versed in Python to know whether that's even possible. Even if it is I'm not sure whether Python uses the same widths as C++. I can imagine Python always using 64-bit integrals.
I'm not against your suggestion as long as we can do it reliable.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146294/new/
https://reviews.llvm.org/D146294
More information about the libcxx-commits
mailing list