aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
AgeCommit message (Collapse)AuthorFilesLines
2023-06-17Daily bump.GCC Administrator1-0/+12
2023-06-16[libstdc++] [testsuite] xfail dbl from_chars for aarch64 rtems ldblAlexandre Oliva1-1/+1
rtems, like vxworks, uses fast-float doubles for from_chars even for long double, so it loses precision, so expect the long double bits to fail on aarch64. for libstdc++-v3/ChangeLog * testsuite/20_util/from_chars/4.cc: Skip long double on aarch64-rtems.
2023-06-16libstdc++-v3: do not duplicate some math functions when using newlibJoel Brobecker2-0/+1188
When running the libstdc++ testsuite on AArch64 RTEMS, we noticed that about 25 tests are failing during the link, due to the "sqrtl" function being defined twice: - once inside RTEMS' libm; - once inside our libstdc++. One test that fails, for instance, would be 26_numerics/complex/13450.cc. In comparing libm and libstdc++, we found that libstc++ also duplicates "hypotf", and "hypotl". For "sqrtl" and "hypotl", the symbosl come a unit called from math_stubs_long_double.cc, while "hypotf" comes from the equivalent unit for the float version, called math_stubs_float.cc. Those units are always compiled in libstdc++ and provide our own version of various math routines when those are missing from the target system. The definition of those symbols is predicated on the existance of various macros provided by c++config.h, which themselves are predicated by the corresponding HAVE_xxx macros in config.h. One key element behind what's happening, here, is that the target uses newlib, and therefore GCC was configured --with-newlib. The section of libstdc++v3's configure script that handles which math functions are available has a newlib-specific section, and that section provides a hardcoded list of symbols. For "hypotf", this commit fixes the issue by doing the same as for the other routines already declared in that section. I verified by inspection in the newlib code that this function should always be present, so hardcoding it in our configure script should not be an issue. For the math routines handling doubles ("sqrtl" and "hypotl"), however, I do not believe we can assume that newlib's libm will always provide them. Therefore, this commit fixes that part of the issue by ading a compile-check for "sqrtl" and "hypotl". And while at it, we also include checks for all the other math functions that math_stubs_long_double.cc re-implements, allowing us to be resilient to future newlib enhancements adding support for more functions. libstdc++-v3/ChangeLog: * configure.ac ["x${with_newlib}" = "xyes"]: Define HAVE_HYPOTF. Add compile-checks for various long double math functions as well. * configure: Regenerate.
2023-06-15Daily bump.GCC Administrator1-0/+6
2023-06-14libstdc++: Clarify manual demangle docJonny Grant2-8/+4
libstdc++-v3/ChangeLog: * doc/xml/manual/extensions.xml: Remove demangle exception description and include. * doc/html/manual/ext_demangling.html: Regenerate.
2023-06-11Daily bump.GCC Administrator1-0/+6
2023-06-10testsuite: Cut down 27_io/basic_istream/.../94749.cc for simulatorsHans-Peter Nilsson2-2/+2
The test wchar_t/94749.cc can take about 10 minutes on some simulator/host combinations with char/94749.cc at a third of that time. The cause is test05 which is quite heavy and includes wrapping a 32-bit counter. Run it only for native setups. * testsuite/27_io/basic_istream/ignore/wchar_t/94749.cc (main) [! SIMULATOR_TEST]: Also exclude running test05. * testsuite/27_io/basic_istream/ignore/char/94749.cc: Ditto.
2023-06-10Daily bump.GCC Administrator1-0/+68
2023-06-09libstdc++: use using instead of typedef for type_traitsKen Matsui1-79/+79
Since the type_traits header is a C++11 header file, using can be used instead of typedef. This patch provides more readability, especially for long type names. libstdc++-v3/ChangeLog: * include/std/type_traits: Use using instead of typedef Reviewed-by: Patrick Palka <ppalka@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2023-06-09libstdc++: Remove duplicate definition of _Float128 std::from_chars [PR110077]Jonathan Wakely1-1/+2
When long double uses IEEE binary128 representation we define the _Float128 overload of std::from_chars inline in <charconv>. My changes in r14-1431-g7037e7b6e4ac41 cause it to also be defined non-inline in the library, leading to an abi-check failure for (at least) sparc and aarch64. Suppress the definition in the library if long double and _Float128 have are both IEEE binary128. libstdc++-v3/ChangeLog: PR libstdc++/110077 * src/c++17/floating_from_chars.cc (from_chars) <_Float128>: Only define if _Float128 and long double have different representations.
2023-06-09libstdc++: Add preprocessor checks to <experimental/internet> [PR100285]Jonathan Wakely1-0/+2
We can't define endpoints and resolvers without the relevant OS support. If IPPROTO_TCP and IPPROTO_UDP are both udnefined then we won't need basic_endpoint and basic_resovler anyway, so make them depend on those macros. libstdc++-v3/ChangeLog: PR libstdc++/100285 * include/experimental/internet [IPPROTO_TCP || IPPROTO_UDP] (basic_endpoint, basic_resolver_entry, resolver_base) (basic_resolver_results, basic_resolver): Only define if the tcp or udp protocols will be defined.
2023-06-09libstdc++: Bump library version to libstdc++.so.6.0.33Jonathan Wakely4-3/+4
The addition of __cxa_call_terminate@@CXXABI_1.3.15 on trunk means we need a new version. libstdc++-v3/ChangeLog: * acinclude.m4 (libtool_VERSION): Update to 6.0.33. * configure: Regenerate. * doc/xml/manual/abi.xml: Add libstdc++.so.6.0.33. * doc/html/manual/abi.html: Regenerate.
2023-06-09libstdc++: Fix P2510R3 "Formatting pointers" [PR110149]Jonathan Wakely3-12/+101
I had intended to support the P2510R3 proposal unconditionally in C++20 mode, but I left it half implemented. The parse function supported the new extensions, but the format function didn't. This adds the missing pieces, and makes it only enabled for C++26 and non-strict modes. libstdc++-v3/ChangeLog: PR libstdc++/110149 * include/std/format (formatter<const void*, charT>::parse): Only alow 0 and P for C++26 and non-strict modes. (formatter<const void*, charT>::format): Use toupper for P type, and insert zero-fill characters for 0 option. * testsuite/std/format/functions/format.cc: Check pointer formatting. Only check P2510R3 extensions conditionally. * testsuite/std/format/parse_ctx.cc: Only check P2510R3 extensions conditionally.
2023-06-09libstdc++: Optimize std::to_array for trivial types [PR110167]Jonathan Wakely2-16/+51
As reported in PR libstdc++/110167, std::to_array compiles extremely slowly for very large arrays. It needs to instantiate a very large specialization of std::index_sequence<N...> and then create a very large aggregate initializer from the pack expansion. For trivial types we can simply default-initialize the std::array and then use memcpy to copy the values. For non-trivial types we need to use the existing implementation, despite the compilation cost. As also noted in the PR, using a generic lambda instead of the __to_array helper compiles faster since gcc-13. It also produces slightly smaller code at -O1, due to additional inlining. The code at -Os, -O2 and -O3 seems to be the same. This new implementation requires __cpp_generic_lambdas >= 201707L (i.e. P0428R2) but that is supported since Clang 10 and since Intel icc 2021.5.0 (and since GCC 10.1). libstdc++-v3/ChangeLog: PR libstdc++/110167 * include/std/array (to_array): Initialize arrays of trivial types using memcpy. For non-trivial types, use lambda expressions instead of a separate helper function. (__to_array): Remove. * testsuite/23_containers/array/creation/110167.cc: New test.
2023-06-09libstdc++: Improve tests for emplace member of sequence containersJonathan Wakely9-159/+211
Our existing tests for std::deque::emplace, std::list::emplace and std::vector::emplace are poor. We only have compile tests for PR 52799 and the equivalent for a const_iterator as the insertion point. This fails to check that the value is actually inserted correctly and the right iterator is returned. Add new tests that cover the existing 52799.cc and const_iterator.cc compile-only tests, as well as verifying the effects are correct. libstdc++-v3/ChangeLog: * testsuite/23_containers/deque/modifiers/emplace/52799.cc: Removed. * testsuite/23_containers/deque/modifiers/emplace/const_iterator.cc: Removed. * testsuite/23_containers/list/modifiers/emplace/52799.cc: Removed. * testsuite/23_containers/list/modifiers/emplace/const_iterator.cc: Removed. * testsuite/23_containers/vector/modifiers/emplace/52799.cc: Removed. * testsuite/23_containers/vector/modifiers/emplace/const_iterator.cc: Removed. * testsuite/23_containers/deque/modifiers/emplace/1.cc: New test. * testsuite/23_containers/list/modifiers/emplace/1.cc: New test. * testsuite/23_containers/vector/modifiers/emplace/1.cc: New test.
2023-06-08Daily bump.GCC Administrator1-0/+86
2023-06-07libstdc++: Fix up 20_util/to_chars/double.cc test for excess precision ↵Jakub Jelinek1-0/+26
[PR110145] This test apparently contains 3 problematic floating point constants, 1e126, 4.91e-6 and 5.547e-6. These constants suffer from double rounding when -fexcess-precision=standard evaluates double constants in the precision of Intel extended 80-bit long double. As written in the PR, e.g. the first one is 0x1.7a2ecc414a03f7ff6ca1cb527787b130a97d51e51202365p+418 in the precision of GCC's internal format, 80-bit long double has 63-bit precision, so the above constant rounded to long double is 0x1.7a2ecc414a03f800p+418L (the least significant bit in the 0 before p isn't there already). 0x1.7a2ecc414a03f800p+418L rounded to IEEE double is 0x1.7a2ecc414a040p+418. Now, if excess precision doesn't happen and we round the GCC's internal format number directly to double, it is 0x1.7a2ecc414a03fp+418 and that is the number the test expects. One can see it on x86-64 (where excess precision to long double doesn't happen) where double(1e126L) != 1e126. The other two constants suffer from the same problem. The following patch tweaks the testcase, such that those problematic constants are used only if FLT_EVAL_METHOD is 0 or 1 (i.e. when we have guarantee the constants will be evaluated in double precision), plus adds corresponding tests with hexadecimal constants which don't suffer from this excess precision problem, they are exact in double and long double can hold all double values. 2023-06-07 Jakub Jelinek <jakub@redhat.com> PR libstdc++/110145 * testsuite/20_util/to_chars/double.cc: Include <cfloat>. (double_to_chars_test_cases, double_scientific_precision_to_chars_test_cases_2, double_fixed_precision_to_chars_test_cases_2): #if out 1e126, 4.91e-6 and 5.547e-6 tests if FLT_EVAL_METHOD is negative or larger than 1. Add unconditional tests with corresponding double constants 0x1.7a2ecc414a03fp+418, 0x1.4981285e98e79p-18 and 0x1.7440bbff418b9p-18.
2023-06-07libstdc++: Restore accidentally removed version in abi-checkJonathan Wakely1-0/+1
In r14-1583-g192665feef7129 I meant to add CXXABI_1.3.15 but instead I replaced CXXABI_1.3.14 with it. This restores the CXXABI_1.3.14 version. libstdc++-v3/ChangeLog: * testsuite/util/testsuite_abi.cc (check_version): Re-add CXXABI_1.3.14.
2023-06-07libstdc++: Fix some tests that fail with -fno-exceptionsJonathan Wakely9-1/+24
libstdc++-v3/ChangeLog: * testsuite/18_support/nested_exception/rethrow_if_nested-term.cc: Require effective target exceptions_enabled instead of using dg-skip-if. * testsuite/23_containers/vector/capacity/constexpr.cc: Expect shrink_to_fit() to be a no-op without exceptions enabled. * testsuite/23_containers/vector/capacity/shrink_to_fit.cc: Likewise. * testsuite/ext/bitmap_allocator/check_allocate_max_size.cc: Require effective target exceptions_enabled. * testsuite/ext/malloc_allocator/check_allocate_max_size.cc: Likewise. * testsuite/ext/mt_allocator/check_allocate_max_size.cc: Likewise. * testsuite/ext/new_allocator/check_allocate_max_size.cc: Likewise. * testsuite/ext/pool_allocator/check_allocate_max_size.cc: Likewise. * testsuite/ext/throw_allocator/check_allocate_max_size.cc: Likewise.
2023-06-07libstdc++: Fix some tests that fail with -fexcess-precision=standardJonathan Wakely16-24/+24
libstdc++-v3/ChangeLog: * testsuite/20_util/duration/cons/2.cc: Use values that aren't affected by rounding. * testsuite/20_util/from_chars/5.cc: Cast arithmetic result to double before comparing for equality. * testsuite/20_util/from_chars/6.cc: Likewise. * testsuite/20_util/variant/86874.cc: Use values that aren't affected by rounding. * testsuite/25_algorithms/lower_bound/partitioned.cc: Compare to original value instead of to floating-point-literal. * testsuite/26_numerics/random/discrete_distribution/cons/range.cc: Cast arithmetic result to double before comparing for equality. * testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc: Likewise. * testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc: Likewise. * testsuite/26_numerics/valarray/transcend.cc (eq): Check that the absolute difference is less than 0.01 instead of comparing to two decimal places. * testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc: Cast arithmetic result to double before comparing for equality. * testsuite/27_io/basic_istream/extractors_arithmetic/char/09.cc: Likewise. * testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc: Likewise. * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc: Likewise. * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/09.cc: Likewise. * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc: Likewise. * testsuite/ext/random/hoyt_distribution/cons/parms.cc: Likewise.
2023-06-07Revert "libstdc++: Use AS_IF in configure.ac"Jonathan Wakely2-590/+578
This reverts commit 97a5e8a2a48d162744a5bd60a012ce6fca13cbbe. libstdc++-v3/ChangeLog: * configure: Regenerate. * configure.ac:
2023-06-07Support 'UNSUPPORTED: [...]: exception handling disabled' for libstdc++ testingThomas Schwinge1-0/+12
Verbatim copy of what was added to 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune' in Subversion r279246 (Git commit a9046e9853024206bec092dd63e21e152cb5cbca) "[MSP430] -Add fno-exceptions multilib". This greatly improves 'make check-target-libstdc++-v3' results for, for example, x86_64-pc-linux-gnu with: RUNTESTFLAGS='--target_board=unix/-fno-exceptions\{,-m32\}' libstdc++-v3/ * testsuite/lib/prune.exp (libstdc++-dg-prune): Support 'UNSUPPORTED: [...]: exception handling disabled'.
2023-06-07Daily bump.GCC Administrator1-0/+89
2023-06-06libstdc++: Update list of known symbol versions for abi-checkJonathan Wakely1-5/+2
Add the recently added CXXABI_1.3.15 version. Also remove two "frozen" versions from the latestp list, as no more symbols should be added to those now. libstdc++-v3/ChangeLog: * testsuite/util/testsuite_abi.cc (check_version): Add CXXABI_1.3.15 symver and make it the latestp. Remove GLIBCXX_IEEE128_3.4.31 and GLIBCXX_LDBL_3.4.31 from latestp.
2023-06-06libstdc++: Make std::numeric_limits<__float128> more portable [PR104772]Jonathan Wakely2-17/+80
This redefines std::numeric_limits<__float128> so that it works with non-GCC compilers. The previous definition didn't work with Clang, due to it not supporting __builtin_high_valq, __builtin_nanq, and __builtin_nansq. It also didn't work in strict modes, due to using Q literal suffixes. The new definition uses the Q suffixes when supported, or calculates the correct values using __float128 arithmetic from double values. Ideally the values would be defined as hexadecimal-floating-point-literals, but that won't work for C++14 and older. The only member that can't be defined this way is signaling_NaN() which still requires a built-in. If __builtin_nansq is not supported, try to use __builtin_nansf128 (with a possibly-redundant bit_cast) and if that isn't supported, return a quiet NaN and define has_signaling_NaN and is_iec754 to be false. libstdc++-v3/ChangeLog: PR libstdc++/104772 * include/std/limits: (numeric_limits<__float128>): Define for __STRICT_ANSI__ as well. * testsuite/18_support/numeric_limits/128bit.cc: Remove check for __STRICT_ANSI__. Co-authored-by: Jakub Jelinek <jakub@redhat.com>
2023-06-06libstdc++: Use AS_IF in configure.acJonathan Wakely2-578/+590
This ensures that anything that depends on AC_REQUIRE is hoisted out of the conditional block. The always-false test x"long_double_math_on_this_cpu" = x"yes" condition is not altered by this commit, only changed to use the AS_IF syntax. libstdc++-v3/ChangeLog: * configure.ac: Use AS_IF. * configure: Regenerate.
2023-06-06libstdc++: Avoid vector casts while still avoiding PR90424Matthias Kretz1-25/+15
Signed-off-by: Matthias Kretz <m.kretz@gsi.de> libstdc++-v3/ChangeLog: PR libstdc++/109822 * include/experimental/bits/simd_builtin.h (_S_store): Rewrite to avoid casts to other vector types. Implement store as succession of power-of-2 sized memcpy to avoid PR90424.
2023-06-06libstdc++: Replace use of incorrect non-temporal storeMatthias Kretz2-37/+7
The call to the base implementation sometimes didn't find a matching signature because the _Abi parameter of _SimdImpl* was "wrong" after conversion. It has to call into <new ABI tag>::_SimdImpl instead of the current ABI tag's _SimdImpl. This also reduces the number of possible template instantiations. Signed-off-by: Matthias Kretz <m.kretz@gsi.de> libstdc++-v3/ChangeLog: PR libstdc++/110054 * include/experimental/bits/simd_builtin.h (_S_masked_store): Call into deduced ABI's SimdImpl after conversion. * include/experimental/bits/simd_x86.h (_S_masked_store_nocvt): Don't use _mm_maskmoveu_si128. Use the generic fall-back implementation. Also fix masked stores without SSE2, which were not doing anything before.
2023-06-06libstdc++: Protect against macrosMatthias Kretz1-4/+4
Signed-off-by: Matthias Kretz <m.kretz@gsi.de> libstdc++-v3/ChangeLog: * include/experimental/bits/simd.h (__bit_cast): Use __gnu__::__vector_size__ instead of gnu::vector_size.
2023-06-06libstdc++: Fix ambiguous expression in std::array<T, 0>::front() [PR110139]Jonathan Wakely2-5/+10
For 32-bit targets using -pedantic (or using Clang) makes the expression _M_elems[0] ambiguous. The overloaded operator[] that we want to call has a size_t parameter, but 0 is type ptrdiff_t for many ILP32 targets, so using the implicit conversion from _M_elems to T* and then subscripting that is also viable. Change the 0 to (size_type)0 and also make the conversion to T* explicit, so that's it's not viable here. The latter change requires a static_cast in data() where we really do want to convert _M_elems to a pointer. libstdc++-v3/ChangeLog: PR libstdc++/110139 * include/std/array (__array_traits<T, 0>::operator T*()): Make conversion operator explicit. (array::front): Use size_type as subscript operand. (array::data): Use static_cast to make conversion explicit. * testsuite/23_containers/array/element_access/110139.cc: New test.
2023-06-06libstdc++: Do not assume existence of char8_t codecvt facetJoseph Faulls1-3/+0
It is not required that codecvt<char8_t, char, mbstate_t> facet be supported by the locale, nor is it added as part of the default locale. This can lead to dangerous behaviour when static_cast. libstdc++-v3/ChangeLog: * include/bits/locale_classes.tcc: Remove check for codecvt<char8_t, char, mbstate_t> facet.
2023-06-06libstdc++: Use close-on-exec for file descriptors in filesystem::copy_fileJonathan Wakely1-6/+7
libstdc++-v3/ChangeLog: * src/filesystem/ops-common.h (do_copy_file) [O_CLOEXEC]: Set close-on-exec flag on file descriptors.
2023-06-06libstdc++: Make std::filesystem::copy_file work for procfs [PR108178]Jonathan Wakely2-5/+43
The size reported by stat is always zero for some special files such as those under /proc, which means the current copy_file implementation thinks there is nothing to copy. Instead of trusting the stat value, try to read a character from a streambuf and check for EOF. libstdc++-v3/ChangeLog: PR libstdc++/108178 * src/filesystem/ops-common.h (do_copy_file): Check for empty files by trying to read a character. * testsuite/27_io/filesystem/operations/copy_file_108178.cc: New test.
2023-06-06libstdc++: Use copy_file_range for filesystem::copy_fileJannik Glückert4-0/+141
copy_file_range is a recent-ish syscall for copying files. It is similar to sendfile but allows filesystem-specific optimizations. Common are: Reflinks: BTRFS, XFS, ZFS (does not implement the syscall yet) Server-side copy: NFS, SMB, Ceph If copy_file_range is not available for the given files, fall back to sendfile / userspace copy. libstdc++-v3/ChangeLog: * acinclude.m4 (_GLIBCXX_USE_COPY_FILE_RANGE): Define. * config.h.in: Regenerate. * configure: Regenerate. * src/filesystem/ops-common.h (copy_file_copy_file_range): Define new function. (do_copy_file): Use it. Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
2023-06-06libstdc++: Also use sendfile for big filesJannik Glückert4-84/+170
We were previously only using sendfile for files smaller than 2GB, as sendfile needs to be called repeatedly for files bigger than that. Some quick numbers, copying a 16GB file, average of 10 repetitions: old: real: 13.4s user: 0.14s sys : 7.43s new: real: 8.90s user: 0.00s sys : 3.68s libstdc++-v3/ChangeLog: * acinclude.m4 (_GLIBCXX_HAVE_LSEEK): Define. * config.h.in: Regenerate. * configure: Regenerate. * src/filesystem/ops-common.h (copy_file_sendfile): Define new function for sendfile logic. Loop to support large files. Skip zero-length files. (do_copy_file): Use it. Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
2023-06-05Daily bump.GCC Administrator1-0/+6
2023-06-03c++: use __cxa_call_terminate for MUST_NOT_THROW [PR97720]Jason Merrill2-1/+10
[except.handle]/7 says that when we enter std::terminate due to a throw, that is considered an active handler. We already implemented that properly for the case of not finding a handler (__cxa_throw calls __cxa_begin_catch before std::terminate) and the case of finding a callsite with no landing pad (the personality function calls __cxa_call_terminate which calls __cxa_begin_catch), but for the case of a throw in a try/catch in a noexcept function, we were emitting a cleanup that calls std::terminate directly without ever calling __cxa_begin_catch to handle the exception. A straightforward way to fix this seems to be calling __cxa_call_terminate instead. However, that requires exporting it from libstdc++, which we have not previously done. Despite the name, it isn't actually part of the ABI standard. Nor is __cxa_call_unexpected, as far as I can tell, but that one is also used by clang. For this case they use __clang_call_terminate; it seems reasonable to me for us to stick with __cxa_call_terminate. I also change __cxa_call_terminate to take void* for simplicity in the front end (and consistency with __cxa_call_unexpected) but that isn't necessary if it's undesirable for some reason. This patch does not fix the issue that representing the noexcept as a cleanup is wrong, and confuses the handler search; since it looks like a cleanup in the EH tables, the unwinder keeps looking until it finds the catch in main(), which it should never have gotten to. Without the try/catch in main, the unwinder would reach the end of the stack and say no handler was found. The noexcept is a handler, and should be treated as one, as it is when the landing pad is omitted. The best fix for that issue seems to me to be to represent an ERT_MUST_NOT_THROW after an ERT_TRY in an action list as though it were an ERT_ALLOWED_EXCEPTIONS (since indeed it is an exception-specification). The actual code generation shouldn't need to change (apart from the change made by this patch), only the action table entry. PR c++/97720 gcc/cp/ChangeLog: * cp-tree.h (enum cp_tree_index): Add CPTI_CALL_TERMINATE_FN. (call_terminate_fn): New macro. * cp-gimplify.cc (gimplify_must_not_throw_expr): Use it. * except.cc (init_exception_processing): Set it. (cp_protect_cleanup_actions): Return it. gcc/ChangeLog: * tree-eh.cc (lower_resx): Pass the exception pointer to the failure_decl. * except.h: Tweak comment. libstdc++-v3/ChangeLog: * libsupc++/eh_call.cc (__cxa_call_terminate): Take void*. * config/abi/pre/gnu.ver: Add it. gcc/testsuite/ChangeLog: * g++.dg/eh/terminate2.C: New test.
2023-06-03Daily bump.GCC Administrator1-0/+4
2023-06-02libstdc++: Fix broken _GLIBCXX_PARALLEL modeFrançois Dumont1-0/+1
Add missing <parallel/search.h> include in <parallel/algobase.h>. libstdc++-v3/ChangeLog: * include/parallel/algobase.h: Include <parallel/search.h>.
2023-06-02Daily bump.GCC Administrator1-0/+67
2023-06-01libstdc++: Fix PSTL test that fails in C++20Jonathan Wakely1-1/+1
This test fails in C++20 and later due to a warning: warning: C++20 says that these are ambiguous, even though the second is reversed: note: candidate 1: 'bool MyClass::operator==(const MyClass&)' note: candidate 2: 'bool MyClass::operator==(const MyClass&)' (reversed) note: try making the operator a 'const' member function FAIL: 26_numerics/pstl/numeric_ops/transform_reduce.cc (test for excess errors) libstdc++-v3/ChangeLog: * testsuite/26_numerics/pstl/numeric_ops/transform_reduce.cc: Add const to equality operator.
2023-06-01libstdc++: Do not use std::expected::value() in monadic ops (LWG 3938)Jonathan Wakely3-67/+298
The monadic operations in std::expected always check has_value() so we can avoid the execptional path in value() and the assertions in error() by accessing _M_val and _M_unex directly. This means that the monadic operations no longer require _M_unex to be copyable so that it can be thrown from value(), as modified by LWG 3938. This also fixes two incorrect uses of std::move in transform(F&&)& and transform(F&&) const& which I found while making these changes. Now that move-only error types are supported, it's possible to properly test the constraints that LWG 3877 added to and_then and transform. The lwg3877.cc test now does that. libstdc++-v3/ChangeLog: * include/std/expected (expected::and_then, expected::or_else) (expected::transform_error): Use _M_val and _M_unex instead of calling value() and error(), as per LWG 3938. (expected::transform): Likewise. Remove incorrect std::move calls from lvalue overloads. (expected<void, E>::and_then, expected<void, E>::or_else) (expected<void, E>::transform): Use _M_unex instead of calling error(). * testsuite/20_util/expected/lwg3877.cc: Add checks for and_then and transform, and for std::expected<void, E>. * testsuite/20_util/expected/lwg3938.cc: New test.
2023-06-01libstdc++: Fix code size regressions in std::vector [PR110060]Jonathan Wakely4-28/+20
My r14-1452-gfb409a15d9babc change to add optimization hints to std::vector causes regressions because it makes std::vector::size() and std::vector::capacity() too big to inline. That's the opposite of what I wanted, so revert the changes to those functions. To achieve the original aim of optimizing vec.assign(vec.size(), x) we can add a local optimization hint to _M_fill_assign, so that it doesn't affect all other uses of size() and capacity(). Additionally, add the same hint to the _M_assign_aux overload for forward iterators and add that to the testcase. It would be nice to similarly optimize: if (vec1.size() == vec2.size()) vec1 = vec2; but adding hints to operator=(const vector&) doesn't help. Presumably the relationships between the two sizes and two capacities are too complex to track effectively. libstdc++-v3/ChangeLog: PR libstdc++/110060 * include/bits/stl_vector.h (_Vector_base::_M_invariant): Remove. (vector::size, vector::capacity): Remove calls to _M_invariant. * include/bits/vector.tcc (vector::_M_fill_assign): Add optimization hint to reallocating path. (vector::_M_assign_aux(FwdIter, FwdIter, forward_iterator_tag)): Likewise. * testsuite/23_containers/vector/capacity/invariant.cc: Moved to... * testsuite/23_containers/vector/modifiers/assign/no_realloc.cc: ...here. Check assign(FwdIter, FwdIter) too. * testsuite/23_containers/vector/types/1.cc: Revert addition of -Wno-stringop-overread option.
2023-06-01libstdc++: Document removal of implicit allocator rebinding extensionsJonathan Wakely2-0/+32
Traditionally libstdc++ allowed containers and strings to be instantiated with allocator's that have the wrong value type, implicitly rebinding the allocator to the container's value type. Since C++20 that has been explicitly ill-formed, so the extension is no longer supported in strict modes (e.g. -std=c++17) and in C++20 and later. libstdc++-v3/ChangeLog: * doc/xml/manual/evolution.xml: Document removal of implicit allocator rebinding extensions in strict mode and for C++20. * doc/html/*: Regenerate.
2023-06-01libstdc++: optimize EH phase 2Jason Merrill1-0/+4
In the ABI's two-phase EH model, first we walk the stack looking for a handler, then we walk the stack running cleanups until we reach that handler. In the cleanup phase, we shouldn't redundantly check the handlers along the way, e.g. when walking through g(): void f() { throw 42; } void g() { try { f(); } catch (void *) { } } int main() { try { g(); } catch (int) { } } libstdc++-v3/ChangeLog: * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Don't check handlers in the cleanup phase.
2023-06-01libstdc++: Fix condition for supported SIMD types on ARMv8Matthias Kretz1-2/+4
Signed-off-by: Matthias Kretz <m.kretz@gsi.de> libstdc++-v3/ChangeLog: PR libstdc++/110050 * include/experimental/bits/simd.h (__vectorized_sizeof): With __have_neon_a32 only single-precision float works (in addition to integers).
2023-06-01libstdc++: Reduce <functional> inclusion to <stl_algobase.h>François Dumont6-150/+149
Move the std::search definition from stl_algo.h to stl_algobase.h and use the later in <functional>. For consistency also move std::__parallel::search and associated helpers from <parallel/stl_algo.h> to <parallel/stl_algobase.h> so that std::__parallel::search is accessible along with std::search. libstdc++-v3/ChangeLog: * include/bits/stl_algo.h (std::__search, std::search(_FwdIt1, _FwdIt1, _FwdIt2, _FwdIt2, _BinPred)): Move... * include/bits/stl_algobase.h: ...here. * include/std/functional: Replace <stl_algo.h> include by <stl_algobase.h>. * include/parallel/algo.h (std::__parallel::search<_FIt1, _FIt2, _BinaryPred>) (std::__parallel::__search_switch<_FIt1, _FIt2, _BinaryPred, _ItTag1, _ItTag2>): Move... * include/parallel/algobase.h: ...here. * include/experimental/functional: Remove <bits/stl_algo.h> and <parallel/algorithm> includes. Include <bits/stl_algobase.h>.
2023-06-01Daily bump.GCC Administrator1-0/+116
2023-05-31libstdc++: Add separate autoconf macro for std::float_t and std::double_t ↵Jonathan Wakely4-6/+62
[PR109818] This should make it possible to use openlibm with djgpp (and other targets with missing C99 <math.h> functions). The <math.h> from openlibm provides all the functions, but not the float_t and double_t typedefs. By separating the autoconf checks for the functionsand the typedefs, we don't disable support for all the functions just because those typedefs are not present. libstdc++-v3/ChangeLog: PR libstdc++/109818 * acinclude.m4 (GLIBCXX_ENABLE_C99): Add separate check for float_t and double_t and define HAVE_C99_FLT_EVAL_TYPES. * config.h.in: Regenerate. * configure: Regenerate. * include/c_global/cmath (float_t, double_t): Guard using new _GLIBCXX_HAVE_C99_FLT_EVAL_TYPES macro.
2023-05-31libstdc++: Stop using _GLIBCXX_USE_C99_MATH_TR1 in <cmath>Jonathan Wakely17-106/+396
Similar to the three commits r14-908, r14-909 and r14-910, the _GLIBCXX_USE_C99_MATH_TR1 macro is misleading when it is also used for <cmath>, not only for <tr1/cmath> headers. It is also wrong, because the configure checks for TR1 use -std=c++98 and a target might define the C99 features for C++11 but not for C++98. Add separate configure checks for the <math.h> functions using -std=c++11 for the checks. Use the new macro defined by those checks in the C++11-specific parts of <cmath>, and in <complex>, <random> etc. The check that defines _GLIBCXX_NO_C99_ROUNDING_FUNCS is only needed for the C++11 <cmath> checks, so remove that from GLIBCXX_CHECK_C99_TR1 and only do it for GLIBCXX_ENABLE_C99. libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_C99): Add checks for C99 math functions and define _GLIBCXX_USE_C99_MATH_FUNCS. Move checks for C99 rounding functions to here. (GLIBCXX_CHECK_C99_TR1): Remove checks for C99 rounding functions from here. * config.h.in: Regenerate. * configure: Regenerate. * include/bits/random.h: Use _GLIBCXX_USE_C99_MATH_FUNCS instead of _GLIBCXX_USE_C99_MATH_TR1. * include/bits/random.tcc: Likewise. * include/c_compatibility/math.h: Likewise. * include/c_global/cmath: Likewise. * include/ext/random: Likewise. * include/ext/random.tcc: Likewise. * include/std/complex: Likewise. * testsuite/20_util/from_chars/4.cc: Likewise. * testsuite/20_util/from_chars/8.cc: Likewise. * testsuite/26_numerics/complex/proj.cc: Likewise. * testsuite/26_numerics/headers/cmath/60401.cc: Likewise. * testsuite/26_numerics/headers/cmath/types_std_c++0x.cc: Likewise. * testsuite/lib/libstdc++.exp (check_v3_target_cstdint): Likewise. * testsuite/util/testsuite_random.h: Likewise.