[committed] libstdc++: Fix std::format for localized floats [PR110968]

2023-08-10 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 to follow. -- >8 -- The __formatter_fp::_M_localize function just returns an empty string if the formatting locale is the C locale, as there is nothing to do. But the caller was assuming that the returned string contains the localized strin

[committed] libstdc++: Use alias template for iterator_category [PR110970]

2023-08-10 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 to follow. -- >8 -- This renames __iterator_category_t to __iter_category_t, for consistency with std::iter_value_t, std::iter_difference_t and std::iter_reference_t in C++20. Then use __iter_category_t in , which fixes the problem of the m

[committed] libstdc++: Fix out-of-bounds read in format string "{:{}." [PR110974]

2023-08-10 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 to follow. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/110974 * include/std/format (_Spec::_S_parse_width_or_precision): Check for empty range before dereferencing iterator. * testsuite/std/format/string.c

Re: [committed] libstdc++: Use alias template for iterator_category [PR110970]

2023-08-10 Thread Jonathan Wakely via Gcc-patches
On Thu, 10 Aug 2023 at 23:34, Jonathan Wakely via Libstdc++ < libstd...@gcc.gnu.org> wrote: > Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 to follow. > > -- >8 -- > > This renames __iterator_category_t to __iter_category_t, for consistency > with std::iter_value_t, std::iter_difference

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-11 Thread Jonathan Wakely via Gcc-patches
On Fri, 11 Aug 2023, 06:44 François Dumont via Libstdc++, < libstd...@gcc.gnu.org> wrote: > I hadn't tested the most basic default configuration and it is failing, I did wonder about that when you said which configurations you had tested :) > I need some more time yet. > OK, no problem. I

[committed] libstdc++: Revert accidentally committed change to bits/stl_iterator.h

2023-08-11 Thread Jonathan Wakely via Gcc-patches
As promised yesterday, this reverts the part of the change I didn't mean to commit. Tested x86_64-linux. Pushed to trunk. -- >8 -- In commit r14-3134-g9cb2a7c8d54b1f I only meant to change some uses of __clamp_iter_cat to use __iter_category_t, I didn't mean to commit the additional change introd

[committed] libstdc++: Handle invalid values in std::chrono pretty printers

2023-08-11 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, Pushed to trunk. I'll backport this to gcc-13 too. -- >8 -- This avoids an IndexError exception when printing invalid chrono::month or chrono::weekday values. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdChronoCalendarPrinter): Check for out

[committed] libstdc++: Do not call log10(0.0) in std::format [PR110860]

2023-08-11 Thread Jonathan Wakely via Gcc-patches
Second attempt to fix this PR. Tested x86_64-linux, pushed to trunk. -- >8 -- Calling log10(0.0) returns -inf which has undefined behaviour when converted to an integer. We only need to use log10 for large values anyway. If the value is zero then the larger buffer is only needed due to a large pr

[committed] libstdc++: Implement C++20 std::chrono::parse [PR104167]

2023-08-11 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. This is a pure addition that only affects C++20 mode, so I'm considering backporting it to gcc-13 at some point (once any dust has settled from landing it on trunk). -- >8 -- This adds the missing C++20 features to . I've implemented my proposed resolutions

[committed] libstdc++: Fix std::format_to_n return value [PR110990]

2023-08-11 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 also needed. -- >8 -- When writing to a contiguous iterator, std::format_to_n(out, n, ...) always returns out + n, even if it wrote fewer than n characters to the iterator. The problem is in the _M_finish() member function of the _Iter_sin

Re: [PATCH] x86: Update model values for Raptorlake.

2023-08-14 Thread Jonathan Wakely via Gcc-patches
On 14/08/23 04:37 +, Pan Li via Gcc-patches wrote: Committed as obvious, and backported to GCC13. Did you try building it on gcc-13? case 0x97: case 0x9a: case 0xbf: /* Alder Lake. */ case 0xb7: case 0xba: case 0xbf: /* Raptor Lake. */ This fails: I

Re: [PATCH] x86: Update model values for Raptorlake.

2023-08-14 Thread Jonathan Wakely via Gcc-patches
On 14/08/23 15:19 +0100, Jonathan Wakely wrote: On 14/08/23 04:37 +, Pan Li via Gcc-patches wrote: Committed as obvious, and backported to GCC13. Did you try building it on gcc-13? case 0x97: case 0x9a: case 0xbf: /* Alder Lake. */ case 0xb7: case 0xba: case 0xbf:

Re: [PATCH] Fix for bug libstdc++/110860

2023-08-14 Thread Jonathan Wakely via Gcc-patches
On Mon, 14 Aug 2023 at 10:58, Paul Dreik via Libstdc++ < libstd...@gcc.gnu.org> wrote: > The patch below fixes an issue with the fix already committed for > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110860 which unfortunately > was not sufficient for small magnitude floating point values. > > W

