[gcc/devel/fortran_unsigned] libstdc++: Do not use isatty on avr [PR115482]

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:d5bc313be01f12b92bb90404657b669f3a6509d1

commit d5bc313be01f12b92bb90404657b669f3a6509d1
Author: Detlef Vollmann 
Date:   Tue Jul 23 09:25:22 2024 +0100

libstdc++: Do not use isatty on avr [PR115482]

avrlibc has an incomplete unistd.h that doesn't have isatty.
So building libstdc++ fails when compiling c++23/print.cc.
As a workaround I added a check for AVR.

libstdc++-v3/ChangeLog:

PR libstdc++/115482
* src/c++23/print.cc (__open_terminal) [__AVR__]: Do not use
isatty.

Diff:
---
 libstdc++-v3/src/c++23/print.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/src/c++23/print.cc b/libstdc++-v3/src/c++23/print.cc
index 99a19cd45002..558dc149d125 100644
--- a/libstdc++-v3/src/c++23/print.cc
+++ b/libstdc++-v3/src/c++23/print.cc
@@ -75,7 +75,7 @@ namespace
 #ifdef _WIN32
if (int fd = ::_fileno(f); fd >= 0)
  return check_for_console((void*)_get_osfhandle(fd));
-#elifdef _GLIBCXX_HAVE_UNISTD_H
+#elif defined _GLIBCXX_HAVE_UNISTD_H && ! defined __AVR__
if (int fd = (::fileno)(f); fd >= 0 && ::isatty(fd))
  return f;
 #endif
@@ -100,7 +100,7 @@ namespace
 #ifdef _WIN32
 if (auto fb = dynamic_cast(sb))
   return check_for_console(fb->native_handle());
-#elifdef _GLIBCXX_HAVE_UNISTD_H
+#elif defined _GLIBCXX_HAVE_UNISTD_H && ! defined __AVR__
 if (auto fb = dynamic_cast(sb))
   if (int fd = fb->native_handle(); fd >= 0 && ::isatty(fd))
return ::fdopen(::dup(fd), "w"); // Caller must call fclose.


[gcc/devel/fortran_unsigned] Daily bump.

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:1bc9314f8b837da7a68912142387d924791e5de4

commit 1bc9314f8b837da7a68912142387d924791e5de4
Author: GCC Administrator 
Date:   Wed Jul 24 00:18:20 2024 +

Daily bump.

Diff:
---
 gcc/ChangeLog   | 111 ++
 gcc/DATESTAMP   |   2 +-
 gcc/c-family/ChangeLog  |   5 +++
 gcc/c/ChangeLog |  13 ++
 gcc/cp/ChangeLog|  45 +++
 gcc/m2/ChangeLog|  45 +++
 gcc/testsuite/ChangeLog | 114 
 libstdc++-v3/ChangeLog  |  11 +
 8 files changed, 345 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 353ce3b6e2a8..b75dfdbd1095 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,114 @@
+2024-07-23  Mark Harmstone  
+
+   * dwarf2codeview.cc (get_type_num_reference_type): Handle rvalue refs.
+   (get_type_num_array_type): Add DW_TAG_rvalue_reference_type to switch.
+   (get_type_num): Handle DW_TAG_rvalue_reference_type DIEs.
+   * dwarf2codeview.h (CV_PTR_MODE_RVREF): Define.
+
+2024-07-23  Mark Harmstone  
+
+   * dwarf2codeview.cc (get_type_num_reference_type): New function.
+   (get_type_num_array_type): Add DW_TAG_reference_type to switch.
+   (get_type_num): Handle DW_TAG_reference_type DIEs.
+   * dwarf2codeview.h (CV_PTR_MODE_LVREF): Define.
+
+2024-07-23  Vineet Gupta  
+
+   * config/riscv/bitmanip.md: Fix splitter.
+
+2024-07-23  Marek Polacek  
+
+   * doc/extend.texi: Add missing @option.
+
+2024-07-23  Andi Kleen  
+
+   PR c/83324
+   * doc/extend.texi: Document [[musttail]]
+
+2024-07-23  Tobias Burnus  
+
+   * doc/install.texi (amdgcn-x-amdhsa): Suggest newer git version
+   for newlib.
+
+2024-07-23  Jiufu Guo  
+
+   PR target/96866
+   * config/rs6000/rs6000.cc (print_operand_address): Emit message for
+   unsupported operand.
+
+2024-07-23  Richard Biener  
+
+   PR tree-optimization/116002
+   * tree-ssa-structalias.cc (topo_visit): Also consider
+   SCALAR = SCALAR complex constraints as edges.
+
+2024-07-23  Jakub Jelinek  
+   Andrew Pinski  
+
+   PR tree-optimization/116034
+   * tree-ssa.cc (maybe_rewrite_mem_ref_base): Only use IMAGPART_EXPR
+   if MEM_REF offset is equal to element type size.
+
+2024-07-23  Richard Biener  
+
+   PR rtl-optimization/116002
+   * cselib.cc (cselib_hash_rtx): Use inchash to get proper mixing.
+   Consistently avoid a zero return value when hashing successfully.
+   Consistently treat a zero hash value from recursing as fatal.
+   Use hashval_t where appropriate.
+   (cselib_hash_plus_const_int): Likewise.
+   (new_cselib_val): Use hashval_t.
+   (cselib_lookup_1): Likewise.
+
+2024-07-23  liuhongt  
+
+   * config/i386/i386.cc (ix86_hardreg_mov_ok): Relax mov subreg
+   to hard register after split1.
+
+2024-07-23  Kewen Lin  
+
+   PR target/115713
+   * config/rs6000/rs6000.cc (rs6000_inner_target_options): Update option
+   set information for rs6000_opt_vars.
+
+2024-07-23  Kewen Lin  
+
+   PR target/115713
+   * config/rs6000/rs6000.cc (rs6000_inner_target_options): Avoid to
+   enable altivec or disable avoid-indexed-addresses automatically
+   when they get specified explicitly.
+
+2024-07-23  Kewen Lin  
+
+   PR target/115713
+   * config/rs6000/rs6000.cc (rs6000_option_override_internal): Emit error
+   messages when explicit VSX encounters explicit soft-float, no-altivec
+   or avoid-indexed-addresses.
+
+2024-07-23  Haochen Jiang  
+
+   * config/i386/i386.md (prefetchi): Change to %a.
+
+2024-07-23  Jeff Law  
+
+   PR rtl-optimization/115877
+   * ext-dce.cc (ext_dce_process_sets): Reasonably handle input/output
+   operands.
+   (ext_dce_rd_transfer_n): Drop bogus assertion.
+
+2024-07-23  Pan Li  
+
+   * config/riscv/iterators.md (ANYI_DOUBLE_TRUNC): Add new iterator
+   for int double truncation.
+   (ANYI_DOUBLE_TRUNCATED): Add new attr for int double truncation.
+   (anyi_double_truncated): Ditto but for lowercase.
+   * config/riscv/riscv-protos.h (riscv_expand_ustrunc): Add new
+   func decl for expanding ustrunc
+   * config/riscv/riscv.cc (riscv_expand_ustrunc): Add new func
+   impl to expand ustrunc.
+   * config/riscv/riscv.md (ustrunc2): Impl
+   the new pattern ustrunc2 for int.
+
 2024-07-22  Jan Hubicka  
 
PR ipa/109985
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 833d506febb5..d050dd677216 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20240723
+20240724
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index ea24fcfbe956..daca845240e4 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2024-07-23  Andi Kleen  
+
+   * c-attribs.cc (set_musttail_on_return): New function.
+   * c-common.h (set_m

[gcc/devel/fortran_unsigned] libstdc++: Clean up @diff@ markup in some I/O tests

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:2fab7daf202d5df7318191a835caeb2fbc342e31

commit 2fab7daf202d5df7318191a835caeb2fbc342e31
Author: Jonathan Wakely 
Date:   Mon Jul 22 13:00:26 2024 +0100

libstdc++: Clean up @diff@ markup in some I/O tests

We have a number of 27_io/* tests with comments like this:

// @require@ %-*.tst
// @diff@ %-*.tst %-*.txt

It seems that these declare required data files used by the test and a
post-test action to compare the test output with the expected result.
We do have tests that depend on some *.tst and/or *.txt files that are
copied from testsuite/data into each test's working directory before it
runs, so the comments are related to those dependencies.  However,
nothing in the current test framework actually makes use of these
comments. Currently, every test gets a fresh copy of every *.tst and
*.txt file in the testsuite/data directory, whether the test actually
requires them or not.

This change is the first in a series to clean up this unused markup in
the tests. This first step is to just remove all @require@ and @diff@
comments where they seem to serve no purpose at all. These tests do not
open any of the *.tst or *.txt files that are copied into the test's
working directory from the testsuite/data directory, so they don't
"require" any of those files, and there's no need to "diff" them after
the test runs.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_filebuf/close/char/4879.cc: Remove
@require@ and @diff@ comments.
* testsuite/27_io/basic_filebuf/close/char/9964.cc: Likewise.
* testsuite/27_io/basic_filebuf/open/char/3.cc: Likewise.
* testsuite/27_io/basic_filebuf/open/char/9507.cc: Likewise.
* testsuite/27_io/basic_filebuf/sbumpc/char/1-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sbumpc/char/2-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetc/char/1-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetc/char/2-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetn/char/1-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetn/char/2-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/snextc/char/2-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sputbackc/char/1-io.cc:
Likewise.
* testsuite/27_io/basic_filebuf/sputbackc/char/1-out.cc:
Likewise.
* testsuite/27_io/basic_filebuf/sputbackc/char/2-io.cc:
Likewise.
* testsuite/27_io/basic_filebuf/sputbackc/char/2-out.cc:
Likewise.
* testsuite/27_io/basic_filebuf/sputc/char/1-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sputc/char/2-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sputn/char/1-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sputn/char/2-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sungetc/char/1-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/sungetc/char/1-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sungetc/char/2-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/sungetc/char/2-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sputc/char/1-io.cc: Likewise.
Remove unused variable.
* testsuite/27_io/basic_filebuf/sputn/char/2-io.cc: Likewise.
* testsuite/27_io/basic_ofstream/cons/char/1.cc: Remove
@require@ and @diff@ comments. Remove unused variables.
* testsuite/27_io/basic_ofstream/rdbuf/char/2832.cc: Remove
* testsuite/27_io/ios_base/sync_with_stdio/2.cc: Likewise.

Diff:
---
 libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/4879.cc  |  4 +---
 libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/9964.cc  |  4 +---
 libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/3.cc  |  4 +---
 libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc   |  4 +---
 .../testsuite/27_io/basic_filebuf/sbumpc/char/1-out.cc |  5 +
 .../testsuite/27_io/basic_filebuf/sbumpc/char/2-out.cc |  5 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/sgetc/char/1-out.cc |  5 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/sgetc/char/2-out.cc |  5 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/1-out.cc |  5 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/2-out.cc |  5 +
 .../testsuite/27_io/basic_filebuf/snextc/char/2-out.cc |  5 +
 .../testsuite/27_io/basic_filebuf/sputbackc/char/1-io.cc   |  5 +
 .../testsuite/27_io/basic_filebuf/sputbackc/char/1-out.cc  |  5 +
 .../testsuite/27_io/basic_filebuf/sputbackc/char/2-io.cc   |  5 +
 .../testsuite/27_io/basic_filebuf/sputbackc/char/2-out.cc  |  5 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/sputc/char/1-io.cc  |  6 +-
 libstdc++-v3/t

[gcc/devel/fortran_unsigned] libstdc++: Replace @require@ markup in some I/O tests

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:e56026cec6a1834861a855da5f29b513bc5f7bfe

commit e56026cec6a1834861a855da5f29b513bc5f7bfe
Author: Jonathan Wakely 
Date:   Wed Jul 17 13:27:19 2024 +0100

libstdc++: Replace @require@ markup in some I/O tests

We can replace the @require@ markup with { dg-additional-files ... }
directives, so that the required files are explicitly named and are
explicitly copied into place for tests that require it. This will allow
a later change to remove the "Copy all required data files" step in the
proc libstdc++_init in testsuite/lib/libstdc++.exp that is marked TODO.
This commit uses dg-additional-files for a subset of the files that
contain @require@.

Also remove the @diff@ markup where appears to be copy & pasted from
other test files, and so serves no purpose. For example, there is no
output file created by 27_io/basic_ifstream/cons/char/1.cc so there is
nothing for @diff@ to compare. Maybe the purpose was to check that
reading the .tst file with an ifstream doesn't change it, but we've
survived without doing those comparisons for many years so I think we
can remove those cases of @diff@ markup.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_filebuf/close/char/2.cc: Remove
@require@ and @diff@ markup. Use dg-additional-files. Remove
unused variable.
* testsuite/27_io/basic_filebuf/close/char/3.cc: Remove
@require@ and @diff@ markup. Use dg-additional-files.
* testsuite/27_io/basic_filebuf/close/char/4.cc: Likewise.
* testsuite/27_io/basic_filebuf/close/char/5.cc: Likewise.
* testsuite/27_io/basic_filebuf/in_avail/char/1.cc: Likewise.
* testsuite/27_io/basic_filebuf/is_open/char/1.cc: Likewise.
* testsuite/27_io/basic_filebuf/open/char/1.cc: Likewise.
* testsuite/27_io/basic_filebuf/open/char/2.cc: Likewise.
* testsuite/27_io/basic_filebuf/sbumpc/char/1-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/sbumpc/char/1-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/sbumpc/char/2-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/sbumpc/char/2-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/char/1-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/char/1-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/char/2-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/char/2-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetc/char/1-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetc/char/1-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetc/char/2-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetc/char/2-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetn/char/2-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetn/char/2-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/snextc/char/1-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/snextc/char/1-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/snextc/char/1-out.cc: Likewise.
* testsuite/27_io/basic_filebuf/snextc/char/2-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/snextc/char/2-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/sputbackc/char/1-in.cc:
Likewise.
* testsuite/27_io/basic_filebuf/sputbackc/char/2-in.cc:
Likewise.
* testsuite/27_io/basic_filebuf/sputc/char/1-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/sputc/char/2-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/sputc/char/2-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/sputn/char/1-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/sputn/char/1-io.cc: Likewise.
Remove unused variable.
* testsuite/27_io/basic_filebuf/sputn/char/2-in.cc: Remove
@require@ and @diff@ markup. Use dg-additional-files.
* testsuite/27_io/basic_filebuf/sungetc/char/1-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/sungetc/char/2-in.cc: Likewise.
* testsuite/27_io/basic_ifstream/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_ifstream/open/char/1.cc: Likewise.
* testsuite/27_io/basic_ifstream/rdbuf/char/2832.cc: Likewise.
* testsuite/27_io/basic_istream/readsome/char/67

[gcc/devel/fortran_unsigned] libstdc++: Use dg-additional-files in some I/O tests

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:815d1e048ac50f718e351fba0b2ef11319fab1dd

commit 815d1e048ac50f718e351fba0b2ef11319fab1dd
Author: Jonathan Wakely 
Date:   Mon Jul 22 14:01:43 2024 +0100

libstdc++: Use dg-additional-files in some I/O tests

Use the dg-additional-files directive to declare files that need to be
copied into the test's working directory. This is currently redundant
(as all .tst and .txt files are copied for all tests) but is a step
towards not copying all files.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_filebuf/imbue/char/2.cc: Use
dg-additional-files.
* testsuite/27_io/basic_filebuf/imbue/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_filebuf/open/char/path.cc: Likewise.
* testsuite/27_io/basic_filebuf/pbackfail/char/9761.cc:
Likewise.
* testsuite/27_io/basic_filebuf/seekoff/char/3-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekoff/char/3-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/char/3-in.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/char/3-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/setbuf/char/1.cc: Likewise.
* testsuite/27_io/basic_filebuf/sgetn/char/3.cc: Likewise.
* testsuite/27_io/basic_filebuf/underflow/10096.cc: Likewise.
* testsuite/27_io/basic_fstream/cons/char/path.cc: Likewise.
* testsuite/27_io/basic_fstream/open/char/path.cc: Likewise.
* testsuite/27_io/basic_ifstream/assign/1.cc: Likewise.
* testsuite/27_io/basic_ifstream/cons/move.cc: Likewise.
* testsuite/27_io/basic_ifstream/cons/char/path.cc: Likewise.
* testsuite/27_io/basic_ifstream/open/char/path.cc: Likewise.
* testsuite/27_io/basic_ifstream/open/wchar_t/1.cc: Likewise.
* testsuite/27_io/objects/char/10.cc: Likewise.
* testsuite/27_io/objects/char/12048-1.cc: Likewise.
* testsuite/27_io/objects/char/12048-2.cc: Likewise.
* testsuite/27_io/objects/char/12048-3.cc: Likewise.
* testsuite/27_io/objects/char/12048-4.cc: Likewise.
* testsuite/27_io/objects/char/12048-5.cc: Likewise.
* testsuite/27_io/objects/wchar_t/12048-1.cc: Likewise.
* testsuite/27_io/objects/wchar_t/12048-2.cc: Likewise.
* testsuite/27_io/objects/wchar_t/12048-3.cc: Likewise.
* testsuite/27_io/objects/wchar_t/12048-4.cc: Likewise.
* testsuite/27_io/objects/wchar_t/12048-5.cc: Likewise.
* testsuite/ext/stdio_sync_filebuf/char/12048-1.cc: Likewise.
* testsuite/ext/stdio_sync_filebuf/char/12048-2.cc: Likewise.
* testsuite/ext/stdio_sync_filebuf/char/12048-3.cc: Likewise.
* testsuite/ext/stdio_sync_filebuf/char/12048-4.cc: Likewise.
* testsuite/ext/stdio_sync_filebuf/wchar_t/12948-1.cc: Likewise.
* testsuite/ext/stdio_sync_filebuf/wchar_t/12948-2.cc: Likewise.
* testsuite/ext/stdio_sync_filebuf/wchar_t/12948-3.cc: Likewise.
* testsuite/ext/stdio_sync_filebuf/wchar_t/12948-4.cc: Likewise.

Diff:
---
 libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/2.cc| 4 +++-
 libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/2.cc | 1 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/path.cc  | 1 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/pbackfail/char/9761.cc | 1 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/3-in.cc   | 3 ++-
 libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/3-io.cc   | 3 ++-
 libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/3-in.cc   | 1 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/3-io.cc   | 1 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/setbuf/char/1.cc   | 1 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/3.cc| 1 +
 libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/10096.cc | 1 +
 libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/path.cc  | 1 +
 libstdc++-v3/testsuite/27_io/basic_fstream/open/char/path.cc  | 1 +
 libstdc++-v3/testsuite/27_io/basic_ifstream/assign/1.cc   | 3 ++-
 libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc | 1 +
 libstdc++-v3/testsuite/27_io/basic_ifstream/cons/move.cc  | 3 ++-
 libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/path.cc | 1 +
 libstdc++-v3/testsuite/27_io/basic_ifstream/open/wchar_t/1.cc | 3 ++-
 libstdc++-v3/testsuite/27_io/objects/char/10.cc   | 1 +
 libstdc++-v3/testsuite/27_io/objects/char/12048-1.cc  | 1 +
 libstdc++-v3/testsuite/27_io/objects/char/12048-2.cc  | 1 +
 libstdc++-v3/testsuite/27_io/objects/char/12048-3.cc  | 1 +
 libstdc++-v3/testsuite/27_io/objects/char/12048-4.cc  | 1 +
 libstdc++-v3/testsuite/27_io/objects/char/12048-5.cc  | 1 +

[gcc/devel/fortran_unsigned] libstdc++: Add file-io-diff to replace @diff@ markup in I/O tests

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:5552c6fc01f5b9402ca48a7ffa548aa9fb1d4387

commit 5552c6fc01f5b9402ca48a7ffa548aa9fb1d4387
Author: Jonathan Wakely 
Date:   Mon Jul 22 14:39:57 2024 +0100

libstdc++: Add file-io-diff to replace @diff@ markup in I/O tests

This adds a new dg-final action to compare two files after a test has
run, so that we can verify that fstream operations produce the expected
results. With this change, all uses of @diff@ that seem potentially
useful have been converted to actually compare the files and FAIL if
they differ.

The file-io-diff action can take two arguments naming the files to be
compared, or for convenience it can take a single string and will
compare STR.tst and STR.txt, as that's how it's commonly used.

Additionally, all remaining uses of @require@ are converted to
dg-additional-files directives, so that the TODO in libstdc++.exp can
be resolved.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_filebuf/close/char/1.cc: Remove
@require@ and @diff@. Use dg-final file-io-diff action.
* testsuite/27_io/basic_istream/extractors_other/char/2.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_other/wchar_t/2.cc:
Likewise.
* testsuite/27_io/basic_istream/get/char/2.cc: Likewise.
* testsuite/27_io/basic_istream/get/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_istream/ignore/char/3.cc: Likewise.
* testsuite/27_io/basic_istream/ignore/wchar_t/3.cc: Likewise.
* testsuite/27_io/basic_istream/peek/char/6414.cc: Likewise.
* testsuite/27_io/basic_istream/peek/wchar_t/6414.cc: Likewise.
* testsuite/27_io/basic_istream/seekg/char/fstream.cc: Likewise.
* testsuite/27_io/basic_istream/seekg/wchar_t/fstream.cc:
Likewise.
* testsuite/27_io/basic_istream/tellg/char/fstream.cc: Likewise.
* testsuite/27_io/basic_istream/tellg/wchar_t/fstream.cc:
Likewise.
* testsuite/27_io/basic_ofstream/open/char/1.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/1.cc:
Likewise.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/1.cc:
Likewise.
* testsuite/27_io/ios_base/sync_with_stdio/1.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/2.cc:
Likewise. Check file positions.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/2.cc:
Likewise.
* testsuite/lib/libstdc++.exp (file-io-diff): New proc.

Diff:
---
 .../testsuite/27_io/basic_filebuf/close/char/1.cc  |  6 ++--
 .../27_io/basic_istream/extractors_other/char/2.cc |  9 --
 .../basic_istream/extractors_other/wchar_t/2.cc|  9 --
 .../testsuite/27_io/basic_istream/get/char/2.cc|  8 --
 .../testsuite/27_io/basic_istream/get/wchar_t/2.cc |  8 --
 .../testsuite/27_io/basic_istream/ignore/char/3.cc |  8 --
 .../27_io/basic_istream/ignore/wchar_t/3.cc|  8 --
 .../27_io/basic_istream/peek/char/6414.cc  |  9 --
 .../27_io/basic_istream/peek/wchar_t/6414.cc   |  9 --
 .../27_io/basic_istream/seekg/char/fstream.cc  | 10 +--
 .../27_io/basic_istream/seekg/wchar_t/fstream.cc   | 12 +---
 .../27_io/basic_istream/tellg/char/fstream.cc  | 10 +--
 .../27_io/basic_istream/tellg/wchar_t/fstream.cc   | 10 +--
 .../testsuite/27_io/basic_ofstream/open/char/1.cc  |  5 ++--
 .../27_io/basic_ostream/inserters_other/char/1.cc  |  8 --
 .../27_io/basic_ostream/inserters_other/char/2.cc  |  7 +++--
 .../basic_ostream/inserters_other/wchar_t/1.cc |  8 --
 .../basic_ostream/inserters_other/wchar_t/2.cc |  7 +++--
 .../testsuite/27_io/ios_base/sync_with_stdio/1.cc  |  5 ++--
 libstdc++-v3/testsuite/lib/libstdc++.exp   | 32 ++
 20 files changed, 131 insertions(+), 57 deletions(-)

diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc 
b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc
index e2b336a711d6..d9e9c53e3e6e 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/close/char/1.cc
@@ -15,14 +15,14 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// 27.8.1.3 filebuf member functions
-// @require@ %-*.tst %-*.txt
-// @diff@ %-*.tst %-*.txt
+// C++98 27.8.1.3 filebuf member functions
 
 // various tests for filebuf::open() and filebuf::close() including
 // the non-portable functionality in the libstdc++-v3 IO library
 
 // { dg-require-fileio "" }
+// { dg-additional-files "filebuf_members-1.tst filebuf_members-1.txt" }
+// { dg-final { file-io-diff "filebuf_members-1" } }
 
 #include 
 #include 
diff --git 
a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_

[gcc/devel/fortran_unsigned] libstdc++: Use dg-additional-files in some algorithm tests

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:8d9ff68d69fc4209feede3bcd43c4021f0167bc4

commit 8d9ff68d69fc4209feede3bcd43c4021f0167bc4
Author: Jonathan Wakely 
Date:   Mon Jul 22 14:01:43 2024 +0100

libstdc++: Use dg-additional-files in some algorithm tests

Use the dg-additional-files directive to declare files that need to be
copied into the test's working directory. This is currently redundant
(as all .tst and .txt files are copied for all tests) but is a step
towards not copying all files.

libstdc++-v3/ChangeLog:

* testsuite/25_algorithms/advance/istreambuf_iterators/char/2.cc:
Use dg-additional-files.
* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2.cc:
Likewise.
* testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc:
Likewise.
* testsuite/25_algorithms/copy/streambuf_iterators/wchar_t/4.cc:
Likewise.
* testsuite/25_algorithms/copy_n/istreambuf_iterator/2.cc:
Likewise.
* testsuite/25_algorithms/copy_n/istreambuf_iterator/deque.cc:
Likewise.
* testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc:
Likewise.
* testsuite/25_algorithms/find/istreambuf_iterators/wchar_t/2.cc:
Likewise.

Diff:
---
 .../testsuite/25_algorithms/advance/istreambuf_iterators/char/2.cc   | 1 +
 .../testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2.cc| 1 +
 libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc  | 1 +
 .../testsuite/25_algorithms/copy/streambuf_iterators/wchar_t/4.cc| 1 +
 libstdc++-v3/testsuite/25_algorithms/copy_n/istreambuf_iterator/2.cc | 1 +
 libstdc++-v3/testsuite/25_algorithms/copy_n/istreambuf_iterator/deque.cc | 1 +
 libstdc++-v3/testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc | 1 +
 .../testsuite/25_algorithms/find/istreambuf_iterators/wchar_t/2.cc   | 1 +
 8 files changed, 8 insertions(+)

diff --git 
a/libstdc++-v3/testsuite/25_algorithms/advance/istreambuf_iterators/char/2.cc 
b/libstdc++-v3/testsuite/25_algorithms/advance/istreambuf_iterators/char/2.cc
index 1a0635c0ccaa..c5414d4975dc 100644
--- 
a/libstdc++-v3/testsuite/25_algorithms/advance/istreambuf_iterators/char/2.cc
+++ 
b/libstdc++-v3/testsuite/25_algorithms/advance/istreambuf_iterators/char/2.cc
@@ -16,6 +16,7 @@
 // .
 
 // { dg-require-fileio "" }
+// { dg-additional-files "istream_unformatted-1.txt" }
 
 #include 
 #include 
diff --git 
a/libstdc++-v3/testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2.cc
 
b/libstdc++-v3/testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2.cc
index 823e275da19f..c2fd748cbf09 100644
--- 
a/libstdc++-v3/testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2.cc
+++ 
b/libstdc++-v3/testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2.cc
@@ -16,6 +16,7 @@
 // .
 
 // { dg-require-fileio "" }
+// { dg-additional-files "istream_unformatted-1.txt" }
 
 #include 
 #include 
diff --git 
a/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc 
b/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc
index 67888797047b..3d1c7c7595d8 100644
--- a/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc
@@ -27,6 +27,7 @@
 #include 
 
 // { dg-require-fileio "" }
+// { dg-additional-files "istream_unformatted-1.txt" }
 
 // In the occasion of libstdc++/25482
 void test01()
diff --git 
a/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/wchar_t/4.cc 
b/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/wchar_t/4.cc
index e1adccfdd216..8d380052313d 100644
--- a/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/wchar_t/4.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/wchar_t/4.cc
@@ -18,6 +18,7 @@
 // .
 
 // { dg-require-fileio "" }
+// { dg-additional-files "istream_unformatted-1.txt" }
 
 #include 
 #include 
diff --git 
a/libstdc++-v3/testsuite/25_algorithms/copy_n/istreambuf_iterator/2.cc 
b/libstdc++-v3/testsuite/25_algorithms/copy_n/istreambuf_iterator/2.cc
index 5179d78b455d..a437bedb420b 100644
--- a/libstdc++-v3/testsuite/25_algorithms/copy_n/istreambuf_iterator/2.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/copy_n/istreambuf_iterator/2.cc
@@ -1,5 +1,6 @@
 // { dg-do run { target c++11 } }
 // { dg-require-fileio "" }
+// { dg-additional-files "istream_unformatted-1.txt" }
 
 // Copyright (C) 2020-2024 Free Software Foundation, Inc.
 //
diff --git 
a/libstdc++-v3/testsuite/25_algorithms/copy_n/istreambuf_iterator/deque.cc 
b/libstdc++-v3/testsuite/25_algorithms/copy_n/istreambuf_iterator/deque.cc
index 14f58998fefa..1353282f6a04 100644
--- a/libstdc++-v3/testsuite/25_algorithms/copy_n/istreambuf_iterator

[gcc/devel/fortran_unsigned] libstdc++: Use dg-additional-files in some non-I/O tests

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:6aec3ce1386d21e20b759efe28c09c4c8d8dbd28

commit 6aec3ce1386d21e20b759efe28c09c4c8d8dbd28
Author: Jonathan Wakely 
Date:   Mon Jul 22 15:15:16 2024 +0100

libstdc++: Use dg-additional-files in some non-I/O tests

libstdc++-v3/ChangeLog:

* testsuite/20_util/hash/chi2_q_document_words.cc: Use
dg-additional-files for input text.
* testsuite/performance/ext/pb_ds/all_text_find.cc: Likewise.
* testsuite/performance/ext/pb_ds/multimap_text_find.hpp:
Likewise.
* testsuite/performance/ext/pb_ds/multimap_text_insert.hpp:
Likewise.
* testsuite/performance/ext/pb_ds/multimap_text_insert_mem.hpp:
Likewise.
* testsuite/performance/ext/pb_ds/priority_queue_text_join.cc:
Likewise.
* testsuite/performance/ext/pb_ds/priority_queue_text_modify.hpp: 
Likewise.
* testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem.cc: 
Likewise.
* testsuite/performance/ext/pb_ds/priority_queue_text_push.cc:
Likewise.
* testsuite/performance/ext/pb_ds/priority_queue_text_push_pop.cc: 
Likewise.
* testsuite/performance/ext/pb_ds/tree_text_insert.cc: Likewise.
* testsuite/performance/ext/pb_ds/tree_text_lor_find.cc:
Likewise.

Diff:
---
 libstdc++-v3/testsuite/20_util/hash/chi2_q_document_words.cc| 2 ++
 libstdc++-v3/testsuite/performance/ext/pb_ds/all_text_find.cc   | 2 ++
 libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_find.hpp | 2 ++
 libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert.hpp   | 2 ++
 .../testsuite/performance/ext/pb_ds/multimap_text_insert_mem.hpp| 2 ++
 .../testsuite/performance/ext/pb_ds/priority_queue_text_join.cc | 2 ++
 .../testsuite/performance/ext/pb_ds/priority_queue_text_modify.hpp  | 2 ++
 .../testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem.cc  | 2 ++
 .../testsuite/performance/ext/pb_ds/priority_queue_text_push.cc | 2 ++
 .../testsuite/performance/ext/pb_ds/priority_queue_text_push_pop.cc | 2 ++
 libstdc++-v3/testsuite/performance/ext/pb_ds/tree_text_insert.cc| 2 ++
 libstdc++-v3/testsuite/performance/ext/pb_ds/tree_text_lor_find.cc  | 2 ++
 12 files changed, 24 insertions(+)

diff --git a/libstdc++-v3/testsuite/20_util/hash/chi2_q_document_words.cc 
b/libstdc++-v3/testsuite/20_util/hash/chi2_q_document_words.cc
index a6ebc0011eba..3c77527c27ce 100644
--- a/libstdc++-v3/testsuite/20_util/hash/chi2_q_document_words.cc
+++ b/libstdc++-v3/testsuite/20_util/hash/chi2_q_document_words.cc
@@ -19,6 +19,8 @@
 // along with this library; see the file COPYING3.  If not see
 // .
 
+// { dg-additional-files "thirty_years_among_the_dead_preproc.txt" }
+
 #include "chi2_quality.h"
 
 // Tests chi^2 for a set of words taken from a document written in English.
diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/all_text_find.cc 
b/libstdc++-v3/testsuite/performance/ext/pb_ds/all_text_find.cc
index 13c73a76647d..df822c3d5f78 100644
--- a/libstdc++-v3/testsuite/performance/ext/pb_ds/all_text_find.cc
+++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/all_text_find.cc
@@ -29,6 +29,8 @@
 // purpose. It is provided "as is" without express or implied
 // warranty.
 
+// { dg-additional-files "thirty_years_among_the_dead_preproc.txt" }
+
 /**
  * @file text_find_timing_test.cpp
  * Contains test for finding text.
diff --git 
a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_find.hpp 
b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_find.hpp
index 18e383ea17c6..dbaaf04a1b64 100644
--- a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_find.hpp
+++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_find.hpp
@@ -29,6 +29,8 @@
 // purpose. It is provided "as is" without express or implied
 // warranty.
 
+// { dg-additional-files "thirty_years_among_the_dead_preproc.txt" }
+
 /**
  * @file multimap_text_find_timing_test.cpp
  * Contains test for inserting text words.
diff --git 
a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert.hpp 
b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert.hpp
index 737be39a154b..2c86b52f30a2 100644
--- a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert.hpp
+++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert.hpp
@@ -29,6 +29,8 @@
 // purpose. It is provided "as is" without express or implied
 // warranty.
 
+// { dg-additional-files "thirty_years_among_the_dead_preproc.txt" }
+
 /**
  * @file multimap_text_insert_timing_test.cpp
  * Contains test for inserting text words.
diff --git 
a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert_mem.hpp 
b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert_mem.hpp
index 9ce235381bd8..ab755312c69a 100644
--- a/libstdc++-v

[gcc/devel/fortran_unsigned] libstdc++: Stop copying all data files into test directory

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:64789c1b0d105ed73c3deecc6da0935042c15a7c

commit 64789c1b0d105ed73c3deecc6da0935042c15a7c
Author: Jonathan Wakely 
Date:   Mon Jul 22 14:07:32 2024 +0100

libstdc++: Stop copying all data files into test directory

This removes the TODO in libstdc++_init, so that we don't copy all *.tst
and *.txt files from testsuite/data into every test's working directory.
Instead, only the necessary files declared with dg-additional-files are
copied.

libstdc++-v3/ChangeLog:

* testsuite/lib/libstdc++.exp (libstdc++_init): Do not copy all
data files into test directory.

Diff:
---
 libstdc++-v3/testsuite/lib/libstdc++.exp | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp 
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index ef511949c7bc..4bf88e72d051 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -158,11 +158,6 @@ proc libstdc++_init { testfile } {
 global dg-do-what-default
 set dg-do-what-default run
 
-# Copy all required data files.
-# TODO: Use dg-additional-files in individual tests instead of doing this.
-v3-copy-files [glob -nocomplain "$srcdir/data/*.tst"]
-v3-copy-files [glob -nocomplain "$srcdir/data/*.txt"]
-
 set ld_library_path_tmp ""
 
 # Locate libgcc.a so we don't need to account for different values of


[gcc/devel/fortran_unsigned] libstdc++: Rename tests [PR12048]

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:218aaec86650ec6cae2fc54fdfcedc5abccc55dd

commit 218aaec86650ec6cae2fc54fdfcedc5abccc55dd
Author: Jonathan Wakely 
Date:   Mon Jul 22 15:50:19 2024 +0100

libstdc++: Rename tests [PR12048]

These have the wrong PR number in the filenames.

libstdc++-v3/ChangeLog:

PR libstdc++/12048
* testsuite/ext/stdio_sync_filebuf/wchar_t/12948-1.cc: Move to...
* testsuite/ext/stdio_sync_filebuf/wchar_t/12048-1.cc: ...here.
* testsuite/ext/stdio_sync_filebuf/wchar_t/12948-2.cc: Move to...
* testsuite/ext/stdio_sync_filebuf/wchar_t/12048-2.cc: ...here.
* testsuite/ext/stdio_sync_filebuf/wchar_t/12948-3.cc: Move to...
* testsuite/ext/stdio_sync_filebuf/wchar_t/12048-3.cc: ...here.
* testsuite/ext/stdio_sync_filebuf/wchar_t/12948-4.cc: Move to...
* testsuite/ext/stdio_sync_filebuf/wchar_t/12048-4.cc: ...here.

Diff:
---
 .../testsuite/ext/stdio_sync_filebuf/wchar_t/{12948-1.cc => 12048-1.cc}   | 0
 .../testsuite/ext/stdio_sync_filebuf/wchar_t/{12948-2.cc => 12048-2.cc}   | 0
 .../testsuite/ext/stdio_sync_filebuf/wchar_t/{12948-3.cc => 12048-3.cc}   | 0
 .../testsuite/ext/stdio_sync_filebuf/wchar_t/{12948-4.cc => 12048-4.cc}   | 0
 4 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-1.cc 
b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12048-1.cc
similarity index 100%
rename from libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-1.cc
rename to libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12048-1.cc
diff --git a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-2.cc 
b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12048-2.cc
similarity index 100%
rename from libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-2.cc
rename to libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12048-2.cc
diff --git a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-3.cc 
b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12048-3.cc
similarity index 100%
rename from libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-3.cc
rename to libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12048-3.cc
diff --git a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-4.cc 
b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12048-4.cc
similarity index 100%
rename from libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12948-4.cc
rename to libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12048-4.cc


[gcc/devel/fortran_unsigned] libstdc++: Remove duplicate include header from ranges_algobase.h

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:30c2dbf53800fffba148fadc3b8bac556efcc572

commit 30c2dbf53800fffba148fadc3b8bac556efcc572
Author: Michael Levine 
Date:   Tue Jul 23 12:50:31 2024 +0100

libstdc++: Remove duplicate include header from ranges_algobase.h

The bits/stl_algobase.h header was added to bits/ranges_algobase.h
separately through two related commits:
r15-1106-g674d213ab91871
r15-1117-g0bb1db32ccf54a

The comment for the first time it is included in the file is also
incorrect (my error from that 2nd one) since it is really being included
for __memcmp, not __memcpy

This patch removes the duplicate header include.

libstdc++-v3/ChangeLog:

* include/bits/ranges_algobase.h: Remove duplicate include of
.

Signed-off-by: Michael Levine 

Diff:
---
 libstdc++-v3/include/bits/ranges_algobase.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/ranges_algobase.h 
b/libstdc++-v3/include/bits/ranges_algobase.h
index 7ce5ac314f25..fd35b8ba14cb 100644
--- a/libstdc++-v3/include/bits/ranges_algobase.h
+++ b/libstdc++-v3/include/bits/ranges_algobase.h
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include  // __memcpy
 #include  // ranges::begin, ranges::range etc.
 #include   // __invoke
 #include  // __is_byte


[gcc/devel/fortran_unsigned] libstdc++: Fix std::vector for -std=gnu++14 -fconcepts [PR116070]

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:a45833868858e10293d68c72717ebec533e189a8

commit a45833868858e10293d68c72717ebec533e189a8
Author: Jonathan Wakely 
Date:   Wed Jul 24 11:32:22 2024 +0100

libstdc++: Fix std::vector for -std=gnu++14 -fconcepts [PR116070]

This questionable combination of flags causes a number of errors. This
one in std::vector needs to be fixed in the gcc-13 branch so I'm
committing it separately to simplify backporting.

libstdc++-v3/ChangeLog:

PR libstdc++/116070
* include/bits/stl_bvector.h: Check feature test macro before
using is_default_constructible_v.

Diff:
---
 libstdc++-v3/include/bits/stl_bvector.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/stl_bvector.h 
b/libstdc++-v3/include/bits/stl_bvector.h
index 245e1c3b3a77..c45b7ff3320d 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -593,7 +593,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_GLIBCXX20_CONSTEXPR
_Bvector_impl() _GLIBCXX_NOEXCEPT_IF(
  is_nothrow_default_constructible<_Bit_alloc_type>::value)
-#if __cpp_concepts
+#if __cpp_concepts && __glibcxx_type_trait_variable_templates
requires is_default_constructible_v<_Bit_alloc_type>
 #endif
: _Bit_alloc_type()


[gcc/devel/fortran_unsigned] libstdc++: Fix and for -std=gnu++14 -fconcepts [PR116070]

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:00fc1169f7cea8149c2a5442d07b64615cb8b336

commit 00fc1169f7cea8149c2a5442d07b64615cb8b336
Author: Jonathan Wakely 
Date:   Wed Jul 24 11:32:22 2024 +0100

libstdc++: Fix  and  for -std=gnu++14 -fconcepts 
[PR116070]

This questionable combination of flags causes a number of errors. The
ones in the rvalue stream overloads need to be fixed in the gcc-14
branch so I'm committing it separately to simplify backporting.

libstdc++-v3/ChangeLog:

PR libstdc++/116070
* include/std/istream: Check feature test macro before using
is_class_v and is_same_v.
* include/std/ostream: Likewise.

Diff:
---
 libstdc++-v3/include/std/istream | 2 +-
 libstdc++-v3/include/std/ostream | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream
index 11d51d3e666c..a2b207dae78c 100644
--- a/libstdc++-v3/include/std/istream
+++ b/libstdc++-v3/include/std/istream
@@ -1069,7 +1069,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // 2328. Rvalue stream extraction should use perfect forwarding
   // 1203. More useful rvalue stream insertion
 
-#if __cpp_concepts >= 201907L
+#if __cpp_concepts >= 201907L && __glibcxx_type_trait_variable_templates
   template
 requires __derived_from_ios_base<_Is>
   && requires (_Is& __is, _Tp&& __t) { __is >> std::forward<_Tp>(__t); }
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 8a21758d0a33..12be6c4fd178 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -768,7 +768,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // 1203. More useful rvalue stream insertion
 
-#if __cpp_concepts >= 201907L
+#if __cpp_concepts >= 201907L && __glibcxx_type_trait_variable_templates
   // Use concepts if possible because they're cheaper to evaluate.
   template
 concept __derived_from_ios_base = is_class_v<_Tp>


[gcc/devel/fortran_unsigned] Daily bump.

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:583c572b7a0e8035956a45b624a05e5e6f8742ed

commit 583c572b7a0e8035956a45b624a05e5e6f8742ed
Author: GCC Administrator 
Date:   Thu Jul 25 00:19:51 2024 +

Daily bump.

Diff:
---
 ChangeLog   |   4 +
 gcc/ChangeLog   | 548 
 gcc/DATESTAMP   |   2 +-
 gcc/analyzer/ChangeLog  |  31 +++
 gcc/cp/ChangeLog|  94 +
 gcc/jit/ChangeLog   |   5 +
 gcc/m2/ChangeLog|   5 +
 gcc/testsuite/ChangeLog |  91 
 libcpp/ChangeLog|  15 ++
 libstdc++-v3/ChangeLog  | 261 +++
 10 files changed, 1055 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 8f578c0ff0c3..6f28b10f9cad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-07-24  Matthew Malcomson  
+
+   * MAINTAINERS: Update my email address.
+
 2024-07-13  Richard Sandiford  
 
* MAINTAINERS: Replace tabs with spaces.  Add a bugzilla account
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b75dfdbd1095..0ee5f8b67cb5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,551 @@
+2024-07-24  David Malcolm  
+
+   * diagnostic-format-sarif.cc (sarif_builder::make_locations_arr):
+   Don't add entirely empty location objects, such as for
+   UNKNOWN_LOCATION.
+   (test_sarif_diagnostic_context::test_sarif_diagnostic_context):
+   Add param "main_input_filename".
+   (selftest::test_simple_log): Provide above param.  Verify that
+   "locations" is empty.
+   (selftest::test_simple_log_2): New.
+   (selftest::diagnostic_format_sarif_cc_tests): Call it.
+
+2024-07-24  David Malcolm  
+
+   * diagnostic-format-sarif.cc (sarif_builder::flush_to_object):
+   New, using code moved from...
+   (sarif_builder::end_group): ...here.
+   (class selftest::test_sarif_diagnostic_context): New.
+   (selftest::test_simple_log): New.
+   (selftest::diagnostic_format_sarif_cc_tests): Call it.
+   * json.h (json::object::is_empty): New.
+   * selftest-diagnostic.cc (test_diagnostic_context::report): New.
+   * selftest-diagnostic.h (test_diagnostic_context::report): New
+   decl.
+   * selftest-json.cc (selftest::assert_json_string_eq): New.
+   (selftest::expect_json_object_with_string_property): New.
+   (selftest::assert_json_string_property_eq): New.
+   * selftest-json.h (selftest::assert_json_string_eq): New decl.
+   (ASSERT_JSON_STRING_EQ): New macro.
+   (selftest::expect_json_object_with_string_property): New decl.
+   (EXPECT_JSON_OBJECT_WITH_STRING_PROPERTY): New macro.
+
+2024-07-24  David Malcolm  
+
+   * diagnostic-format-sarif.cc
+   (sarif_builder::make_location_object): Add "annotations" property if
+   there are any labelled ranges (§3.28.6).
+   (selftest::test_make_location_object): Verify annotations are added
+   to location_obj.
+   * json.h (json::array::size): New.
+   (json::array::operator[]): New.
+   * selftest-json.cc
+   (selftest::expect_json_object_with_array_property): New.
+   * selftest-json.h
+   (selftest::expect_json_object_with_array_property): New decl.
+   (EXPECT_JSON_OBJECT_WITH_ARRAY_PROPERTY): New macro.
+
+2024-07-24  David Malcolm  
+
+   * diagnostic-format-sarif.cc
+   (make_date_time_string_for_current_time): New.
+   (sarif_invocation::sarif_invocation): Set "startTimeUtc"
+   property (§3.20.7).
+   (sarif_invocation::prepare_to_flush): Set "endTimeUtc"
+   property (§3.20.8).
+
+2024-07-24  David Malcolm  
+
+   * diagnostic-format-sarif.cc (sarif_invocation::sarif_invocation):
+   Add "original_argv" param and use it to populate "arguments"
+   property (§3.20.2).
+   (sarif_builder::sarif_builder): Pass argv to m_invocation_obj's
+   ctor.
+   * diagnostic.cc (diagnostic_context::initialize): Initialize
+   m_original_argv.
+   (diagnostic_context::finish): Clean up m_original_argv.
+   (diagnostic_context::set_original_argv): New.
+   * diagnostic.h: Include "unique-argv.h".
+   (diagnostic_context::set_original_argv): New decl.
+   (diagnostic_context::get_original_argv): New decl.
+   (diagnostic_context::m_original_argv): New field.
+   * toplev.cc: Include "unique-argv.h".
+   (general_init): Add "original_argv" param and move it to global_dc.
+   (toplev::main): Stash a copy of the original argv before expansion,
+   and pass it to general_init for use by SARIF output.
+   * unique-argv.h: New file.
+
+2024-07-24  David Malcolm  
+
+   * diagnostic-format-sarif.cc
+   (sarif_builder::make_artifact_location_object): Make public.
+   (sarif_invocation::sarif_invocation): Add param "builder".
+   Use it to potentially populate the "workingDirectory" property
+   with the result of pwd (§3.20.19).
+   (sarif_builder::sarif_builder): Pass *this to m_invocation_obj'

[gcc/devel/fortran_unsigned] libstdc++: Fix testsuite for remote testing (and sim)

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:5816b7db1e2f583ed1cbf8d7403a93531450d03b

commit 5816b7db1e2f583ed1cbf8d7403a93531450d03b
Author: Andrew Pinski 
Date:   Wed Jul 24 18:50:08 2024 -0700

libstdc++: Fix testsuite for remote testing (and sim)

The problem here is that v3_additional_files will have a space
at the begining of the string as dg-additional-files will append
`" " $files` to it.  Then when split is called on that string,
there will be an empty file and copying a dir will just fail for
remote/sim testing (I didn't look at why it works for native
testing though).

Ran a full libstdc++ testsuite using a sim board for testing.

libstdc++-v3/ChangeLog:

* testsuite/lib/libstdc++.exp (v3_target_compile): Call
string trim on v3_target_compile before calling split.

Signed-off-by: Andrew Pinski 

Diff:
---
 libstdc++-v3/testsuite/lib/libstdc++.exp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp 
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 4bf88e72d051..c11e752ecfb1 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -639,7 +639,8 @@ proc v3_target_compile { source dest type options } {
 lappend options "timeout=[timeout_value]"
 
 global v3_additional_files
-foreach file [split $v3_additional_files " "] {
+# There will be an empty file at the begining of the list so trim it off.
+foreach file [split [string trim $v3_additional_files] " "] {
global srcdir
v3-copy-file "$srcdir/data/$file" $file
 }


[gcc/devel/fortran_unsigned] libstdc++: Move std::optional assertions out of _M_get()

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:5b1ead44898908123560a7e4f2be237b2ef53cb9

commit 5b1ead44898908123560a7e4f2be237b2ef53cb9
Author: Jonathan Wakely 
Date:   Mon Jul 22 20:24:19 2024 +0100

libstdc++: Move std::optional assertions out of _M_get()

Currently we implement the precondition for accessing the contained
value of a std::optional in the _M_get() accessor in the base class.
This means that we always check the assertions even in internal
functions that have an explicit check for a contained value being
present, such as value() and value_or(U&&). Although those redundant
assertions should get optimized out in most cases, they might hurt
inliner heuristics and generally give the compiler more work to do.
And they won't be optimized out at all for non-optimized builds.

The current assertions also result in repeated invalid bug reports, such
as PR 91281, PR 101659, PR 102712, and PR 107894.

We can move the assertions from the internal accessors to the public
member functions where the preconditions are specified.

Reviewed-by: Ville Voutilainen 

libstdc++-v3/ChangeLog:

* include/std/optional (_Optional_base_impl::_M_get()): Move
assertions to ...
(optional::operator->, optional::operator*): ... here.

Diff:
---
 libstdc++-v3/include/std/optional | 40 +--
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/libstdc++-v3/include/std/optional 
b/libstdc++-v3/include/std/optional
index 48e0f3d36f29..af72004645e2 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -472,17 +472,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // The _M_get operations have _M_engaged as a precondition.
   constexpr _Tp&
   _M_get() noexcept
-  {
-   __glibcxx_assert(this->_M_is_engaged());
-   return static_cast<_Dp*>(this)->_M_payload._M_get();
-  }
+  { return static_cast<_Dp*>(this)->_M_payload._M_get(); }
 
   constexpr const _Tp&
   _M_get() const noexcept
-  {
-   __glibcxx_assert(this->_M_is_engaged());
-   return static_cast(this)->_M_payload._M_get();
-  }
+  { return static_cast(this)->_M_payload._M_get(); }
 };
 
   /**
@@ -958,27 +952,45 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Observers.
   constexpr const _Tp*
   operator->() const noexcept
-  { return std::__addressof(this->_M_get()); }
+  {
+   __glibcxx_assert(this->_M_is_engaged());
+   return std::__addressof(this->_M_get());
+  }
 
   constexpr _Tp*
   operator->() noexcept
-  { return std::__addressof(this->_M_get()); }
+  {
+   __glibcxx_assert(this->_M_is_engaged());
+   return std::__addressof(this->_M_get());
+  }
 
   constexpr const _Tp&
   operator*() const& noexcept
-  { return this->_M_get(); }
+  {
+   __glibcxx_assert(this->_M_is_engaged());
+   return this->_M_get();
+  }
 
   constexpr _Tp&
   operator*()& noexcept
-  { return this->_M_get(); }
+  {
+   __glibcxx_assert(this->_M_is_engaged());
+   return this->_M_get();
+  }
 
   constexpr _Tp&&
   operator*()&& noexcept
-  { return std::move(this->_M_get()); }
+  {
+   __glibcxx_assert(this->_M_is_engaged());
+   return std::move(this->_M_get());
+  }
 
   constexpr const _Tp&&
   operator*() const&& noexcept
-  { return std::move(this->_M_get()); }
+  {
+   __glibcxx_assert(this->_M_is_engaged());
+   return std::move(this->_M_get());
+  }
 
   constexpr explicit operator bool() const noexcept
   { return this->_M_is_engaged(); }


[gcc/devel/fortran_unsigned] libstdc++: Use concepts to simplify std::optional base classes

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:a9273a2991a74421f4627145f520a1eaf37736c7

commit a9273a2991a74421f4627145f520a1eaf37736c7
Author: Jonathan Wakely 
Date:   Mon Jul 22 20:40:17 2024 +0100

libstdc++: Use concepts to simplify std::optional base classes

In C++20 mode we can simplify some of the std::optional base class
hierarchy using concepts. We can overload the destructor and copy
constructor and move constructor with a trivial defaulted version and a
constrained non-trivial version. This allows us to remove some class
template partial specializations that were used to conditionally define
those special members as trivial or non-trivial. This should not change
any semantics, but should be less work for the compiler, due to not
needing to match partial specializations, and completely removing one
level of the inheritance hierarchy.

libstdc++-v3/ChangeLog:

* include/std/optional (_Optional_payload_base::_Storage)
[C++20]: Define constrained non-trivial destructor.
(_Optional_payload_base::_Storage) [C++20]: Do not
define partial specialization when primary template has
constrained destructor.
(_Optional_base) [C++20]: Define constrained trivial copy and
move cons and move constructors. Define payload accessors here
instead of inheriting them from _Optional_base_impl.
(_Optional_base_impl, _Optional_base)
(_Optional_base, _Optional_base)
[C++20]: Do not define.

Diff:
---
 libstdc++-v3/include/std/optional | 166 +++---
 1 file changed, 121 insertions(+), 45 deletions(-)

diff --git a/libstdc++-v3/include/std/optional 
b/libstdc++-v3/include/std/optional
index 9ed7ab501402..344be5e44d3e 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -226,10 +226,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ }
 #endif
 
+#if __cpp_concepts >= 202002L // Conditionally trivial special member functions
+ ~_Storage() = default;
+
+ // User-provided destructor is needed when _Up has non-trivial dtor.
+ _GLIBCXX20_CONSTEXPR
+ ~_Storage() requires (!is_trivially_destructible_v<_Up>)
+ { }
+
+ _Storage(const _Storage&) = default;
+ _Storage(_Storage&&) = default;
+ _Storage& operator=(const _Storage&) = default;
+ _Storage& operator=(_Storage&&) = default;
+#endif
+
  _Empty_byte _M_empty;
  _Up _M_value;
};
 
+#if __cpp_concepts < 202002L
   template
union _Storage<_Up, false>
{
@@ -259,9 +274,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
  // User-provided destructor is needed when _Up has non-trivial dtor.
  _GLIBCXX20_CONSTEXPR ~_Storage() { }
 
+ _Storage(const _Storage&) = default;
+ _Storage(_Storage&&) = default;
+ _Storage& operator=(const _Storage&) = default;
+ _Storage& operator=(_Storage&&) = default;
+
  _Empty_byte _M_empty;
  _Up _M_value;
};
+#endif
 
   _Storage<_Stored_type> _M_payload;
 
@@ -438,47 +459,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   _GLIBCXX20_CONSTEXPR ~_Optional_payload() { this->_M_reset(); }
 };
 
-  // Common base class for _Optional_base to avoid repeating these
-  // member functions in each specialization.
-  template
-class _Optional_base_impl
-{
-protected:
-  using _Stored_type = remove_const_t<_Tp>;
-
-  // The _M_construct operation has !_M_engaged as a precondition
-  // while _M_destruct has _M_engaged as a precondition.
-  template
-   constexpr void
-   _M_construct(_Args&&... __args)
-   noexcept(is_nothrow_constructible_v<_Stored_type, _Args...>)
-   {
- static_cast<_Dp*>(this)->_M_payload._M_construct(
-   std::forward<_Args>(__args)...);
-   }
-
-  constexpr void
-  _M_destruct() noexcept
-  { static_cast<_Dp*>(this)->_M_payload._M_destroy(); }
-
-  // _M_reset is a 'safe' operation with no precondition.
-  constexpr void
-  _M_reset() noexcept
-  { static_cast<_Dp*>(this)->_M_payload._M_reset(); }
-
-  constexpr bool _M_is_engaged() const noexcept
-  { return static_cast(this)->_M_payload._M_engaged; }
-
-  // The _M_get operations have _M_engaged as a precondition.
-  constexpr _Tp&
-  _M_get() noexcept
-  { return static_cast<_Dp*>(this)->_M_payload._M_get(); }
-
-  constexpr const _Tp&
-  _M_get() const noexcept
-  { return static_cast(this)->_M_payload._M_get(); }
-};
-
   /**
 * @brief Class template that provides copy/move constructors of optional.
 *
@@ -501,7 +481,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   bool = is_trivially_copy_constructible_v<_Tp>,
   bool = is_trivially_move_constructible_v<_Tp>>
 struct _Optional_base
-: _Optional_base_impl<_Tp, _Optional_base<_Tp>

[gcc/devel/fortran_unsigned] libstdc++: Implement LWG 3836 for std::expected bool conversions

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:ab1a0e683d8a10bcd59aab38e44bbce57c35bb49

commit ab1a0e683d8a10bcd59aab38e44bbce57c35bb49
Author: Jonathan Wakely 
Date:   Wed Jul 24 18:08:03 2024 +0100

libstdc++: Implement LWG 3836 for std::expected bool conversions

libstdc++-v3/ChangeLog:

* include/std/expected (expected): Constrain constructors to
prevent problematic bool conversions, as per LWG 3836.
* testsuite/20_util/expected/lwg3836.cc: New test.

Diff:
---
 libstdc++-v3/include/std/expected  | 59 --
 libstdc++-v3/testsuite/20_util/expected/lwg3836.cc | 34 +
 2 files changed, 77 insertions(+), 16 deletions(-)

diff --git a/libstdc++-v3/include/std/expected 
b/libstdc++-v3/include/std/expected
index 86026c3947a1..2594cfe131c0 100644
--- a/libstdc++-v3/include/std/expected
+++ b/libstdc++-v3/include/std/expected
@@ -314,6 +314,17 @@ namespace __expected
  __guard.release();
}
 }
+
+  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+  // 3836. std::expected conversion constructor
+  // expected(const expected&) should take precedence over
+  // expected(U&&) with operator bool
+
+  // If T is cv bool, remove_cvref_t is not a specialization of expected.
+  template
+concept __not_constructing_bool_from_expected
+  = ! is_same_v, bool>
+ || ! __is_expected>;
 }
 /// @endcond
 
@@ -327,26 +338,41 @@ namespace __expected
   static_assert( ! __expected::__is_unexpected> );
   static_assert( __expected::__can_be_unexpected<_Er> );
 
-  template>
+  // If T is not cv bool, converts-from-any-cvref> and
+  // is_constructible, cv expected ref-qual> are false.
+  template,
+  typename = remove_cv_t<_Tp>>
static constexpr bool __cons_from_expected
- = __or_v&>,
-  is_constructible<_Tp, expected<_Up, _Err>>,
-  is_constructible<_Tp, const expected<_Up, _Err>&>,
-  is_constructible<_Tp, const expected<_Up, _Err>>,
-  is_convertible&, _Tp>,
-  is_convertible, _Tp>,
-  is_convertible&, _Tp>,
-  is_convertible, _Tp>,
-  is_constructible<_Unex, expected<_Up, _Err>&>,
-  is_constructible<_Unex, expected<_Up, _Err>>,
-  is_constructible<_Unex, const expected<_Up, _Err>&>,
-  is_constructible<_Unex, const expected<_Up, _Err>>
+ = __or_v&>,
+  is_constructible<_Tp, expected<_Up, _Gr>>,
+  is_constructible<_Tp, const expected<_Up, _Gr>&>,
+  is_constructible<_Tp, const expected<_Up, _Gr>>,
+  is_convertible&, _Tp>,
+  is_convertible, _Tp>,
+  is_convertible&, _Tp>,
+  is_convertible, _Tp>,
+  is_constructible<_Unex, expected<_Up, _Gr>&>,
+  is_constructible<_Unex, expected<_Up, _Gr>>,
+  is_constructible<_Unex, const expected<_Up, _Gr>&>,
+  is_constructible<_Unex, const expected<_Up, _Gr>>
  >;
 
-  template
+  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+  // If t is cv bool, we know it can be constructed from expected,
+  // but we don't want to cause the expected(U&&) constructor to be used,
+  // so we only check the is_constructible, ...> cases.
+  template
+   static constexpr bool __cons_from_expected<_Up, _Gr, _Unex, bool>
+ = __or_v&>,
+  is_constructible<_Unex, expected<_Up, _Gr>>,
+  is_constructible<_Unex, const expected<_Up, _Gr>&>,
+  is_constructible<_Unex, const expected<_Up, _Gr>>
+ >;
+
+  template
constexpr static bool __explicit_conv
  = __or_v<__not_>,
-  __not_>
+  __not_>
  >;
 
   template
@@ -445,8 +471,9 @@ namespace __expected
   template
requires (!is_same_v, expected>)
  && (!is_same_v, in_place_t>)
- && (!__expected::__is_unexpected>)
  && is_constructible_v<_Tp, _Up>
+ && (!__expected::__is_unexpected>)
+ && __expected::__not_constructing_bool_from_expected<_Tp, _Up>
constexpr explicit(!is_convertible_v<_Up, _Tp>)
expected(_Up&& __v)
noexcept(is_nothrow_constructible_v<_Tp, _Up>)
diff --git a/libstdc++-v3/testsuite/20_util/expected/lwg3836.cc 
b/libstdc++-v3/testsuite/20_util/expected/lwg3836.cc
new file mode 100644
index ..cd029c449632
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/expected/lwg3836.cc
@@ -0,0 +1,34 @@
+// { dg-do run { target c++23 } }
+
+#include 
+#include 
+
+constexpr void
+test_convert_contained_value_to_bool()
+{
+  struct BaseError { };
+  struct DerivedError : BaseError { };
+
+  std::expected e = false;
+
+  // Should use expected(const expected&) ctor, not expected(U&&):
+  std::expected e2 = e;
+
+  //

[gcc/devel/fortran_unsigned] libstdc++: Implement LWG 3836 for std::optional bool conversions

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:0e3c6a936568c859e4653854f0cd4206f390d56e

commit 0e3c6a936568c859e4653854f0cd4206f390d56e
Author: Jonathan Wakely 
Date:   Tue Jul 23 12:45:37 2024 +0100

libstdc++: Implement LWG 3836 for std::optional bool conversions

libstdc++-v3/ChangeLog:

* include/std/optional (optional): Constrain constructors to
prevent problematic bool conversions, as per LWG 3836.
* testsuite/20_util/optional/cons/lwg3836.cc: New test.

Diff:
---
 libstdc++-v3/include/std/optional  | 58 --
 .../testsuite/20_util/optional/cons/lwg3836.cc | 58 ++
 2 files changed, 100 insertions(+), 16 deletions(-)

diff --git a/libstdc++-v3/include/std/optional 
b/libstdc++-v3/include/std/optional
index 344be5e44d3e..700e7047abae 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -749,16 +749,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template
 inline constexpr bool __is_optional_v> = true;
 
+  template
+using __converts_from_any_cvref = __or_<
+   is_constructible<_Tp, _Wp&>,   is_convertible<_Wp&, _Tp>,
+   is_constructible<_Tp, _Wp>,is_convertible<_Wp, _Tp>,
+   is_constructible<_Tp, const _Wp&>, is_convertible,
+   is_constructible<_Tp, const _Wp>,  is_convertible
+  >;
+
   template
-using __converts_from_optional =
-  __or_&>,
-   is_constructible<_Tp, optional<_Up>&>,
-   is_constructible<_Tp, const optional<_Up>&&>,
-   is_constructible<_Tp, optional<_Up>&&>,
-   is_convertible&, _Tp>,
-   is_convertible&, _Tp>,
-   is_convertible&&, _Tp>,
-   is_convertible&&, _Tp>>;
+using __converts_from_optional
+  = __converts_from_any_cvref<_Tp, optional<_Up>>;
 
   template
 using __assigns_from_optional =
@@ -800,6 +801,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template
using _Requires = enable_if_t<__and_v<_Cond...>, bool>;
 
+  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+  // 3836. std::expected conversion constructor
+  // expected(const expected&) should take precedence over
+  // expected(U&&) with operator bool
+  template>
+   struct __not_constructing_bool_from_optional
+   : true_type
+   { };
+
+  template
+   struct __not_constructing_bool_from_optional<_From, bool>
+   : bool_constant>>
+   { };
+
+  template>
+   struct __construct_from_contained_value
+   : __not_<__converts_from_optional<_Tp, _From>>
+   { };
+
+  template
+   struct __construct_from_contained_value<_From, bool>
+   : true_type
+   { };
+
 public:
   using value_type = _Tp;
 
@@ -811,7 +836,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template, __not_tag<_Up>,
 is_constructible<_Tp, _Up>,
-is_convertible<_Up, _Tp>> = true>
+is_convertible<_Up, _Tp>,
+__not_constructing_bool_from_optional<_Up>> = true>
constexpr
optional(_Up&& __t)
noexcept(is_nothrow_constructible_v<_Tp, _Up>)
@@ -820,7 +846,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template, __not_tag<_Up>,
 is_constructible<_Tp, _Up>,
-__not_>> = false>
+__not_>,
+__not_constructing_bool_from_optional<_Up>> = false>
explicit constexpr
optional(_Up&& __t)
noexcept(is_nothrow_constructible_v<_Tp, _Up>)
@@ -830,7 +857,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   _Requires<__not_>,
 is_constructible<_Tp, const _Up&>,
 is_convertible,
-__not_<__converts_from_optional<_Tp, _Up>>> = true>
+__construct_from_contained_value<_Up>> = true>
constexpr
optional(const optional<_Up>& __t)
noexcept(is_nothrow_constructible_v<_Tp, const _Up&>)
@@ -843,7 +870,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   _Requires<__not_>,
 is_constructible<_Tp, const _Up&>,
 __not_>,
-__not_<__converts_from_optional<_Tp, _Up>>> = false>
+__construct_from_contained_value<_Up>> = false>
explicit constexpr
optional(const optional<_Up>& __t)
noexcept(is_nothrow_constructible_v<_Tp, const _Up&>)
@@ -856,7 +883,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   _Requires<__not_>,
 is_constructible<_Tp, _Up>,
 is_convertible<_Up, _Tp>,
-__not_<__converts_from_optional<_Tp, _Up>>> = true>
+__construct_from_contained_value<_Up>> = true>
constexpr
optional(optional<_Up>&& __t)
noexcept(is_nothrow_constructible_v<_Tp, _Up>)
@@ -869,7 +896,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   

[gcc/devel/fortran_unsigned] libstdc++: Add noexcept to bad_expected_access members (LWG 4031)

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:b42f73132c51aece4bed43cdceb4b8cf31197a2b

commit b42f73132c51aece4bed43cdceb4b8cf31197a2b
Author: Jonathan Wakely 
Date:   Wed Jun 26 14:15:29 2024 +0100

libstdc++: Add noexcept to bad_expected_access members (LWG 4031)

libstdc++-v3/ChangeLog:

* include/std/expected (bad_expected_access): Add noexcept
to special member functions, as per LWG 4031.
* testsuite/20_util/expected/bad.cc: Check for nothrow copy and
move members.

Diff:
---
 libstdc++-v3/include/std/expected  |  8 
 libstdc++-v3/testsuite/20_util/expected/bad.cc | 13 +
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/include/std/expected 
b/libstdc++-v3/include/std/expected
index 2594cfe131c0..3c52f7db01e2 100644
--- a/libstdc++-v3/include/std/expected
+++ b/libstdc++-v3/include/std/expected
@@ -79,10 +79,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 {
 protected:
   bad_expected_access() noexcept { }
-  bad_expected_access(const bad_expected_access&) = default;
-  bad_expected_access(bad_expected_access&&) = default;
-  bad_expected_access& operator=(const bad_expected_access&) = default;
-  bad_expected_access& operator=(bad_expected_access&&) = default;
+  bad_expected_access(const bad_expected_access&) noexcept = default;
+  bad_expected_access(bad_expected_access&&) noexcept = default;
+  bad_expected_access& operator=(const bad_expected_access&) noexcept = 
default;
+  bad_expected_access& operator=(bad_expected_access&&) noexcept = default;
   ~bad_expected_access() = default;
 
 public:
diff --git a/libstdc++-v3/testsuite/20_util/expected/bad.cc 
b/libstdc++-v3/testsuite/20_util/expected/bad.cc
index c629e149da5c..7e227f904a02 100644
--- a/libstdc++-v3/testsuite/20_util/expected/bad.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/bad.cc
@@ -12,3 +12,16 @@ test_pr105146()
 {
   std::bad_expected_access(E{});
 }
+
+void
+test_lwg4031()
+{
+  struct test_type : std::bad_expected_access { };
+
+  static_assert( std::is_nothrow_default_constructible_v );
+  // LWG 4031. bad_expected_access member functions should be noexcept
+  static_assert( std::is_nothrow_copy_constructible_v );
+  static_assert( std::is_nothrow_move_constructible_v );
+  static_assert( std::is_nothrow_copy_assignable_v );
+  static_assert( std::is_nothrow_move_assignable_v );
+}


[gcc/devel/fortran_unsigned] libstdc++: Remove std::basic_format_args default constructor (LWG 4106)

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:436ef665d89e3fc5cc6562dc52e8178cb1034846

commit 436ef665d89e3fc5cc6562dc52e8178cb1034846
Author: Jonathan Wakely 
Date:   Thu Jul 25 13:52:12 2024 +0100

libstdc++: Remove std::basic_format_args default constructor (LWG 4106)

There's no valid use case for default constructing this type, so the
committee approved removing the default constructor.

libstdc++-v3/ChangeLog:

* include/std/format (basic_format_args): Remove default
constructor, as per LWG 4106.
* testsuite/std/format/arguments/args.cc: Check it isn't default
constructible.

Diff:
---
 libstdc++-v3/include/std/format | 2 --
 libstdc++-v3/testsuite/std/format/arguments/args.cc | 4 
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 16cee0d3c74d..8f6a82a1fd41 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -3667,8 +3667,6 @@ namespace __format
{ return {_Format_arg::template _S_to_enum<_Args>()...}; }
 
 public:
-  basic_format_args() noexcept = default;
-
   template
basic_format_args(const _Store<_Args...>& __store) noexcept;
 
diff --git a/libstdc++-v3/testsuite/std/format/arguments/args.cc 
b/libstdc++-v3/testsuite/std/format/arguments/args.cc
index eba129ff8944..16ca71caecbe 100644
--- a/libstdc++-v3/testsuite/std/format/arguments/args.cc
+++ b/libstdc++-v3/testsuite/std/format/arguments/args.cc
@@ -3,6 +3,10 @@
 #include 
 #include 
 
+// LWG 4106. basic_format_args should not be default-constructible
+static_assert( ! std::is_default_constructible_v );
+static_assert( ! std::is_default_constructible_v );
+
 template
 bool equals(std::basic_format_arg fmt_arg, T expected) {
   return std::visit_format_arg([=](auto arg_val) {


[gcc/devel/fortran_unsigned] libstdc++: Add static_assert to std::expected for LWG 3843 and 3940

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:4c58169086fd844cc725d3b56077dd2b2eb962d6

commit 4c58169086fd844cc725d3b56077dd2b2eb962d6
Author: Jonathan Wakely 
Date:   Thu Jul 25 14:17:34 2024 +0100

libstdc++: Add static_assert to std::expected for LWG 3843 and 3940

libstdc++-v3/ChangeLog:

* include/std/expected (expected::value): Add assertions for LWG
3843 requirements.
(expected::value): Add assertions for LWG 3940
requirements.

Diff:
---
 libstdc++-v3/include/std/expected | 8 
 1 file changed, 8 insertions(+)

diff --git a/libstdc++-v3/include/std/expected 
b/libstdc++-v3/include/std/expected
index 3c52f7db01e2..515a1e6ab8f5 100644
--- a/libstdc++-v3/include/std/expected
+++ b/libstdc++-v3/include/std/expected
@@ -754,6 +754,7 @@ namespace __expected
   constexpr const _Tp&
   value() const &
   {
+   static_assert( is_copy_constructible_v<_Er> );
if (_M_has_value) [[likely]]
  return _M_val;
_GLIBCXX_THROW_OR_ABORT(bad_expected_access<_Er>(_M_unex));
@@ -762,6 +763,7 @@ namespace __expected
   constexpr _Tp&
   value() &
   {
+   static_assert( is_copy_constructible_v<_Er> );
if (_M_has_value) [[likely]]
  return _M_val;
const auto& __unex = _M_unex;
@@ -771,6 +773,8 @@ namespace __expected
   constexpr const _Tp&&
   value() const &&
   {
+   static_assert( is_copy_constructible_v<_Er> );
+   static_assert( is_constructible_v<_Er, const _Er&&> );
if (_M_has_value) [[likely]]
  return std::move(_M_val);
_GLIBCXX_THROW_OR_ABORT(bad_expected_access<_Er>(std::move(_M_unex)));
@@ -779,6 +783,8 @@ namespace __expected
   constexpr _Tp&&
   value() &&
   {
+   static_assert( is_copy_constructible_v<_Er> );
+   static_assert( is_constructible_v<_Er, _Er&&> );
if (_M_has_value) [[likely]]
  return std::move(_M_val);
_GLIBCXX_THROW_OR_ABORT(bad_expected_access<_Er>(std::move(_M_unex)));
@@ -1510,6 +1516,7 @@ namespace __expected
   constexpr void
   value() const&
   {
+   static_assert( is_copy_constructible_v<_Er> );
if (_M_has_value) [[likely]]
  return;
_GLIBCXX_THROW_OR_ABORT(bad_expected_access<_Er>(_M_unex));
@@ -1518,6 +1525,7 @@ namespace __expected
   constexpr void
   value() &&
   {
+   static_assert( is_copy_constructible_v<_Er> );
if (_M_has_value) [[likely]]
  return;
_GLIBCXX_THROW_OR_ABORT(bad_expected_access<_Er>(std::move(_M_unex)));


[gcc/devel/fortran_unsigned] Daily bump.

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:141ad69ba60f4c22382b66240a1c6c2104102846

commit 141ad69ba60f4c22382b66240a1c6c2104102846
Author: GCC Administrator 
Date:   Fri Jul 26 00:17:23 2024 +

Daily bump.

Diff:
---
 gcc/ChangeLog   | 139 
 gcc/DATESTAMP   |   2 +-
 gcc/cp/ChangeLog|  56 +++
 gcc/testsuite/ChangeLog | 121 +
 libcpp/ChangeLog|   7 +++
 libgfortran/ChangeLog   |   7 +++
 libstdc++-v3/ChangeLog  | 100 ++
 7 files changed, 431 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0ee5f8b67cb5..30312ec1299d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,142 @@
+2024-07-25  Carl Love  
+
+   * config/rs6000/rs6000-builtin.cc (get_element_number,
+   altivec_expand_vec_set_builtin): Remove functions.
+   (rs6000_expand_builtin): Remove the if statement to call
+   altivec_expand_vec_set_builtin.
+   * config/rs6000/rs6000-builtins.def (__builtin_vsx_set_1ti,
+   __builtin_vsx_set_2df, __builtin_vsx_set_2di): Remove the
+   built-in definitions.
+   * config/rs6000/rs6000-gen-builtins.cc (struct attrinfo):
+   Remove the isset variable from the structure.
+   (parse_bif_attrs): Remove the uses of the isset variable.
+
+2024-07-25  Carl Love  
+
+   * config/rs6000/rs6000-builtins.def (__builtin_vec_set_v1ti,
+   __builtin_vec_set_v2df, __builtin_vec_set_v2di): Remove built-in
+   definitions.
+   * config/rs6000/rs6000-c.cc (resolve_vec_insert): Remove the
+   handling for constant vec_insert position with
+   VECTOR_UNIT_VSX_P V1TImode, V2DFmode and V2DImode modes.
+
+2024-07-25  Carl Love  
+
+   * config/rs6000/rs6000-builtins.def (__builtin_vsx_xvcmpeqsp,
+   __builtin_vsx_xvcmpgesp, __builtin_vsx_xvcmpgtsp): Remove
+   definitions.
+
+2024-07-25  Jeff Law  
+
+   PR rtl-optimization/116039
+   * ext-dce.cc (ext_dce_process_uses): Add some comments about concerns
+   with current code.  Mark additional bit groups as live when we have
+   an extension of a suitably promoted subreg.
+
+2024-07-25  Christoph Müllner  
+
+   PR target/116033
+   * config/riscv/thead.cc (th_memidx_classify_address_modify):
+   Fix mode test.
+
+2024-07-25  Richard Biener  
+
+   PR tree-optimization/116083
+   * tree-vect-slp.cc (vect_build_slp_tree): Do not allocate
+   a discovery fail node when we reached the discovery limit.
+   (vect_build_slp_instance): Terminate early when the
+   discovery limit is reached.
+
+2024-07-25  Richard Sandiford  
+
+   * doc/rtl.texi: Document the need to define INCLUDE_ARRAY before
+   including rtl-ssa.h.
+   * rtl-ssa.h: Likewise (in comment).
+   * config/aarch64/aarch64-cc-fusion.cc: Add INCLUDE_ARRAY.
+   * config/aarch64/aarch64-early-ra.cc: Likewise.
+   * config/riscv/riscv-avlprop.cc: Likewise.
+   * config/riscv/riscv-vsetvl.cc: Likewise.
+   * fwprop.cc: Likewise.
+   * late-combine.cc: Likewise.
+   * pair-fusion.cc: Likewise.
+   * rtl-ssa/accesses.cc: Likewise.
+   * rtl-ssa/blocks.cc: Likewise.
+   * rtl-ssa/changes.cc: Likewise.
+   * rtl-ssa/functions.cc: Likewise.
+   * rtl-ssa/insns.cc: Likewise.
+   * rtl-ssa/movement.cc: Likewise.
+
+2024-07-25  Sam James  
+
+   PR middle-end/114855
+   * doc/invoke.texi (Optimize options): Mention machine-generated
+   code for -O1.
+
+2024-07-25  Richard Biener  
+
+   PR tree-optimization/116081
+   * tree-vect-loop.cc (get_initial_defs_for_reduction):
+   Use operand_equal_p for comparing the element with the
+   neutral op.
+
+2024-07-25  Richard Biener  
+
+   PR tree-optimization/116079
+   * tree-ssa-loop-im.cc (hoist_memory_references): Clear
+   VDEF of elided clobbers.
+
+2024-07-25  Richard Biener  
+
+   PR tree-optimization/116081
+   * tree-vect-stmts.cc (vect_get_vector_types_for_stmt):
+   Properly compare types.
+
+2024-07-25  Robin Dapp  
+
+   PR target/116036
+   * config/riscv/riscv.cc (riscv_override_options_internal): Error
+   with TARGET_VECTOR && !TARGET_MUL.
+
+2024-07-25  Juzhe-Zhong  
+
+   * config/riscv/riscv.cc (riscv_legitimize_move): Fix poly_int dest 
generation.
+
+2024-07-25  Richard Sandiford  
+
+   PR rtl-optimization/116044
+   * rtl-ssa/functions.h (function_info::split_clobber_group): Return
+   an array of two clobber_groups.
+   * rtl-ssa/accesses.cc (function_info::split_clobber_group): Return
+   the new clobber groups.  Don't modify the splay tree here.
+   (function_info::add_def): Update call accordingly.  Generalize
+   the splay tree insertion code so that the new definition can be
+   inserted as a child of any existing node, not just the root.
+   Fix the insertion used after calling split_cl

[gcc/devel/fortran_unsigned] libstdc++: Reorder template params of std::optional comparisons (LWG 2945)

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:8fbee909fd8516a18e3677e837bda190ed9dccf7

commit 8fbee909fd8516a18e3677e837bda190ed9dccf7
Author: Jonathan Wakely 
Date:   Tue Jul 23 17:14:03 2024 +0100

libstdc++: Reorder template params of std::optional comparisons (LWG 2945)

libstdc++-v3/ChangeLog:

* include/std/optional: Reorder parameters in comparison
operators as per LWG 2945.

Diff:
---
 libstdc++-v3/include/std/optional | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/libstdc++-v3/include/std/optional 
b/libstdc++-v3/include/std/optional
index 2cc0221865e3..4694d594f98a 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -1601,10 +1601,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 { return __lhs && *__lhs == __rhs; }
 
   template
-_REQUIRES_NOT_OPTIONAL(_Up)
+_REQUIRES_NOT_OPTIONAL(_Tp)
 constexpr auto
-operator==(const _Up& __lhs, const optional<_Tp>& __rhs)
--> __optional_eq_t<_Up, _Tp>
+operator== [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs)
+-> __optional_eq_t<_Tp, _Up>
 { return __rhs && __lhs == *__rhs; }
 
   template
@@ -1615,10 +1615,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 { return !__lhs || *__lhs != __rhs; }
 
   template
-_REQUIRES_NOT_OPTIONAL(_Up)
+_REQUIRES_NOT_OPTIONAL(_Tp)
 constexpr auto
-operator!= [[nodiscard]] (const _Up& __lhs, const optional<_Tp>& __rhs)
--> __optional_ne_t<_Up, _Tp>
+operator!= [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs)
+-> __optional_ne_t<_Tp, _Up>
 { return !__rhs || __lhs != *__rhs; }
 
   template
@@ -1629,10 +1629,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 { return !__lhs || *__lhs < __rhs; }
 
   template
-_REQUIRES_NOT_OPTIONAL(_Up)
+_REQUIRES_NOT_OPTIONAL(_Tp)
 constexpr auto
-operator< [[nodiscard]] (const _Up& __lhs, const optional<_Tp>& __rhs)
--> __optional_lt_t<_Up, _Tp>
+operator< [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs)
+-> __optional_lt_t<_Tp, _Up>
 { return __rhs && __lhs < *__rhs; }
 
   template
@@ -1643,10 +1643,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 { return __lhs && *__lhs > __rhs; }
 
   template
-_REQUIRES_NOT_OPTIONAL(_Up)
+_REQUIRES_NOT_OPTIONAL(_Tp)
 constexpr auto
-operator> [[nodiscard]] (const _Up& __lhs, const optional<_Tp>& __rhs)
--> __optional_gt_t<_Up, _Tp>
+operator> [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs)
+-> __optional_gt_t<_Tp, _Up>
 { return !__rhs || __lhs > *__rhs; }
 
   template
@@ -1657,10 +1657,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 { return !__lhs || *__lhs <= __rhs; }
 
   template
-_REQUIRES_NOT_OPTIONAL(_Up)
+_REQUIRES_NOT_OPTIONAL(_Tp)
 constexpr auto
-operator<= [[nodiscard]] (const _Up& __lhs, const optional<_Tp>& __rhs)
--> __optional_le_t<_Up, _Tp>
+operator<= [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs)
+-> __optional_le_t<_Tp, _Up>
 { return __rhs && __lhs <= *__rhs; }
 
   template
@@ -1671,10 +1671,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 { return __lhs && *__lhs >= __rhs; }
 
   template
-_REQUIRES_NOT_OPTIONAL(_Up)
+_REQUIRES_NOT_OPTIONAL(_Tp)
 constexpr auto
-operator>= [[nodiscard]] (const _Up& __lhs, const optional<_Tp>& __rhs)
--> __optional_ge_t<_Up, _Tp>
+operator>= [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs)
+-> __optional_ge_t<_Tp, _Up>
 { return !__rhs || __lhs >= *__rhs; }
 
 #ifdef __cpp_lib_three_way_comparison


[gcc/devel/fortran_unsigned] libstdc++: Remove __find_if unrolling for random access iterators

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:7ad3d3303bbc2c3fd78f91dee96b1c023f9a2744

commit 7ad3d3303bbc2c3fd78f91dee96b1c023f9a2744
Author: Jonathan Wakely 
Date:   Thu Jul 4 12:01:29 2024 +0100

libstdc++: Remove __find_if unrolling for random access iterators

As the numbers in PR libstdc++/88545 show, the manual loop unrolling in
std::__find_if doesn't actually help these days, and it prevents the
compiler from auto-vectorizing.

Remove the dispatching on iterator_category and just use the simple loop
for all iterator categories.

libstdc++-v3/ChangeLog:

* include/bits/stl_algobase.h (__find_if): Remove overloads for
dispatching on iterator_category. Do not unroll loop manually.
* include/bits/stl_algo.h (__find_if_not): Remove
iterator_category argument from __find_if call.

Diff:
---
 libstdc++-v3/include/bits/stl_algo.h |  3 +-
 libstdc++-v3/include/bits/stl_algobase.h | 70 ++--
 2 files changed, 5 insertions(+), 68 deletions(-)

diff --git a/libstdc++-v3/include/bits/stl_algo.h 
b/libstdc++-v3/include/bits/stl_algo.h
index d250b2e04d4d..541f53b2 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -110,8 +110,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
  _Predicate __pred)
 {
   return std::__find_if(__first, __last,
-   __gnu_cxx::__ops::__negate(__pred),
-   std::__iterator_category(__first));
+   __gnu_cxx::__ops::__negate(__pred));
 }
 
   /// Like find_if_not(), but uses and updates a count of the
diff --git a/libstdc++-v3/include/bits/stl_algobase.h 
b/libstdc++-v3/include/bits/stl_algobase.h
index dec1e4c79d86..27f6c377ad6f 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -2098,77 +2098,15 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 
 _GLIBCXX_END_NAMESPACE_ALGO
 
-  /// This is an overload used by find algos for the Input Iterator case.
-  template
-_GLIBCXX20_CONSTEXPR
-inline _InputIterator
-__find_if(_InputIterator __first, _InputIterator __last,
- _Predicate __pred, input_iterator_tag)
-{
-  while (__first != __last && !__pred(__first))
-   ++__first;
-  return __first;
-}
-
-  /// This is an overload used by find algos for the RAI case.
-  template
-_GLIBCXX20_CONSTEXPR
-_RandomAccessIterator
-__find_if(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Predicate __pred, random_access_iterator_tag)
-{
-  typename iterator_traits<_RandomAccessIterator>::difference_type
-   __trip_count = (__last - __first) >> 2;
-
-  for (; __trip_count > 0; --__trip_count)
-   {
- if (__pred(__first))
-   return __first;
- ++__first;
-
- if (__pred(__first))
-   return __first;
- ++__first;
-
- if (__pred(__first))
-   return __first;
- ++__first;
-
- if (__pred(__first))
-   return __first;
- ++__first;
-   }
-
-  switch (__last - __first)
-   {
-   case 3:
- if (__pred(__first))
-   return __first;
- ++__first;
- // FALLTHRU
-   case 2:
- if (__pred(__first))
-   return __first;
- ++__first;
- // FALLTHRU
-   case 1:
- if (__pred(__first))
-   return __first;
- ++__first;
- // FALLTHRU
-   case 0:
-   default:
- return __last;
-   }
-}
-
+  // Implementation of std::find_if, also used in std::remove_if and others.
   template
 _GLIBCXX20_CONSTEXPR
 inline _Iterator
 __find_if(_Iterator __first, _Iterator __last, _Predicate __pred)
 {
-  return __find_if(__first, __last, __pred,
-  std::__iterator_category(__first));
+  while (__first != __last && !__pred(__first))
+   ++__first;
+  return __first;
 }
 
   template


[gcc/devel/fortran_unsigned] libstdc++: Add comment noting LWG 3617 support

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:b200461e0f3bf6450ec1cf17b4036ff2033607dc

commit b200461e0f3bf6450ec1cf17b4036ff2033607dc
Author: Jonathan Wakely 
Date:   Thu Jul 25 18:38:46 2024 +0100

libstdc++: Add comment noting LWG 3617 support

The resolution was implemented in r14-8752-g6f75149488b74a but I didn't
add the usual _GLIBCXX_RESOLVE_LIB_DEFECTS comment.

libstdc++-v3/ChangeLog:

* include/bits/std_function.h: Add comment about LWG 3617 being
supported.

Diff:
---
 libstdc++-v3/include/bits/std_function.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libstdc++-v3/include/bits/std_function.h 
b/libstdc++-v3/include/bits/std_function.h
index 79b59466fe9d..bb8d8b9306cd 100644
--- a/libstdc++-v3/include/bits/std_function.h
+++ b/libstdc++-v3/include/bits/std_function.h
@@ -698,6 +698,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 { using type = _Res(_Args...); };
 
 #if __cpp_explicit_this_parameter >= 202110L
+  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+  // 3617. function/packaged_task deduction guides and deducing this
   template
 struct __function_guide_helper<_Res (*) (_Tp, _Args...) noexcept(_Nx)>
 { using type = _Res(_Args...); };


[gcc/devel/fortran_unsigned] Daily bump.

2024-07-28 Thread Thomas Kテカnig via Libstdc++-cvs
https://gcc.gnu.org/g:614454f5b640aa7252564b37b523bd5be8caad3e

commit 614454f5b640aa7252564b37b523bd5be8caad3e
Author: GCC Administrator 
Date:   Sun Jul 28 00:16:41 2024 +

Daily bump.

Diff:
---
 gcc/ChangeLog   | 94 +
 gcc/DATESTAMP   |  2 +-
 gcc/cp/ChangeLog| 11 ++
 gcc/testsuite/ChangeLog | 40 +
 libstdc++-v3/ChangeLog  | 20 +++
 5 files changed, 166 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bdcb3877fcd4..949ffa76d4ed 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,97 @@
+2024-07-27  Roger Sayle  
+   Andrew Pinski  
+
+   * match.pd (ctz (-X) => ctz (X)): New simplification.
+   (ctz (abs (X)) => ctz (X)): Likewise.
+
+2024-07-27  Pan Li  
+
+   * match.pd: Add case 9 and case 10 for .SAT_SUB when one
+   of the op is IMM.
+
+2024-07-27  David Malcolm  
+
+   PR middle-end/107941
+   * diagnostic-format-sarif.cc: Define INCLUDE_LIST and INCLUDE_MAP.
+   (enum class location_relationship_kind): New.
+   (diagnostic_artifact_role::scanned_file): New value.
+   (class sarif_location_manager): New.
+   (class sarif_result): Derive from sarif_location_manager rather
+   than directly from sarif_object.
+   (sarif_result::add_related_location): Convert to vfunc
+   implementation.
+   (sarif_location::m_relationships_map): New field.
+   (class sarif_location_relationship): New.
+   (class sarif_ice_notification): Derive from sarif_location_manager
+   rather than directly from sarif_object.
+   (sarif_builder::take_current_result): New.
+   (sarif_builder::m_line_maps): New field.
+   (sarif_builder::m_cur_group_result): Convert to std::unique_ptr.
+   (sarif_artifact::add_role): Skip scanned_file.
+   (get_artifact_role_string): Handle scanned_file.
+   (sarif_location_manager::add_relationship_to_worklist): New.
+   (sarif_location_manager::process_worklist): New.
+   (sarif_location_manager::process_worklist_item): New.
+   (sarif_result::on_nested_diagnostic): Pass *this to
+   make_location_object.
+   (sarif_location::lazily_add_id): New.
+   (sarif_location::get_id): New.
+   (get_string_for_location_relationship_kind): New.
+   (sarif_location::lazily_add_relationship): New.
+   (sarif_location::lazily_add_relationship_object): New.
+   (sarif_location::lazily_add_relationships_array): New.
+   (sarif_ice_notification::sarif_ice_notification): Fix overlong line.
+   Pass *this to make_locations_arr.
+   (sarif_ice_notification::add_related_location): New.
+   (sarif_location_relationship::sarif_location_relationship): New.
+   (sarif_location_relationship::get_target_id): New.
+   (sarif_location_relationship::lazily_add_kind): New.
+   (sarif_builder::sarif_builder): Add "line_maps" param and use it
+   to initialize m_line_maps.
+   (sarif_builder::end_diagnostic): Update for m_cur_group_result
+   becoming a std::unique_ptr.  Don't append to m_results_array yet.
+   (sarif_builder::end_group): Append m_cur_group_result to
+   m_results_array here, rather than in end_diagnostic.
+   (sarif_builder::make_result_object): Pass result_obj to
+   make_locations_arr and to make_code_flow_object.
+   (sarif_builder::make_locations_arr): Add "loc_mgr" param and pass
+   it to make_location_object.
+   (sarif_builder::make_location_object): For two overloads, add
+   "loc_mgr" param and call add_any_include_chain on the location.
+   (sarif_builder::add_any_include_chain): New.
+   (sarif_builder::make_location_object): New overload.
+   (sarif_builder::make_code_flow_object): Add "result" param and
+   pass it to make_thread_flow_location_object.
+   (sarif_builder::make_thread_flow_location_object): Add "result"
+   param and pass it to make_location_object.
+   (sarif_builder::get_or_create_artifact): Handle scanned_file.
+   (sarif_output_format::~sarif_output_format): Assert that there
+   isn't a pending result.
+   (sarif_output_format::sarif_output_format): Add "line_maps" param
+   and pass it to m_builder's ctor.
+   (sarif_stream_output_format::sarif_stream_output_format): Add
+   "line_maps" param and pass it to base class ctor.
+   (sarif_file_output_format::sarif_file_output_format): Likewise.
+   (diagnostic_output_format_init_sarif_stderr): Pass "line_table"
+   global to format.
+   (diagnostic_output_format_init_sarif_file): Likewise.
+   (diagnostic_output_format_init_sarif_stream): Likewise.
+   (test_sarif_diagnostic_context::test_sarif_diagnostic_context):
+   Likewise.
+   (buffered_output_format::buffered_output_format): Likewise.
+   (selftest::test_make_location_object): Likewise.
+   (selftest::test_make_location_object):