Re: [PATCH v2 1/2] libstdc++: Implement more maintainable header

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Sun, 13 Aug 2023 at 21:15, Arsen Arsenović via Libstdc++ wrote: > > This commit replaces the ad-hoc logic in with an AutoGen > database that (mostly) declaratively generates a version.h bit which > combines all of the FTM logic across all headers together. > > This generated header defines mac

Re: [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Sun, 13 Aug 2023 at 21:16, Arsen Arsenović via Libstdc++ wrote: > > libstdc++-v3/ChangeLog: > > * libsupc++/typeinfo: Switch to bits/version.h for > __cpp_lib_constexpr_typeinfo. > * libsupc++/new: Switch to bits/version.h for > __cpp_lib_{launder,hardware_interf

Re: [PATCH] libstdc++ Add cstdarg to freestanding

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Fri, 21 Jul 2023 at 22:23, Paul M. Bendixen via Libstdc++ wrote: > > P1642 includes the header cstdarg to the freestanding implementation. > This was probably left out by accident, this patch puts it in. > Since this is one of the headers that go in whole cloth, there should be no > further act

[committed] libstdc++: Fix comment naming upstream PSTL test file

2023-08-16 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk. -- >8 -- These tests were derived from set.pass.cpp not set.pass.cc, specifically pstl/test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp in the LLVM repo. libstdc++-v3/ChangeLog: * testsuite/25_algorithms/pstl/alg_sorting/set_difference.cc: Fix nam

Re: [PATCH] libstdc++: Implement P2770R0 changes to join_view / join_with_view

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Wed, 16 Aug 2023 at 17:05, Patrick Palka via Libstdc++ wrote: > > On Mon, Apr 17, 2023 at 9:39 AM Patrick Palka wrote: > > > > This C++23 paper fixes a bug in these views when adapting a certain kind > > of non-forward range, and we treat it as a DR against C++20. > > > > Tested on x86_64-pc-l

Re: [PATCH] libstdc++: Make __max_size_type and __max_diff_type structural

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Wed, 16 Aug 2023 at 17:07, Patrick Palka via Libstdc++ wrote: > > On Mon, Apr 24, 2023 at 12:23 PM Patrick Palka wrote: > > > > This patch makes these integer-class type structural types by changing > > their private data members into public ones, which allows them to be > > used as NTTP types

Re: [PATCH 1/2] libstdc++: Convert _RangeAdaptorClosure into a CRTP class [PR108827]

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Wed, 16 Aug 2023 at 17:06, Patrick Palka via Libstdc++ wrote: > > On Sun, Apr 16, 2023 at 11:24 PM Patrick Palka wrote: > > > > On Fri, 14 Apr 2023, Patrick Palka wrote: > > > > > Using the CRTP idiom for this base class avoids bloating the size of a > > > pipeline when adding distinct empty r

Re: [PATCH] libstdc++: fix memory clobbering in std::vector [PR110879]

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On 09/08/23 01:34 +0300, Vladimir Palevich wrote: Because of the recent change in _M_realloc_insert and _M_default_append, call to deallocate was ordered after assignment to class members of std::vector (in the guard destructor), which is causing said members to be call-clobbered. This is prevent

[committed] libstdc++: Update __cplusplus value for C++23 in version.def

2023-08-16 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/bits/version.def (stds): Update value for C++23. * include/bits/version.h: Regenerate. --- libstdc++-v3/include/bits/version.def | 2 +- libstdc++-v3/include/bits/version.h | 72 +

[committed] libstdc++: Fix std::basic_string::resize_and_overwrite

2023-08-16 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. This should be backported to gcc-12 and gcc-13 too (without the std::format test changes). -- >8 -- The callable used for resize_and_overwrite was being passed the string's expanded capacity, which might be greater than the new size being requested. This is n

Re: [PATCH v2 1/2] libstdc++: Implement more maintainable header

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Wed, 16 Aug 2023 at 22:39, David Edelsohn wrote: > > Hi, Arsen > > This patch broke bootstrap because it has introduced a new GCC build > requirement for autogen that is not a previous requirement to build GCC. > Previously the repository has included post-processed files. The repo does inc

Re: [PATCH v2 1/2] libstdc++: Implement more maintainable header

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Wed, 16 Aug 2023 at 22:56, Jonathan Wakely wrote: > > On Wed, 16 Aug 2023 at 22:39, David Edelsohn wrote: > > > > Hi, Arsen > > > > This patch broke bootstrap because it has introduced a new GCC build > > requirement for autogen that is not a previous requirement to build GCC. > > Previousl

Re: [PATCH] libstdc++: fix memory clobbering in std::vector [PR110879]

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On 09/08/23 01:34 +0300, Vladimir Palevich wrote: Because of the recent change in _M_realloc_insert and _M_default_append, call to deallocate was ordered after assignment to class members of std::vector (in the guard destructor), which is causing said members to be call-clobbered. This is prevent

[committed] libstdc++: Fix testsuite no_pch directive

2023-08-17 Thread Jonathan Wakely via Gcc-patches
A new test I added was failing with -std=gnu++23 because that flag was removed from the test options (but only after checking if it met the c++20 effective target). Tested x86_64-linux. Pushed to trunk. -- >8 -- The { dg-add-options no_pch } directive is supposed to add a macro definition that i

[committed] libstdc++: Disable PCH for tests that rely on include order

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Now that no_pch works, I can use it to fix this test that was failing with PCH enabled and run with -std=gnu++23. Tested x86_64-linux. Pushed to trunk. -- >8 -- These tests expect to be able to #undef a feature test macro and then include to get it redefined. But if has already been included b

[committed] libstdc++: Regenerate Makefile.in

2023-08-17 Thread Jonathan Wakely via Gcc-patches
This target in include/Makefile.am was supposed to ensure that nobody building gcc would need autogen to regenerate the bits/version.h header, but it didn't make it in to include/Makefile.in. Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/Makefile.in: R

[committed] libstdc++: Fix std::format("{:F}", inf) to use uppercase

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 will follow. -- >8 -- std::format was treating {:f} and {:F} identically on the basis that for the fixed 1.234567 format there are no alphabetical characters that need to be in uppercase. But that's wrong for infinities and NaNs, which shou

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Sun, 13 Aug 2023 at 14:27, François Dumont via Libstdc++ wrote: > > Here is the fixed patch tested in all 3 modes: > > - _GLIBCXX_USE_DUAL_ABI > > - !_GLIBCXX_USE_DUAL_ABI && !_GLIBCXX_USE_CXX11_ABI > > - !_GLIBCXX_USE_DUAL_ABI && _GLIBCXX_USE_CXX11_ABI > > I don't know what you have in mind fo

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 18:40, François Dumont wrote: > > > On 17/08/2023 19:22, Jonathan Wakely wrote: > > On Sun, 13 Aug 2023 at 14:27, François Dumont via Libstdc++ > > wrote: > >> Here is the fixed patch tested in all 3 modes: > >> > >> - _GLIBCXX_USE_DUAL_ABI > >> > >> - !_GLIBCXX_USE_DUAL_AB

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 19:59, Jonathan Wakely wrote: > > On Thu, 17 Aug 2023 at 18:40, François Dumont wrote: > > > > > > On 17/08/2023 19:22, Jonathan Wakely wrote: > > > On Sun, 13 Aug 2023 at 14:27, François Dumont via Libstdc++ > > > wrote: > > >> Here is the fixed patch tested in all 3 mode

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 20:37, Jonathan Wakely wrote: > > On Thu, 17 Aug 2023 at 19:59, Jonathan Wakely wrote: > > > > On Thu, 17 Aug 2023 at 18:40, François Dumont wrote: > > > > > > > > > On 17/08/2023 19:22, Jonathan Wakely wrote: > > > > On Sun, 13 Aug 2023 at 14:27, François Dumont via Libst

[committed] libstdc++: Define std::string::resize_and_overwrite for C++11 and COW string

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- There are several places in the library where we can improve performance using resize_and_overwrite so it's inconvenient only being able to use it in C++23 mode, and only for cxx11 strings. This adds it for COW strings, and also adds __resize_and_ove

[committed] libstdc++: Optimize std::to_string using std::string::resize_and_overwrite

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This uses std::string::__resize_and_overwrite to avoid initializing the string buffer with characters that are immediately overwritten. This results in about 6% better performance for the std_to_string case in int-benchmark.cc from https://github.com

[committed] libstdc++: Fix -Wunused-parameter in

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/experimental/internet (address_v4::to_string): Remove unused parameter name. --- libstdc++-v3/include/experimental/internet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstd

[committed] libstdc++: Implement std::to_string in terms of std::format (P2587R3)

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This change for C++26 affects std::to_string for floating-point arguments, so that they should be formatted using std::format("{}", v) instead of using sprintf. The modified specification in the standard also affects integral arguments, but there's n

[committed] libstdc++: Optimize std::string::assign(Iter, Iter) [PR110945]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- Calling string::assign(Iter, Iter) with "foreign" iterators (not the string's own iterator or pointer types) currently constructs a temporary string and then calls replace to copy the characters from it. That means we copy from the iterators twice, a

[committed] libstdc++: Rework std::format support for wchar_t

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This changes how std::format creates wide strings, by replacing uses of std::ctype::widen with the recently-added __to_wstring_numeric helper function. This removes the dependency on the locale, which should only be used for locale-specific formats s

[committed] libstdc++: Simplify chrono::__units_suffix using std::format

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 to follow. -- >8 -- For std::chrono formatting we can simplify __units_suffix by using std::format_to to generate the "[n/m]s" suffix with the correct character type and write directly to the output iterator, so it doesn't need to be widene

[committed] libstdc++: Micro-optimize construction of named std::locale

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This shaves about 100ns off the std::locale constructor for named locales (which is only about 1% of the total time). Using !*s instead of !strcmp(s, "") doesn't make any difference as GCC optimizes that already even at -O1. !strcmp(s, "C") is optim

[committed] libstdc++: Make __cmp_cat::__unseq constructor consteval

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Probably good to backport. -- >8 -- This constructor should only ever be used with a literal 0 as the argument, so we can make it consteval. This has the nice advantage that it is expanded immediately in the front end, and so GDB will never step into the __cm

[committed] libstdc++: Reuse double overload of __convert_to_v if possible

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- For targets where double and long double have the same representation we can reuse the same __convert_to_v code for both types. This will slightly reduce the size of the compiled code in the library. libstdc++-v3/ChangeLog: * config/locale/

[committed] libstdc++: Define std::numeric_limits<_FloatNN> before C++23

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- The extended floating-point types such as _Float32 are supported by GCC prior to C++23, you just can't use the standard-conforming names from to refer to them. This change defines the specializations of std::numeric_limits for those types for older

[committed] libstdc++: Add std::formatter specializations for extended float types

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This makes it possible to format _Float32, _Float64 etc. in C++20 mode. Previously it was only possible to format them in C++23 when the typedefs and the std::to_chars overloads were defined. Instead of relying on std::to_chars for those types, we

[committed] libstdc++: Replace global std::string objects in tzdb.cc

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- When the library is built with --disable-libstdcxx-dual-abi the only type of std::string supported is the COW string, and the two global std::string objects in tzdb.cc have to allocate memory. I added them thinking they would fit in the SSO string bu

Re: [committed] libstdc++: Reuse double overload of __convert_to_v if possible

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Fri, 18 Aug 2023 at 00:20, Hans-Peter Nilsson wrote: > > > Date: Thu, 17 Aug 2023 21:32:29 +0100 > > From: Jonathan Wakely via Gcc-patches > > > Tested x86_64-linux. Pushed to trunk. > > Does the below typo imply that for x86_64-linux, > "__DBL_MANT_DI

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 20:44, Jonathan Wakely wrote: > > On Thu, 17 Aug 2023 at 20:37, Jonathan Wakely wrote: > > > > On Thu, 17 Aug 2023 at 19:59, Jonathan Wakely wrote: > > > > > > On Thu, 17 Aug 2023 at 18:40, François Dumont > > > wrote: > > > > > > > > > > > > On 17/08/2023 19:22, Jonatha

[committed] libstdc++: Fix incomplete rework of wchar_t support in std::format

2023-08-18 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- r14-3300-g023a62b77f999b left make_wformat_args and some uses of std::wformat_context unguarded by _GLIBCXX_USE_WCHAR_T. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (operator<<): Use __format_context. * include/std/format (__

[committed] libstdc++: Replace non-type-dependent uses of wchar_t in and

2023-08-18 Thread Jonathan Wakely via Gcc-patches
This should be really fixed now! Tested x86_64-linux. Pushed to trunk. -- >8 -- This is one more piece of the rework to make wchar_t support in std::format depend on _GLIBCXX_USE_WCHAR_T. In the __to_wstring_numeric function is called with arguments that aren't type-dependent, so a declaration

[committed] libstdc++: Revert pre-C++23 support for 16-bit float types [PR111060]

2023-08-18 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux (--with-arch-32=i686). Pushed to trunk. -- >8 -- In r14-3304-g1a566fddea212a and r14-3305-g6cf214b4fc97f5 I tried to enable std::format for 16-bit float types before C++23. This causes errors for targets where the types are defined but can't actually be used, e.g. i686 without

Re: [committed] libstdc++: Fix std::format("{:F}", inf) to use uppercase

2023-08-19 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 13:22, Jonathan Wakely via Libstdc++ wrote: > > Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 will follow. Re the backport, I forgot to say that this changes the order/values of the enumerators for _Pres_type. In theory that could cause incompatibilities between

[committed] libstdc++: Remove reliance on unspecified behaviour in std::rethrow_if_nested test

2023-08-21 Thread Jonathan Wakely via Gcc-patches
This is the patch resolving the non-portable test that Iain raised in: https://gcc.gnu.org/pipermail/libstdc++/2023-August/056534.html Tested x86_64-linux. Pushed to trunk. Backports would be OK, but I don't think they are needed. -- >8 -- This test case calls std::set_terminate while there is

Re: [PATCH] Fix tests sensitive to internal library allocations

2023-08-21 Thread Jonathan Wakely via Gcc-patches
On Mon, 21 Aug 2023 at 18:05, François Dumont via Libstdc++ wrote: > > Hi > > Here is a propocal to fix tests sensitive to libstdc++ internal allocations. Surely the enter() and exit() calls should be a constructor and destructor? The constructor could use count() to get the count, and then rest

Re: [PATCH 0/2] libstdc++: Documentation fixes.

2023-08-21 Thread Jonathan Wakely via Gcc-patches
On Mon, 21 Aug 2023, 21:33 Bruno Victal, wrote: > This small patch-series fixes the 'doc-install-info' rule > and updates the URI used for docbook-xsl. > Thanks! I'll get these committed tomorrow. > Bruno Victal (2): > libstdc++: Fix 'doc-install-info' rule. > libstdc++: Update docbook xs

Re: [PATCH] Fix tests sensitive to internal library allocations

2023-08-21 Thread Jonathan Wakely via Gcc-patches
On Mon, 21 Aug 2023 at 21:20, François Dumont wrote: > > Here is the updated and tested patch. OK for trunk, thanks. We could consider it for the branches too (I'm going to remove the global strings on the gcc-13 branch tomorrow). > > On 21/08/2023 20:07, Jonathan Wakely wrote: > > On Mon, 21

Re: [libstdc++] Improve M_check_len

2023-06-19 Thread Jonathan Wakely via Gcc-patches
On Sun, 18 Jun 2023 at 19:37, Jan Hubicka wrote: > Hi, > _M_check_len is used in vector reallocations. It computes __n + __s but > does > checking for case that (__n + __s) * sizeof (Tp) would overflow ptrdiff_t. > Since we know that __s is a size of already allocated memory block if __n > is > n

Re: [libstdc++] Improve M_check_len

2023-06-19 Thread Jonathan Wakely via Gcc-patches
On Mon, 19 Jun 2023 at 12:20, Jakub Jelinek wrote: > On Mon, Jun 19, 2023 at 01:05:36PM +0200, Jan Hubicka via Gcc-patches > wrote: > > - if (max_size() - size() < __n) > > - __throw_length_error(__N(__s)); > > + const size_type __max_size = max_size(); > > + // On 64bit systems

Re: [libstdc++] Improve M_check_len

2023-06-19 Thread Jonathan Wakely via Gcc-patches
P.S. please CC libstd...@gcc.gnu.org for all libstdc++ patches. On Mon, 19 Jun 2023 at 16:13, Jonathan Wakely wrote: > On Mon, 19 Jun 2023 at 12:20, Jakub Jelinek wrote: > >> On Mon, Jun 19, 2023 at 01:05:36PM +0200, Jan Hubicka via Gcc-patches >> wrote: >> > - if (max_size() - size() < __n)

Re: [libstdc++] Improve M_check_len

2023-06-19 Thread Jonathan Wakely via Gcc-patches
On Mon, 19 Jun 2023 at 16:13, Jonathan Wakely wrote: > On Mon, 19 Jun 2023 at 12:20, Jakub Jelinek wrote: > >> On Mon, Jun 19, 2023 at 01:05:36PM +0200, Jan Hubicka via Gcc-patches >> wrote: >> > - if (max_size() - size() < __n) >> > - __throw_length_error(__N(__s)); >> > + const si

Re: [committed] libstdc++: Optimize std::to_array for trivial types [PR110167]

2023-06-20 Thread Jonathan Wakely via Gcc-patches
On Tue, 20 Jun 2023 at 01:54, Patrick Palka wrote: > On Fri, 9 Jun 2023, Jonathan Wakely via Libstdc++ wrote: > > > Tested powerpc64le-linux. Pushed to trunk. > > > > This makes sense to backport after some soak time on trunk. > > > > -- >8 -- > > > > As reported in PR libstdc++/110167, std::to_a

Re: [libstdc++] Improve M_check_len

2023-06-20 Thread Jonathan Wakely via Gcc-patches
On Tue, 20 Jun 2023 at 09:21, Andreas Schwab wrote: > On Jun 20 2023, Jakub Jelinek via Gcc-patches wrote: > > > Is it safe even on 64bit targets? I mean, doesn't say PowerPC already > allow > > full 64-bit virtual address space? The assumption that one can't have > > more than half of virtual a

Re: [libstdc++] Improve M_check_len

2023-06-20 Thread Jonathan Wakely via Gcc-patches
On Tue, 20 Jun 2023 at 11:45, Jonathan Wakely wrote: > On Tue, 20 Jun 2023 at 09:21, Andreas Schwab wrote: > >> On Jun 20 2023, Jakub Jelinek via Gcc-patches wrote: >> >> > Is it safe even on 64bit targets? I mean, doesn't say PowerPC already >> allow >> > full 64-bit virtual address space? The

[PATCH] libstdc++: Use RAII in std::vector::_M_realloc_insert

2023-06-20 Thread Jonathan Wakely via Gcc-patches
I intend to push this to trunk once testing finishes. I generated the diff with -b so the whitespace changes aren't shown, because there was some re-indenting that makes the diff look larger than it really is. Honza, I don't think this is likely to make much difference for the PR 110287 testcases

Re: [committed] libstdc++: Optimize std::to_array for trivial types [PR110167]

2023-06-20 Thread Jonathan Wakely via Gcc-patches
On Tue, 20 Jun 2023 at 09:29, Jonathan Wakely wrote: > > > On Tue, 20 Jun 2023 at 01:54, Patrick Palka wrote: > >> On Fri, 9 Jun 2023, Jonathan Wakely via Libstdc++ wrote: >> >> > Tested powerpc64le-linux. Pushed to trunk. >> > >> > This makes sense to backport after some soak time on trunk. >>

[committed] [gcc-12] libstdc++: avoid bogus -Wrestrict [PR105651]

2023-06-21 Thread Jonathan Wakely via Gcc-patches
I've pushed Jason's patch from https://gcc.gnu.org/PR105651#c17 to the gcc-12 branch, because Jakub's fix on gcc-13 isn't possible to backport. Tested x86_64-linux, pushed to gcc-12. -- >8 -- PR tree-optimization/105651 libstdc++-v3/ChangeLog: * include/bits/basic_string.tcc (_

Re: [PATCH] libstdc++: Use RAII in std::vector::_M_realloc_insert

2023-06-23 Thread Jonathan Wakely via Gcc-patches
On Fri, 23 Jun 2023 at 17:44, Jan Hubicka wrote: > > I intend to push this to trunk once testing finishes. > > > > I generated the diff with -b so the whitespace changes aren't shown, > > because there was some re-indenting that makes the diff look larger than > > it really is. > > > > Honza, I do

[committed] libstdc++: Qualify calls to debug mode helpers

2023-06-26 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- These functions should be qualified to disable unwanted ADL. The overload of __check_singular_aux for safe iterators was previously being found by ADL, because it wasn't declared before __check_singular. Add a declaration so that it can be found by

[committed] libstdc++: Implement P2538R1 ADL-proof std::projected

2023-06-26 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This was recently approved for C++26, but there's no harm in implementing it unconditionally for C++20 and C++23. As it says in the paper, it doesn't change the meaning of any valid code. It only enables things that were previously ill-formed for que

[committed] libstdc++: Fix std::format for pointers [PR110239]

2023-06-26 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- The formatter for pointers was casting to uint64_t which sign extends a 32-bit pointer and produces a value that won't fit in the provided buffer. Cast to uintptr_t instead. There was also a bug in the __parse_integer helper when converting a wide s

Re: [PATCH] libstdc++: Use RAII in std::vector::_M_realloc_insert

2023-06-28 Thread Jonathan Wakely via Gcc-patches
On Wed, 28 Jun 2023 at 08:56, Jan Hubicka wrote: > > I think the __throw_bad_alloc() and __throw_bad_array_new_length() > > functions should always be rare, so marking them cold seems fine (users > who > > define their own allocators that want to throw bad_alloc "often" will > > probably throw it

Re: [PATCH] Relax type-printer regexp in libstdc++ test suite

2023-06-28 Thread Jonathan Wakely via Gcc-patches
On Wed, 28 Jun 2023 at 16:58, Tom Tromey via Libstdc++ < libstd...@gcc.gnu.org> wrote: > The libstdc++ test suite checks whether gdb type printers are > available like so: > > set do_whatis_tests [gdb_batch_check "python print(gdb.type_printers)" > \ >"\\\[\\\]"] >

Re: [committed] libstdc++: Fix preprocessor conditions for std::from_chars [PR109921]

2023-06-29 Thread Jonathan Wakely via Gcc-patches
On Thu, 1 Jun 2023 at 12:05, Jonathan Wakely wrote: > On Thu, 1 Jun 2023 at 10:30, Christophe Lyon via Libstdc++ > wrote: > > > > Hi, > > > > > > On Wed, 31 May 2023 at 14:25, Jonathan Wakely via Gcc-patches < > > gcc-patches@gcc.gnu.org> wrot

[committed] libstdc++: Fix src/c++20/tzdb.cc for non-constexpr std::mutex

2023-06-29 Thread Jonathan Wakely via Gcc-patches
This build failure for riscv32-esp-elf was "reported" on the gcc-help list: https://gcc.gnu.org/pipermail/gcc-help/2023-June/142641.html Tested x86_64-linux. Pushed to trunk. -- >8 -- Building libstdc++ reportedly fails for targets without lock-free std::atomic which don't define __GTHREAD_MUTEX

[committed] libstdc++: Do not use off64_t in calls to copy_file_range [PR110462]

2023-06-29 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- Although the copy_file_range(2) man page shows the arguments as off64_t* that is not portable. For musl there is no off64_t type, as off_t is always 64-bit. Use the loff_t type which is always 64-bit even if off_t isn't. We could just use off_t becau

Re: [PATCH] Relax type-printer regexp in libstdc++ test suite

2023-06-29 Thread Jonathan Wakely via Gcc-patches
On Thu, 29 Jun 2023 at 17:59, Tom Tromey wrote: > > Jonathan Wakely writes: > > > Looks good. OK for trunk, and OK to backport after some soak time on > trunk. Thanks. > > AdaCore doesn't need a backport of this, and I don't think it's > extremely important; so unless you want me to do it, I

Re: PR108672 re-fixed after [PATCH] libstdc++: Synchronize PSTL with upstream

2023-06-30 Thread Jonathan Wakely via Gcc-patches
On Fri, 30 Jun 2023 at 04:48, Hans-Peter Nilsson wrote: > > > Date: Mon, 26 Jun 2023 11:57:49 -0700 > > From: Thomas Rodgers via Gcc-patches > > > On Wed, May 17, 2023 at 12:32 PM Jonathan Wakely wrote: > > > All the actual code changes look good. > > Unfortunately, this overwrote the fix for PR1

Re: PR108672 re-fixed after [PATCH] libstdc++: Synchronize PSTL with upstream

2023-06-30 Thread Jonathan Wakely via Gcc-patches
On Fri, 30 Jun 2023 at 09:42, Jonathan Wakely wrote: > > On Fri, 30 Jun 2023 at 04:48, Hans-Peter Nilsson wrote: > > > > > Date: Mon, 26 Jun 2023 11:57:49 -0700 > > > From: Thomas Rodgers via Gcc-patches > > > > > On Wed, May 17, 2023 at 12:32 PM Jonathan Wakely > > > wrote: > > > > All the act

[committed] libstdc++: Make std::random_device throw more std::system_error [PR105081]

2023-06-30 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- In r14-289-gf9412cedd6c0e7 I made the std::random_device constructor throw std::system_error for unrecognized tokens. But it still throws std::runtime_error for a token such as "rdseed" that is recognized but not supported at runtime by the CPU the p

[PATCH] libstdc++: Fix iostream init for Clang on darwin [PR110432]

2023-06-30 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Patrick, PTAL. -- >8 -- The __has_attribute(init_priority) check in is true for Clang on darwin, which means that user code including thinks the library will initialize the global streams. However, when libstdc++ is built by GCC on darwin, the __has_attribute(init_priority)

[committed] libstdc++: Fix unused warning for new variable

2023-06-30 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux and x86_64-linux. Pushed to trunk. -- >8 -- This newly-introduced variable isn't used on all paths, so add the [[maybe_unused]] attribute. libstdc++-v3/ChangeLog: * src/c++11/random.cc (random_device::_M_init): Add maybe_unused attribute. --- libstdc++-

Re: [PATCH] libstdc++: Fix iostream init for Clang on darwin [PR110432]

2023-06-30 Thread Jonathan Wakely via Gcc-patches
On Fri, 30 Jun 2023 at 15:29, Patrick Palka wrote: > > On Fri, 30 Jun 2023, Jonathan Wakely wrote: > > > Tested x86_64-linux. Patrick, PTAL. > > > > -- >8 -- > > > > The __has_attribute(init_priority) check in is true for Clang > > on darwin, which means that user code including thinks the > > l

[PATCH] libstdc++: Enable OpenMP 5.0 pragmas in PSTL headers

2023-06-30 Thread Jonathan Wakely via Gcc-patches
Jakub made a similar change a few yeas ago, but I think it got lost in the recent PSTL rebase. Tested x86_64-linux. Does this look OK for trunk? -- >8 -- This reapplies r10-1314-g32bab8b6ad0a90 which was lost in the recent PSTL rebase from upstream. * include/pstl/pstl_config.h (_PSTL_

[committed] libstdc++: Qualify calls to std::_Destroy and _Destroy_aux

2023-07-03 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. This isn't a regression, but is safe to backport. -- >8 -- These calls should be qualified to prevent ADL, which can cause errors for incomplete types that are associated classes. libstdc++-v3/ChangeLog: * include/bits/alloc_traits.h (_Destroy): Qu

Re: [PATCH] libstdc++: Enable OpenMP 5.0 pragmas in PSTL headers

2023-07-03 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk now. On Fri, 30 Jun 2023 at 21:17, Jonathan Wakely via Libstdc++ wrote: > > Jakub made a similar change a few yeas ago, but I think it got lost > in the recent PSTL rebase. > > Tested x86_64-linux. > > Does this look OK for trunk? > > -- >8 -- > > This reapplies r10-1314-g32bab8b6

[committed] libstdc++: Fix synopsis test

2023-07-03 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- The header is only supported for the cxx11 ABI. The declarations of basic_syncbuf, basic_osyncstream, syncbuf and osyncstream were already correctly guarded by a check for _GLIBCXX_USE_CXX11_ABI, but the wsyncbuf and wosyncstream declarations were n

Re: [PATCH] libstdc++: Split up pstl/set.cc testcase

2023-07-03 Thread Jonathan Wakely via Gcc-patches
On Mon, 3 Jul 2023 at 23:14, Thomas Rodgers via Libstdc++ wrote: > > This testcase is causing some timeout issues. This patch splits the > testcase up by individual set algorithm. I think the Apache license requires a notice saying the original file was modified. A comment in each new file noting

[committed] libstdc++: Add redundant 'typename' to std::projected

2023-07-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This is needed by Clang 15. libstdc++-v3/ChangeLog: * include/bits/iterator_concepts.h (projected): Add typename. --- libstdc++-v3/include/bits/iterator_concepts.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc

[committed] libstdc++: Use RAII in std::vector::_M_default_append

2023-07-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- Similar to r14-2052-gdd2eb972a5b063, replace the try-block with RAII types for deallocating storage and destroying elements. libstdc++-v3/ChangeLog: * include/bits/vector.tcc (_M_default_append): Replace try-block with RAII types. -

[committed] libstdc++: Fix std::__uninitialized_default_n for constant evaluation [PR110542]

2023-07-04 Thread Jonathan Wakely via Gcc-patches
This is a weird one as described in the PR. GCC doesn't complain about this bug, but seems to have a bogus error elsewhere. I'll add a testcase once I've understood/fixed the GCC error. Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/110542 *

[committed] libstdc++: Disable std::forward_list tests for C++98 mode

2023-07-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- These tests fail with -std=gnu++98/-D_GLIBCXX_DEBUG in the runtest flags. They should require the c++11 effective target. libstdc++-v3/ChangeLog: * testsuite/23_containers/forward_list/debug/iterator1_neg.cc: Skip as UNSUPPORTED for

Re: [PATCH] libstdc++: Fix fwrite error parameter

2023-07-05 Thread Jonathan Wakely via Gcc-patches
On Wed, 5 Jul 2023 at 16:54, shuaitq via Libstdc++ wrote: > > the first parameter of fwrite should be the const char* __s which want write > to FILE *__file, > rather than the FILE *__file write to the FILE *__file. Thank you. The patch is correct and small enough to not require a copyright assi

[PATCH] doc: Update my Contributors entry

2023-07-05 Thread Jonathan Wakely via Gcc-patches
Gerald suggested I update this. Pushed to trunk. -- >8 -- gcc/ChangeLog: * doc/contrib.texi (Contributors): Update my entry. --- gcc/doc/contrib.texi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/doc/contrib.texi b/gcc/doc/contrib.texi index 758805dc5db..fa55

[committed] libstdc++: Document --enable-cstdio=stdio_pure [PR110574]

2023-07-06 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk. Backports to 11, 12 and 13 will follow. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/110574 * doc/xml/manual/configure.xml: Describe stdio_pure argument to --enable-cstdio. * doc/html/manual/configure.html: Regenerate. --- libstdc++-v3/doc/html/

[PATCH] libstdc++: Fix --enable-cstdio=stdio_pure [PR110574]

2023-07-07 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux (with --enable-cstdio=stdio_pure and without). I intend to commit this next week. This fixes most of the fstream failures seen with stdio_pure, although there are still a few that fail (about half of them time out): FAIL: 27_io/basic_filebuf/imbue/char/13171-2.cc execution t

[PATCH] libstdc++: Compile basic_file_stdio.cc for LFS

2023-07-07 Thread Jonathan Wakely via Gcc-patches
When this code was written we didn't have the header, so it conditionally used lseek64 etc. Since this is compiled into the library, not inline code in headers, we can just define the relevant macros to get a 64-bit off_t and then simplify the code. Tested x86_64-linux. I intend to commit this n

[committed] doc: Fix typos in Warning Options [PR110596]

2023-07-08 Thread Jonathan Wakely via Gcc-patches
Pushed as obvious. -- >8 -- gcc/ChangeLog: PR c++/110595 PR c++/110596 * doc/invoke.texi (Warning Options): Fix typos. --- gcc/doc/invoke.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 594b24d0

Re: [PATCH] libstdc++: Use RAII in std::vector::_M_realloc_insert

2023-07-10 Thread Jonathan Wakely via Gcc-patches
On Wed, 28 Jun 2023 at 08:56, Jan Hubicka wrote: > > > I think the __throw_bad_alloc() and __throw_bad_array_new_length() > > functions should always be rare, so marking them cold seems fine (users who > > define their own allocators that want to throw bad_alloc "often" will > > probably throw it

[PATCH] doc: Suggest fix for -Woverloaded-virtual warnings

2023-02-15 Thread Jonathan Wakely via Gcc-patches
OK for trunk? -- >8 -- Users are confused about what this warning means, so add a suggested solution to the documentation. gcc/ChangeLog: * doc/invoke.texi (C++ Dialect Options): Suggest adding a using-declaration to unhide functions. --- gcc/doc/invoke.texi | 4 1 file ch

<    1   2   3   4   5   6   7   8   9   10   >