commit 500b22d867605421113f593ef85a79ec394006ba
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jun 5 18:50:16 2025 +0200

    Bump BASE-VER.
    
    2025-06-05  Jakub Jelinek  <jakub@redhat.com>
    
            * BASE-VER: Set to 13.4.1.

diff --git a/gcc/BASE-VER b/gcc/BASE-VER
index 74302c5119c..c27905ac3dc 100644
--- a/gcc/BASE-VER
+++ b/gcc/BASE-VER
@@ -1 +1 @@
-13.4.0
+13.4.1

commit 195c76fb53c7c751c25b864bef255c7ee1195f07
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Jun 5 13:20:26 2025 +0200

    Fix crash with constant initializer caused by IPA
    
    The testcase compiled with -O2 -gnatn makes the compiler crash in
    vect_can_force_dr_alignment_p during SLP vectorization:
    
      if (decl_in_symtab_p (decl)
          && !symtab_node::get (decl)->can_increase_alignment_p ())
        return false;
    
    because symtab_node::get (decl) returns a null node.  The phenomenon occurs
    for a pair of twin symbols listed like so in .cgraph:
    
    Opt7_Pkg.T12b/17 (Opt7_Pkg.T12b)
      Type: variable definition analyzed
      Visibility: semantic_interposition external public artificial
      Aux: @0x44d45e0
      References:
      Referring: opt7_pkg__enum_name_table/13 (addr) opt7_pkg__enum_name_table/13
    (addr)
      Availability: not-ready
      Varpool flags: initialized read-only const-value-known
    
    Opt7_Pkg.T8b/16 (Opt7_Pkg.T8b)
      Type: variable definition analyzed
      Visibility: semantic_interposition external public artificial
      Aux: @0x7f9fda3fff00
      References:
      Referring: opt7_pkg__enum_name_table/13 (addr) opt7_pkg__enum_name_table/13
    (addr)
      Availability: not-ready
      Varpool flags: initialized read-only const-value-known
    
    with:
    
    opt7_pkg__enum_name_table/13 (Opt7_Pkg.Enum_Name_Table)
      Type: variable definition analyzed
      Visibility: semantic_interposition external public
      Aux: @0x44d45e0
      References: Opt7_Pkg.T8b/16 (addr) Opt7_Pkg.T8b/16 (addr) Opt7_Pkg.T12b/17
    (addr) Opt7_Pkg.T12b/17 (addr)
      Referring: opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
    opt7_pkg__image/2 (read) opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
    opt7_pkg__image/2 (read) opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
      Availability: not-ready
      Varpool flags: initialized read-only const-value-known
    
    being the crux of the matter.
    
    What happens is that symtab_remove_unreachable_nodes leaves the last symbol
    in kind of a limbo state: in .remove_symbols, we have:
    
    opt7_pkg__enum_name_table/13 (Opt7_Pkg.Enum_Name_Table)
      Type: variable
      Body removed by symtab_remove_unreachable_nodes
      Visibility: externally_visible semantic_interposition external public
      References:
      Referring: opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
      Availability: not_available
      Varpool flags: initialized read-only const-value-known
    
    This means that the "body" (DECL_INITIAL) of the symbol has been disregarded
    during reachability analysis, causing the first two symbols to be discarded:
    
    Reclaiming variables: Opt7_Pkg.T12b/17 Opt7_Pkg.T8b/16
    
    but the DECL_INITIAL is explicitly preserved for later constant folding,
    which makes it possible to retrofit the DECLs corresponding to the first
    two symbols in the GIMPLE IR and ultimately leads to the crash.
    
    gcc/
            * tree-vect-data-refs.cc (vect_can_force_dr_alignment_p): Return
            false if the variable has no symtab node.
    
    gcc/testsuite/
            * gnat.dg/specs/opt7.ads: New test.
            * gnat.dg/specs/opt7_pkg.ads: New helper.
            * gnat.dg/specs/opt7_pkg.adb: Likewise.

diff --git a/gcc/testsuite/gnat.dg/specs/opt7.ads b/gcc/testsuite/gnat.dg/specs/opt7.ads
new file mode 100644
index 00000000000..ee151f082a8
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/opt7.ads
@@ -0,0 +1,15 @@
+-- { dg-do compile }
+-- { dg-options "-O2 -gnatn" }
+
+with Opt7_Pkg; use Opt7_Pkg;
+
+package Opt7 is
+
+  type Rec is record
+    E : Enum;
+  end record;
+
+  function Image (R : Rec) return String is
+    (if R.E = A then Image (R.E) else "");
+
+end Opt7;
diff --git a/gcc/testsuite/gnat.dg/specs/opt7_pkg.adb b/gcc/testsuite/gnat.dg/specs/opt7_pkg.adb
new file mode 100644
index 00000000000..1c9d79bb872
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/opt7_pkg.adb
@@ -0,0 +1,15 @@
+package body Opt7_Pkg is
+
+  type Constant_String_Access is access constant String;
+
+  type Enum_Name is array (Enum) of Constant_String_Access;
+
+  Enum_Name_Table : constant Enum_Name :=
+    (A => new String'("A"), B => new String'("B"));
+
+  function Image (E : Enum) return String is
+  begin
+    return Enum_Name_Table (E).all;
+  end Image;
+
+end Opt7_Pkg;
diff --git a/gcc/testsuite/gnat.dg/specs/opt7_pkg.ads b/gcc/testsuite/gnat.dg/specs/opt7_pkg.ads
new file mode 100644
index 00000000000..2dd271b63ad
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/opt7_pkg.ads
@@ -0,0 +1,9 @@
+-- { dg-excess-errors "no code generated" }
+
+package Opt7_Pkg is
+
+  type Enum is (A, B);
+
+  function Image (E : Enum) return String with Inline;
+
+end Opt7_Pkg;
diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
index a268a27b8c8..8adf80455b3 100644
--- a/gcc/tree-vect-data-refs.cc
+++ b/gcc/tree-vect-data-refs.cc
@@ -6726,7 +6726,8 @@ vect_can_force_dr_alignment_p (const_tree decl, poly_uint64 alignment)
     return false;
 
   if (decl_in_symtab_p (decl)
-      && !symtab_node::get (decl)->can_increase_alignment_p ())
+      && (!symtab_node::get (decl)
+	  || !symtab_node::get (decl)->can_increase_alignment_p ()))
     return false;
 
   if (TREE_STATIC (decl))

commit 6e8dcc0aa0ba5de2c44ceeb7bc2323def4724cd1
Author: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Date:   Tue Dec 10 00:56:13 2024 +0100

    libstdc++: fix compile error when converting std::weak_ptr<T[]>
    
    A std::weak_ptr<T[]> can be converted to a compatible
    std::weak_ptr<U[]>. This is implemented by having suitable converting
    constructors to std::weak_ptr which dispatch to the __weak_ptr base
    class (implementation detail).
    
    In __weak_ptr<T[]>, lock() is supposed to return a __shared_ptr<T[]>,
    not a __shared_ptr<element_type> (that is, __shared_ptr<T>).
    
    Unfortunately the return type of lock() and the type of the returned
    __shared_ptr were mismatching and that was causing a compile error: when
    converting a __weak_ptr<T[]> to a __weak_ptr<U[]> through __weak_ptr's
    converting constructor, the code calls lock(), and that simply fails to
    build.
    
    Fix it by removing the usage of element_type inside lock(), and using
    _Tp instead.
    
    Note that std::weak_ptr::lock() itself was already correct; the one in
    __weak_ptr was faulty (and that is the one called by __weak_ptr's
    converting constructors).
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/shared_ptr_base.h (lock): Fixed a compile error
            when calling lock() on a weak_ptr<T[]>, by removing an
            erroneous usage of element_type from within lock().
            * testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc:
            Add more tests for array types.
            * testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc:
            Likewise.
            * testsuite/20_util/shared_ptr/requirements/1.cc: New test.
            * testsuite/20_util/weak_ptr/requirements/1.cc: New test.
    
    (cherry picked from commit df0e6509bf74421ea68a2e025300bcd6ca63722f)

diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 2c948d5b838..d300adfcc4a 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -2065,7 +2065,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       __shared_ptr<_Tp, _Lp>
       lock() const noexcept
-      { return __shared_ptr<element_type, _Lp>(*this, std::nothrow); }
+      { return __shared_ptr<_Tp, _Lp>(*this, std::nothrow); }
 
       long
       use_count() const noexcept
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/1.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/1.cc
new file mode 100644
index 00000000000..8ddb5d220ac
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/1.cc
@@ -0,0 +1,33 @@
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target hosted }
+
+#include <memory>
+#include <testsuite_tr1.h>
+
+using namespace __gnu_test;
+
+void
+test01()
+{
+  std::shared_ptr<ClassType> ptr;
+  std::shared_ptr<const ClassType> ptr2 = ptr;
+
+#if __cpp_lib_shared_ptr_arrays >= 201611L
+  std::shared_ptr<ClassType[10]> ptr_array;
+  std::shared_ptr<ClassType[]> ptr_array2 = ptr_array;
+  std::shared_ptr<ClassType const []> ptr_array3 = ptr_array;
+#endif
+}
+
+void
+test02()
+{
+  std::shared_ptr<IncompleteClass> ptr;
+  std::shared_ptr<const IncompleteClass> ptr2 = ptr;
+
+#if __cpp_lib_shared_ptr_arrays >= 201611L
+  std::shared_ptr<IncompleteClass[10]> ptr_array;
+  std::shared_ptr<IncompleteClass[]> ptr_array2 = ptr_array;
+  std::shared_ptr<IncompleteClass const []> ptr_array3 = ptr_array;
+#endif
+}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc
index 03d2fe10d48..892dd6e8f1e 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc
@@ -28,3 +28,15 @@ template class std::shared_ptr<int>;
 template class std::shared_ptr<void>;
 template class std::shared_ptr<ClassType>;
 template class std::shared_ptr<IncompleteClass>;
+
+#if __cpp_lib_shared_ptr_arrays >= 201611L
+template class std::shared_ptr<ClassType []>;
+template class std::shared_ptr<ClassType [42]>;
+template class std::shared_ptr<ClassType const []>;
+template class std::shared_ptr<ClassType const [42]>;
+
+template class std::shared_ptr<IncompleteClass []>;
+template class std::shared_ptr<IncompleteClass [42]>;
+template class std::shared_ptr<IncompleteClass const []>;
+template class std::shared_ptr<IncompleteClass const [42]>;
+#endif
diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/1.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/1.cc
new file mode 100644
index 00000000000..04ea837d85a
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/1.cc
@@ -0,0 +1,33 @@
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target hosted }
+
+#include <memory>
+#include <testsuite_tr1.h>
+
+using namespace __gnu_test;
+
+void
+test01()
+{
+  std::weak_ptr<ClassType> ptr;
+  std::weak_ptr<const ClassType> ptr2 = ptr;
+
+#if __cpp_lib_shared_ptr_arrays >= 201611L
+  std::weak_ptr<ClassType[10]> ptr_array;
+  std::weak_ptr<ClassType[]> ptr_array2 = ptr_array;
+  std::weak_ptr<ClassType const []> ptr_array3 = ptr_array;
+#endif
+}
+
+void
+test02()
+{
+  std::weak_ptr<IncompleteClass> ptr;
+  std::weak_ptr<const IncompleteClass> ptr2 = ptr;
+
+#if __cpp_lib_shared_ptr_arrays >= 201611L
+  std::weak_ptr<IncompleteClass[10]> ptr_array;
+  std::weak_ptr<IncompleteClass[]> ptr_array2 = ptr_array;
+  std::weak_ptr<IncompleteClass const []> ptr_array3 = ptr_array;
+#endif
+}
diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc
index 5087e074898..18baa41b998 100644
--- a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc
+++ b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc
@@ -28,3 +28,15 @@ template class std::weak_ptr<int>;
 template class std::weak_ptr<void>;
 template class std::weak_ptr<ClassType>;
 template class std::weak_ptr<IncompleteClass>;
+
+#if __cpp_lib_shared_ptr_arrays >= 201611L
+template class std::weak_ptr<ClassType []>;
+template class std::weak_ptr<ClassType [42]>;
+template class std::weak_ptr<ClassType const []>;
+template class std::weak_ptr<ClassType const [42]>;
+
+template class std::weak_ptr<IncompleteClass []>;
+template class std::weak_ptr<IncompleteClass [42]>;
+template class std::weak_ptr<IncompleteClass const []>;
+template class std::weak_ptr<IncompleteClass const [42]>;
+#endif

commit 561607ff94a9c602de3cb6c09518a72c7ad6160f
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 30 18:27:45 2025 -0400

    c++: lambda this capture and requires [PR120123]
    
    We shouldn't need to be within the lambda body to look through it to the
    enclosing non-static member function.
    
    This change is a small subset of r16-970.
    
            PR c++/120123
    
    gcc/cp/ChangeLog:
    
            * lambda.cc (nonlambda_method_basetype): Look through lambdas
            even when current_class_ref is null.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp2a/concepts-lambda24.C: New test.

diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc
index 9925209b2ed..ce2bcbe9a7f 100644
--- a/gcc/cp/lambda.cc
+++ b/gcc/cp/lambda.cc
@@ -975,12 +975,9 @@ current_nonlambda_function (void)
 tree
 nonlambda_method_basetype (void)
 {
-  if (!current_class_ref)
-    return NULL_TREE;
-
   tree type = current_class_type;
   if (!type || !LAMBDA_TYPE_P (type))
-    return type;
+    return current_class_ref ? type : NULL_TREE;
 
   while (true)
     {
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda24.C b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda24.C
new file mode 100644
index 00000000000..28f56ca2335
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda24.C
@@ -0,0 +1,13 @@
+// PR c++/120123
+// { dg-do compile { target c++20 } }
+
+struct H {
+    void member(int) {}
+    void call() {
+        [this]() {
+            [this](const auto& v)
+                requires requires { /*this->*/member(v); }
+            { return member(v); }(0);
+        };
+    }
+};

commit 26e891dd7e9600a3f3a1acbdfe0bb39a44b8a65d
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Fri Jun 6 00:22:10 2025 +0000

    Daily bump.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fd9bb281895..96ccff31839 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2025-06-05  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* tree-vect-data-refs.cc (vect_can_force_dr_alignment_p): Return
+	false if the variable has no symtab node.
+
 2025-06-05  Release Manager
 
 	* GCC 13.4.0 released.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 520e78d7696..c6de4e34998 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250605
+20250606
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 56ca80765f1..40aa436c2f1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2025-06-05  Jason Merrill  <jason@redhat.com>
+
+	PR c++/120123
+	* lambda.cc (nonlambda_method_basetype): Look through lambdas
+	even when current_class_ref is null.
+
 2025-06-05  Release Manager
 
 	* GCC 13.4.0 released.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e822bcc2d45..71d2d3780c4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2025-06-05  Jason Merrill  <jason@redhat.com>
+
+	PR c++/120123
+	* g++.dg/cpp2a/concepts-lambda24.C: New test.
+
+2025-06-05  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* gnat.dg/specs/opt7.ads: New test.
+	* gnat.dg/specs/opt7_pkg.ads: New helper.
+	* gnat.dg/specs/opt7_pkg.adb: Likewise.
+
 2025-06-05  Release Manager
 
 	* GCC 13.4.0 released.
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index d0851cd38ba..7bc3a622f14 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,18 @@
+2025-06-05  Giuseppe D'Angelo  <giuseppe.dangelo@kdab.com>
+
+	Backported from master:
+	2025-03-14  Giuseppe D'Angelo  <giuseppe.dangelo@kdab.com>
+
+	* include/bits/shared_ptr_base.h (lock): Fixed a compile error
+	when calling lock() on a weak_ptr<T[]>, by removing an
+	erroneous usage of element_type from within lock().
+	* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc:
+	Add more tests for array types.
+	* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc:
+	Likewise.
+	* testsuite/20_util/shared_ptr/requirements/1.cc: New test.
+	* testsuite/20_util/weak_ptr/requirements/1.cc: New test.
+
 2025-06-05  Release Manager
 
 	* GCC 13.4.0 released.

commit 63be00fe4cad2552edcda863087adcce0b2aa236
Author: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Date:   Thu Feb 6 14:24:17 2025 +0000

    libstdc++: fix a dangling reference crash in ranges::is_permutation [PR118160]
    
    The code was caching the result of `invoke(proj, *it)` in a local
    `auto &&` variable. The problem is that this may create dangling
    references, for instance in case `proj` is `std::identity` (the common
    case) and `*it` produces a prvalue: lifetime extension does not
    apply here due to the expressions involved.
    
    Instead, store (and lifetime-extend) the result of `*it` in a separate
    variable, then project that variable. While at it, also forward the
    result of the projection to the predicate, so that the predicate can
    act on the proper value category.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/118160
            PR libstdc++/100249
            * include/bits/ranges_algo.h (__is_permutation_fn): Avoid a
            dangling reference by storing the result of the iterator
            dereference and the result of the projection in two distinct
            variables, in order to lifetime-extend each one.
            Forward the projected value to the predicate.
            * testsuite/25_algorithms/is_permutation/constrained.cc: Add a
            test with a range returning prvalues. Test it in a constexpr
            context, in order to rely on the compiler to catch UB.
    
    Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
    (cherry picked from commit 2a2bd96d0d2109384a0eedde843ba811d2e18738)

diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h
index 48efe9f8165..4060a507d6f 100644
--- a/libstdc++-v3/include/bits/ranges_algo.h
+++ b/libstdc++-v3/include/bits/ranges_algo.h
@@ -561,9 +561,12 @@ namespace ranges
 
 	for (auto __scan = __first1; __scan != __last1; ++__scan)
 	  {
-	    auto&& __proj_scan = std::__invoke(__proj1, *__scan);
+	    auto&& __scan_deref = *__scan;
+	    auto&& __proj_scan =
+	      std::__invoke(__proj1, std::forward<decltype(__scan_deref)>(__scan_deref));
 	    auto __comp_scan = [&] <typename _Tp> (_Tp&& __arg) -> bool {
-	      return std::__invoke(__pred, __proj_scan,
+	      return std::__invoke(__pred,
+				   std::forward<decltype(__proj_scan)>(__proj_scan),
 				   std::forward<_Tp>(__arg));
 	    };
 	    if (__scan != ranges::find_if(__first1, __scan,
diff --git a/libstdc++-v3/testsuite/25_algorithms/is_permutation/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/is_permutation/constrained.cc
index e503247d44a..5ffe3ce3da3 100644
--- a/libstdc++-v3/testsuite/25_algorithms/is_permutation/constrained.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/is_permutation/constrained.cc
@@ -20,6 +20,7 @@
 
 #include <algorithm>
 #include <iterator>
+#include <ranges>
 #include <testsuite_hooks.h>
 #include <testsuite_iterators.h>
 
@@ -77,10 +78,22 @@ test03()
   while (std::next_permutation(std::begin(cx), std::end(cx)));
 }
 
+constexpr
+bool
+test04() // PR118160, do not create dangling references
+{
+  int x[] = { 4, 3, 2, 1 };
+  auto y = std::views::iota(1, 5);
+  return ranges::is_permutation(x, y) && ranges::is_permutation(y, x);
+}
+
+static_assert(test04());
+
 int
 main()
 {
   test01();
   test02();
   test03();
+  VERIFY( test04() );
 }

commit 6694282dd41a99d2d50a7710648dfc6080c9d67c
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sat Jun 7 00:21:58 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index c6de4e34998..a3a91b55b0f 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250606
+20250607
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 7bc3a622f14..6a0a0188a7f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,19 @@
+2025-06-06  Giuseppe D'Angelo  <giuseppe.dangelo@kdab.com>
+
+	Backported from master:
+	2025-02-07  Giuseppe D'Angelo  <giuseppe.dangelo@kdab.com>
+
+	PR libstdc++/118160
+	PR libstdc++/100249
+	* include/bits/ranges_algo.h (__is_permutation_fn): Avoid a
+	dangling reference by storing the result of the iterator
+	dereference and the result of the projection in two distinct
+	variables, in order to lifetime-extend each one.
+	Forward the projected value to the predicate.
+	* testsuite/25_algorithms/is_permutation/constrained.cc: Add a
+	test with a range returning prvalues. Test it in a constexpr
+	context, in order to rely on the compiler to catch UB.
+
 2025-06-05  Giuseppe D'Angelo  <giuseppe.dangelo@kdab.com>
 
 	Backported from master:

commit cab3835238686ba74b02309518574a34ef8857de
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sun Jun 8 00:20:43 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index a3a91b55b0f..800deb1dc5a 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250607
+20250608

commit 09b295ddc0f31147243869a801ac40b4711cd49b
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Mon Jun 9 00:21:25 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 800deb1dc5a..d0f154b4f06 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250608
+20250609

commit 9184a4b75a750a3ee86a7864fe432198995193b9
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Tue Jun 10 00:21:51 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index d0f154b4f06..52988ae3b03 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250609
+20250610

commit d97de614f7a3729f7a841f48748d0b3bf746d0a2
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue May 20 10:53:41 2025 +0100

    libstdc++: Fix incorrect links to archived SGI STL docs
    
    In r8-7777-g25949ee33201f2 I updated some URLs to point to copies of the
    SGI STL docs in the Wayback Machine, because the original pags were no
    longer hosted on sgi.com. However, I incorrectly assumed that if one
    archived page was at https://web.archive.org/web/20171225062613/... then
    all the other pages would be too. Apparently that's not how the Wayback
    Machine works, and each page is archived on a different date. That meant
    that some of our links were redirecting to archived copies of the
    announcement that the SGI STL docs have gone away.
    
    This fixes each URL to refer to a correctly archived copy of the
    original docs.
    
    libstdc++-v3/ChangeLog:
    
            * doc/xml/faq.xml: Update URL for archived SGI STL docs.
            * doc/xml/manual/containers.xml: Likewise.
            * doc/xml/manual/extensions.xml: Likewise.
            * doc/xml/manual/using.xml: Likewise.
            * doc/xml/manual/utilities.xml: Likewise.
            * doc/html/*: Regenerate.
    
    (cherry picked from commit 501e6e786652748ff0ad9a322f74b9b47970031f)

diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html
index 2e913920d05..d7ad0934cfb 100644
--- a/libstdc++-v3/doc/html/faq.html
+++ b/libstdc++-v3/doc/html/faq.html
@@ -797,7 +797,7 @@
     Libstdc++-v3 incorporates a lot of code from
     <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/" target="_top">the SGI STL</a>
     (the final merge was from
-    <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/whats_new.html" target="_top">release 3.3</a>).
+    <a class="link" href="https://web.archive.org/web/20171206110416/http://www.sgi.com/tech/stl/whats_new.html" target="_top">release 3.3</a>).
     The code in libstdc++ contains many fixes and changes compared to the
     original SGI code.
     </p><p>
diff --git a/libstdc++-v3/doc/html/manual/containers.html b/libstdc++-v3/doc/html/manual/containers.html
index 7035a949074..dcd609a6000 100644
--- a/libstdc++-v3/doc/html/manual/containers.html
+++ b/libstdc++-v3/doc/html/manual/containers.html
@@ -11,7 +11,7 @@
      Yes it is, at least using the <a class="link" href="using_dual_abi.html" title="Dual ABI">old
      ABI</a>, and that's okay.  This is a decision that we preserved
      when we imported SGI's STL implementation.  The following is
-     quoted from <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/FAQ.html" target="_top">their FAQ</a>:
+     quoted from <a class="link" href="https://web.archive.org/web/20161222192301/http://www.sgi.com/tech/stl/FAQ.html" target="_top">their FAQ</a>:
    </p><div class="blockquote"><blockquote class="blockquote"><p>
        The size() member function, for list and slist, takes time
        proportional to the number of elements in the list.  This was a
diff --git a/libstdc++-v3/doc/html/manual/ext_numerics.html b/libstdc++-v3/doc/html/manual/ext_numerics.html
index 9b864e1dcf4..c3a5623d175 100644
--- a/libstdc++-v3/doc/html/manual/ext_numerics.html
+++ b/libstdc++-v3/doc/html/manual/ext_numerics.html
@@ -14,7 +14,7 @@
    The operation functor must be associative.
 </p><p>The <code class="code">iota</code> function wins the award for Extension With the
    Coolest Name (the name comes from Ken Iverson's APL language.)  As
-   described in the <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/iota.html" target="_top">SGI
+   described in the <a class="link" href="https://web.archive.org/web/20170201044840/http://www.sgi.com/tech/stl/iota.html" target="_top">SGI
    documentation</a>, it "assigns sequentially increasing values to a range.
    That is, it assigns <code class="code">value</code> to <code class="code">*first</code>,
    <code class="code">value + 1</code> to<code class="code"> *(first + 1)</code> and so on."
diff --git a/libstdc++-v3/doc/html/manual/ext_sgi.html b/libstdc++-v3/doc/html/manual/ext_sgi.html
index ae2062954f4..2310857804b 100644
--- a/libstdc++-v3/doc/html/manual/ext_sgi.html
+++ b/libstdc++-v3/doc/html/manual/ext_sgi.html
@@ -28,12 +28,12 @@
       and sets.
    </p><p>Each of the associative containers map, multimap, set, and multiset
       have a counterpart which uses a
-      <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/HashFunction.html" target="_top">hashing
+      <a class="link" href="https://web.archive.org/web/20171230172024/http://www.sgi.com/tech/stl/HashFunction.html" target="_top">hashing
       function</a> to do the arranging, instead of a strict weak ordering
       function.  The classes take as one of their template parameters a
       function object that will return the hash value; by default, an
       instantiation of
-      <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/hash.html" target="_top">hash</a>.
+      <a class="link" href="https://web.archive.org/web/20171230172200/http://www.sgi.com/tech/stl/hash.html" target="_top">hash</a>.
       You should specialize this functor for your class, or define your own,
       before trying to use one of the hashing classes.
    </p><p>The hashing classes support all the usual associative container
diff --git a/libstdc++-v3/doc/html/manual/using_concurrency.html b/libstdc++-v3/doc/html/manual/using_concurrency.html
index f99cca414ec..a75adbf0f22 100644
--- a/libstdc++-v3/doc/html/manual/using_concurrency.html
+++ b/libstdc++-v3/doc/html/manual/using_concurrency.html
@@ -40,7 +40,7 @@ The standard places requirements on the library to ensure that no data
 races are caused by the library itself or by programs which use the
 library correctly (as described below).
 The C++11 memory model and library requirements are a more formal version
-of the <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html" target="_top">SGI STL</a> definition of thread safety, which the library used
+of the <a class="link" href="https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html" target="_top">SGI STL</a> definition of thread safety, which the library used
 prior to the 2011 standard.
 </p><p>The library strives to be thread-safe when all of the following
 	 conditions are met:
@@ -243,10 +243,10 @@ gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
       threaded and non-threaded code), see Chapter 17.
    </p><p>Two excellent pages to read when working with the Standard C++
       containers and threads are
-      <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html" target="_top">SGI's
-      https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html</a> and
-      <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/Allocators.html" target="_top">SGI's
-      https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/Allocators.html</a>.
+      <a class="link" href="https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html" target="_top">SGI's
+      https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html</a> and
+      <a class="link" href="https://web.archive.org/web/20171108142526/http://www.sgi.com/tech/stl/Allocators.html" target="_top">SGI's
+      https://web.archive.org/web/20171108142526/http://www.sgi.com/tech/stl/Allocators.html</a>.
    </p><p><span class="emphasis"><em>However, please ignore all discussions about the user-level
       configuration of the lock implementation inside the STL
       container-memory allocator on those pages.  For the sake of this
diff --git a/libstdc++-v3/doc/html/manual/utilities.html b/libstdc++-v3/doc/html/manual/utilities.html
index 15c9a9d170a..1216b72ad3e 100644
--- a/libstdc++-v3/doc/html/manual/utilities.html
+++ b/libstdc++-v3/doc/html/manual/utilities.html
@@ -11,6 +11,6 @@
       get slightly the wrong idea.  In the interest of not reinventing
       the wheel, we will refer you to the introduction to the functor
       concept written by SGI as part of their STL, in
-      <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/functors.html" target="_top">their
-      https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/functors.html</a>.
+      <a class="link" href="https://web.archive.org/web/20171209002754/http://www.sgi.com/tech/stl/functors.html" target="_top">their
+      https://web.archive.org/web/20171209002754/http://www.sgi.com/tech/stl/functors.html</a>.
    </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="concept_checking.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="std_contents.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pairs.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Concept Checking </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Pairs</td></tr></table></div></body></html>
\ No newline at end of file
diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml
index 0481c695fcd..e42ebddde39 100644
--- a/libstdc++-v3/doc/xml/faq.xml
+++ b/libstdc++-v3/doc/xml/faq.xml
@@ -1131,7 +1131,7 @@
     Libstdc++-v3 incorporates a lot of code from
     <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/">the SGI STL</link>
     (the final merge was from
-    <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/whats_new.html">release 3.3</link>).
+    <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171206110416/http://www.sgi.com/tech/stl/whats_new.html">release 3.3</link>).
     The code in libstdc++ contains many fixes and changes compared to the
     original SGI code.
     </para>
diff --git a/libstdc++-v3/doc/xml/manual/containers.xml b/libstdc++-v3/doc/xml/manual/containers.xml
index 6d9a3874924..1758762b882 100644
--- a/libstdc++-v3/doc/xml/manual/containers.xml
+++ b/libstdc++-v3/doc/xml/manual/containers.xml
@@ -28,7 +28,7 @@
      Yes it is, at least using the <link linkend="manual.intro.using.abi">old
      ABI</link>, and that's okay.  This is a decision that we preserved
      when we imported SGI's STL implementation.  The following is
-     quoted from <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/FAQ.html">their FAQ</link>:
+     quoted from <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20161222192301/http://www.sgi.com/tech/stl/FAQ.html">their FAQ</link>:
    </para>
    <blockquote>
      <para>
diff --git a/libstdc++-v3/doc/xml/manual/extensions.xml b/libstdc++-v3/doc/xml/manual/extensions.xml
index b31cb758de9..4cb94196f0d 100644
--- a/libstdc++-v3/doc/xml/manual/extensions.xml
+++ b/libstdc++-v3/doc/xml/manual/extensions.xml
@@ -221,12 +221,12 @@ extensions, be aware of two things:
    </para>
    <para>Each of the associative containers map, multimap, set, and multiset
       have a counterpart which uses a
-      <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/HashFunction.html">hashing
+      <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171230172024/http://www.sgi.com/tech/stl/HashFunction.html">hashing
       function</link> to do the arranging, instead of a strict weak ordering
       function.  The classes take as one of their template parameters a
       function object that will return the hash value; by default, an
       instantiation of
-      <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/hash.html">hash</link>.
+      <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171230172200/http://www.sgi.com/tech/stl/hash.html">hash</link>.
       You should specialize this functor for your class, or define your own,
       before trying to use one of the hashing classes.
    </para>
@@ -388,7 +388,7 @@ get_temporary_buffer(5, (int*)0);
 </para>
 <para>The <code>iota</code> function wins the award for Extension With the
    Coolest Name (the name comes from Ken Iverson's APL language.)  As
-   described in the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/iota.html">SGI
+   described in the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20170201044840/http://www.sgi.com/tech/stl/iota.html">SGI
    documentation</link>, it "assigns sequentially increasing values to a range.
    That is, it assigns <code>value</code> to <code>*first</code>,
    <code>value + 1</code> to<code> *(first + 1)</code> and so on."
diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml
index 4e627654d97..b227d225bc7 100644
--- a/libstdc++-v3/doc/xml/manual/using.xml
+++ b/libstdc++-v3/doc/xml/manual/using.xml
@@ -1796,7 +1796,7 @@ The standard places requirements on the library to ensure that no data
 races are caused by the library itself or by programs which use the
 library correctly (as described below).
 The C++11 memory model and library requirements are a more formal version
-of the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html">SGI STL</link> definition of thread safety, which the library used
+of the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html">SGI STL</link> definition of thread safety, which the library used
 prior to the 2011 standard.
 </para>
 
@@ -2081,10 +2081,10 @@ gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
    </para>
    <para>Two excellent pages to read when working with the Standard C++
       containers and threads are
-      <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html">SGI's
-      https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html</link> and
-      <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/Allocators.html">SGI's
-      https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/Allocators.html</link>.
+      <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html">SGI's
+      https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html</link> and
+      <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171108142526/http://www.sgi.com/tech/stl/Allocators.html">SGI's
+      https://web.archive.org/web/20171108142526/http://www.sgi.com/tech/stl/Allocators.html</link>.
    </para>
    <para><emphasis>However, please ignore all discussions about the user-level
       configuration of the lock implementation inside the STL
diff --git a/libstdc++-v3/doc/xml/manual/utilities.xml b/libstdc++-v3/doc/xml/manual/utilities.xml
index e155c8c3943..c2e013e3416 100644
--- a/libstdc++-v3/doc/xml/manual/utilities.xml
+++ b/libstdc++-v3/doc/xml/manual/utilities.xml
@@ -22,8 +22,8 @@
       get slightly the wrong idea.  In the interest of not reinventing
       the wheel, we will refer you to the introduction to the functor
       concept written by SGI as part of their STL, in
-      <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/functors.html">their
-      https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/functors.html</link>.
+      <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171209002754/http://www.sgi.com/tech/stl/functors.html">their
+      https://web.archive.org/web/20171209002754/http://www.sgi.com/tech/stl/functors.html</link>.
    </para>
 </section>
 

commit f7cfab38ef7fdeea6ba0bbb5638075aa8baca5ee
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Wed Jun 11 00:22:11 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 52988ae3b03..a3ea83c2661 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250610
+20250611
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 6a0a0188a7f..8d013e39ef1 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,15 @@
+2025-06-10  Jonathan Wakely  <jwakely@redhat.com>
+
+	Backported from master:
+	2025-05-20  Jonathan Wakely  <jwakely@redhat.com>
+
+	* doc/xml/faq.xml: Update URL for archived SGI STL docs.
+	* doc/xml/manual/containers.xml: Likewise.
+	* doc/xml/manual/extensions.xml: Likewise.
+	* doc/xml/manual/using.xml: Likewise.
+	* doc/xml/manual/utilities.xml: Likewise.
+	* doc/html/*: Regenerate.
+
 2025-06-06  Giuseppe D'Angelo  <giuseppe.dangelo@kdab.com>
 
 	Backported from master:

commit 4f3ce8d046f4ce2c50a7d9c9cfd1d3ea5a1ac347
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Apr 29 18:16:29 2024 +0100

    libstdc++: Tweak localized formatting for floating-point types
    
    libstdc++-v3/ChangeLog:
    
            * include/std/format (__formatter_fp::_M_localize): Add comments
            and micro-optimize string copy.
    
    (cherry picked from commit 99b8be43d7c548db127ee4f4d0918c55edc68b3f)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index c7e43330e7e..980ae53d50c 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -1738,25 +1738,28 @@ namespace __format
 	if (__grp.empty() && __point == __dot)
 	  return __lstr; // Locale uses '.' and no grouping.
 
-	size_t __d = __str.find(__dot);
-	size_t __e = min(__d, __str.find(__exp));
+	size_t __d = __str.find(__dot); // Index of radix character (if any).
+	size_t __e = min(__d, __str.find(__exp)); // First of radix or exponent
 	if (__e == __str.npos)
 	  __e = __str.size();
-	const size_t __r = __str.size() - __e;
+	const size_t __r = __str.size() - __e; // Length of remainder.
 	auto __overwrite = [&](_CharT* __p, size_t) {
+	  // Apply grouping to the digits before the radix or exponent.
 	  auto __end = std::__add_grouping(__p, __np.thousands_sep(),
 					   __grp.data(), __grp.size(),
 					   __str.data(), __str.data() + __e);
-	  if (__r)
+	  if (__r) // If there's a fractional part or exponent
 	    {
 	      if (__d != __str.npos)
 		{
-		  *__end = __point;
+		  *__end = __point; // Add the locale's radix character.
 		  ++__end;
 		  ++__e;
 		}
-	      if (__r > 1)
-		__end += __str.copy(__end, __str.npos, __e);
+	      const size_t __rlen = __str.size() - __e;
+	      // Append fractional digits and/or exponent:
+	      char_traits<_CharT>::copy(__end, __str.data() + __e, __rlen);
+	      __end += __rlen;
 	    }
 	  return (__end - __p);
 	};

commit f8ae6193b7665a3ee58f04f81d5ed3ff2af37c9b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jun 4 18:22:28 2025 +0100

    libstdc++: Fix std::format thousands separators when sign present [PR120548]
    
    The leading sign character should be skipped when deciding whether to
    insert thousands separators into a floating-point format.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/120548
            * include/std/format (__formatter_fp::_M_localize): Do not
            include a leading sign character in the string to be grouped.
            * testsuite/std/format/functions/format.cc: Check grouping when
            sign is present in the output.
    
    Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
    (cherry picked from commit 2c3559839d70df6311da18fd93237050405580c3)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 980ae53d50c..c34b6ca16c9 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -1745,9 +1745,16 @@ namespace __format
 	const size_t __r = __str.size() - __e; // Length of remainder.
 	auto __overwrite = [&](_CharT* __p, size_t) {
 	  // Apply grouping to the digits before the radix or exponent.
-	  auto __end = std::__add_grouping(__p, __np.thousands_sep(),
+	  int __off = 0;
+	  if (auto __c = __str.front(); __c == '-' || __c == '+' || __c == ' ')
+	    {
+	      *__p = __c;
+	      __off = 1;
+	    }
+	  auto __end = std::__add_grouping(__p + __off, __np.thousands_sep(),
 					   __grp.data(), __grp.size(),
-					   __str.data(), __str.data() + __e);
+					   __str.data() + __off,
+					   __str.data() + __e);
 	  if (__r) // If there's a fractional part or exponent
 	    {
 	      if (__d != __str.npos)
diff --git a/libstdc++-v3/testsuite/std/format/functions/format.cc b/libstdc++-v3/testsuite/std/format/functions/format.cc
index 5d1d9ed0720..fd41847d8d9 100644
--- a/libstdc++-v3/testsuite/std/format/functions/format.cc
+++ b/libstdc++-v3/testsuite/std/format/functions/format.cc
@@ -239,6 +239,16 @@ test_locale()
   s = std::format(eloc, "{0:Le} {0:Lf} {0:Lg}", -nan);
   VERIFY( s == "-nan -nan -nan" );
 
+  // PR libstdc++/120548 format confuses a negative sign for a thousands digit
+  s = std::format(bloc, "{:L}", -123.45);
+  VERIFY( s == "-123.45" );
+  s = std::format(bloc, "{:-L}", -876543.21);
+  VERIFY( s == "-876,543.21" );
+  s = std::format(bloc, "{:+L}", 333.22);
+  VERIFY( s == "+333.22" );
+  s = std::format(bloc, "{: L}", 999.44);
+  VERIFY( s == " 999.44" );
+
   // Restore
   std::locale::global(cloc);
 }

commit 0fce225524c6d15a6ea491117c696b5bb4bdf72e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed May 28 15:19:18 2025 +0100

    libstdc++: Make system_clock::to_time_t always_inline [PR99832]
    
    For some 32-bit targets Glibc supports changing the size of time_t to be
    64 bits by defining _TIME_BITS=64. That causes an ABI change which
    would affect std::chrono::system_clock::to_time_t. Because to_time_t is
    not a function template, its mangled name does not depend on the return
    type, so it has the same mangled name whether it returns a 32-bit time_t
    or a 64-bit time_t. On targets where the size of time_t can be selected
    at preprocessing time, that can cause ODR violations, e.g. the linker
    selects a definition of to_time_t that returns a 32-bit value but a
    caller expects 64-bit and so reads 32 bits of garbage from the stack.
    
    This commit adds always_inline to to_time_t so that all callers inline
    the conversion to time_t, and will do so using whatever type time_t
    happens to be in that translation unit.
    
    Existing objects compiled before this change will either have inlined
    the function anyway (which is likely if compiled with any optimization
    enabled) or will contain a COMDAT definition of the inline function and
    so still be able to find it at link-time.
    
    The attribute is also added to system_clock::from_time_t, because that's
    an equally simple function and it seems reasonable for them to both be
    always inlined.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/99832
            * include/bits/chrono.h (system_clock::to_time_t): Add
            always_inline attribute to be agnostic to the underlying type of
            time_t.
            (system_clock::from_time_t): Add always_inline for consistency
            with to_time_t.
            * testsuite/20_util/system_clock/99832.cc: New test.
    
    (cherry picked from commit d045eb13b0b42870a1f081895df3901112a358f0)

diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h
index 04078ff8f2d..5237418d6a6 100644
--- a/libstdc++-v3/include/bits/chrono.h
+++ b/libstdc++-v3/include/bits/chrono.h
@@ -1239,6 +1239,7 @@ _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
       now() noexcept;
 
       // Map to C API
+      [[__gnu__::__always_inline__]]
       static std::time_t
       to_time_t(const time_point& __t) noexcept
       {
@@ -1246,6 +1247,7 @@ _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
 			   (__t.time_since_epoch()).count());
       }
 
+      [[__gnu__::__always_inline__]]
       static time_point
       from_time_t(std::time_t __t) noexcept
       {
diff --git a/libstdc++-v3/testsuite/20_util/system_clock/99832.cc b/libstdc++-v3/testsuite/20_util/system_clock/99832.cc
new file mode 100644
index 00000000000..4bc361e21ad
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/system_clock/99832.cc
@@ -0,0 +1,14 @@
+// { dg-options "-O0 -g0 -std=gnu++20" }
+// { dg-do compile { target c++20 } }
+// { dg-final { scan-assembler-not "system_clock9to_time_t" } }
+
+// Bug libstdc++/99832
+// std::chrono::system_clock::to_time_t needs ABI tag for 32-bit time_t
+
+#include <chrono>
+
+std::time_t
+test_pr99832(std::chrono::system_clock::time_point t)
+{
+  return std::chrono::system_clock::to_time_t(t);
+}

commit 28974867ea6d18ed0bf1af5c4aba5c661cb16449
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Thu Jun 12 00:22:42 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index a3ea83c2661..b1bf7be3549 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250611
+20250612
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8d013e39ef1..a0999615fda 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,35 @@
+2025-06-11  Jonathan Wakely  <jwakely@redhat.com>
+
+	Backported from master:
+	2025-06-04  Jonathan Wakely  <jwakely@redhat.com>
+
+	PR libstdc++/99832
+	* include/bits/chrono.h (system_clock::to_time_t): Add
+	always_inline attribute to be agnostic to the underlying type of
+	time_t.
+	(system_clock::from_time_t): Add always_inline for consistency
+	with to_time_t.
+	* testsuite/20_util/system_clock/99832.cc: New test.
+
+2025-06-11  Jonathan Wakely  <jwakely@redhat.com>
+
+	Backported from master:
+	2025-06-05  Jonathan Wakely  <jwakely@redhat.com>
+
+	PR libstdc++/120548
+	* include/std/format (__formatter_fp::_M_localize): Do not
+	include a leading sign character in the string to be grouped.
+	* testsuite/std/format/functions/format.cc: Check grouping when
+	sign is present in the output.
+
+2025-06-11  Jonathan Wakely  <jwakely@redhat.com>
+
+	Backported from master:
+	2024-09-14  Jonathan Wakely  <jwakely@redhat.com>
+
+	* include/std/format (__formatter_fp::_M_localize): Add comments
+	and micro-optimize string copy.
+
 2025-06-10  Jonathan Wakely  <jwakely@redhat.com>
 
 	Backported from master:

commit 1f0c7fb4071f94679c9e4694596997621bc4ffdb
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Fri Jun 13 00:21:33 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index b1bf7be3549..c544224c344 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250612
+20250613

commit 085c8cf19f602a2e37c8fbfac2f63d8380505685
Author: Richard Earnshaw <rearnsha@arm.com>
Date:   Thu Mar 20 14:42:59 2025 +0000

    opcodes: fix wrong code in expand_binop_directly [PR117811]
    
    If expand_binop_directly fails to add a REG_EQUAL note it tries to
    unwind and restart.  But it can unwind too far if expand_binop changed
    some of the operands before calling it.  We don't need to unwind that
    far anyway since we should end up taking exactly the same route next
    time, just without a target rtx.
    
    To fix this we remove LAST from the argument list and let the callers
    (all in expand_binop) do their own unwinding if the call fails.
    Instead we unwind just as far as the entry to expand_binop_directly
    and recurse within this function instead of all the way back up.
    
    gcc/ChangeLog:
    
            PR middle-end/117811
            * optabs.cc (expand_binop_directly): Remove LAST as an argument,
            instead record the last insn on entry.  Only delete insns if
            we need to restart and restart by calling ourself, not expand_binop.
            (expand_binop): Update callers to expand_binop_directly.  If it
            fails to expand the operation, delete back to LAST.
    
    gcc/testsuite:
    
            PR middle-end/117811
            * gcc.dg/torture/pr117811.c: New test.
    
    (cherry picked from commit 7679b826840c58343d72d05922355b646db4bdcc)

diff --git a/gcc/optabs.cc b/gcc/optabs.cc
index c8e39c82d57..4c009183359 100644
--- a/gcc/optabs.cc
+++ b/gcc/optabs.cc
@@ -1353,8 +1353,7 @@ avoid_expensive_constant (machine_mode mode, optab binoptab,
 static rtx
 expand_binop_directly (enum insn_code icode, machine_mode mode, optab binoptab,
 		       rtx op0, rtx op1,
-		       rtx target, int unsignedp, enum optab_methods methods,
-		       rtx_insn *last)
+		       rtx target, int unsignedp, enum optab_methods methods)
 {
   machine_mode xmode0 = insn_data[(int) icode].operand[1].mode;
   machine_mode xmode1 = insn_data[(int) icode].operand[2].mode;
@@ -1364,6 +1363,7 @@ expand_binop_directly (enum insn_code icode, machine_mode mode, optab binoptab,
   rtx_insn *pat;
   rtx xop0 = op0, xop1 = op1;
   bool canonicalize_op1 = false;
+  rtx_insn *last = get_last_insn ();
 
   /* If it is a commutative operator and the modes would match
      if we would swap the operands, we can save the conversions.  */
@@ -1428,10 +1428,7 @@ expand_binop_directly (enum insn_code icode, machine_mode mode, optab binoptab,
       tmp_mode = insn_data[(int) icode].operand[0].mode;
       if (VECTOR_MODE_P (mode)
 	  && maybe_ne (GET_MODE_NUNITS (tmp_mode), 2 * GET_MODE_NUNITS (mode)))
-	{
-	  delete_insns_since (last);
-	  return NULL_RTX;
-	}
+	return NULL_RTX;
     }
   else
     tmp_mode = mode;
@@ -1451,14 +1448,14 @@ expand_binop_directly (enum insn_code icode, machine_mode mode, optab binoptab,
 			       ops[1].value, ops[2].value, mode0))
 	{
 	  delete_insns_since (last);
-	  return expand_binop (mode, binoptab, op0, op1, NULL_RTX,
-			       unsignedp, methods);
+	  return expand_binop_directly (icode, mode, binoptab, op0, op1,
+					NULL_RTX, unsignedp, methods);
 	}
 
       emit_insn (pat);
       return ops[0].value;
     }
-  delete_insns_since (last);
+
   return NULL_RTX;
 }
 
@@ -1527,9 +1524,10 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1,
       if (icode != CODE_FOR_nothing)
 	{
 	  temp = expand_binop_directly (icode, mode, binoptab, op0, op1,
-					target, unsignedp, methods, last);
+					target, unsignedp, methods);
 	  if (temp)
 	    return temp;
+	  delete_insns_since (last);
 	}
     }
 
@@ -1555,9 +1553,10 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1,
 			       NULL_RTX, unsignedp, OPTAB_DIRECT);
 
       temp = expand_binop_directly (icode, int_mode, otheroptab, op0, newop1,
-				    target, unsignedp, methods, last);
+				    target, unsignedp, methods);
       if (temp)
 	return temp;
+      delete_insns_since (last);
     }
 
   /* If this is a multiply, see if we can do a widening operation that
@@ -1621,9 +1620,10 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1,
 	  if (vop1)
 	    {
 	      temp = expand_binop_directly (icode, mode, otheroptab, op0, vop1,
-					    target, unsignedp, methods, last);
+					    target, unsignedp, methods);
 	      if (temp)
 		return temp;
+	      delete_insns_since (last);
 	    }
 	}
     }
diff --git a/gcc/testsuite/gcc.dg/torture/pr117811.c b/gcc/testsuite/gcc.dg/torture/pr117811.c
new file mode 100644
index 00000000000..13d7e134780
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr117811.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+
+#include <string.h>
+
+typedef int v4 __attribute__((vector_size (4 * sizeof (int))));
+
+void __attribute__((noclone,noinline)) do_shift (v4 *vec, int shift)
+{
+  v4 t = *vec;
+
+  if (shift > 0)
+  {
+    t = t >> shift;
+  }
+
+  *vec = t;
+}
+
+int main ()
+{
+  v4 vec =  {0x1000000, 0x2000, 0x300, 0x40};
+  v4 vec2 = {0x100000,  0x200,  0x30,  0x4};
+  do_shift (&vec, 4);
+  if (memcmp (&vec, &vec2, sizeof (v4)) != 0)
+    __builtin_abort ();
+  return 0;
+}

commit 483448a3af7067762c5b16b9bf1ebf2cc71238ff
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Thu Jun 12 10:07:37 2025 +0200

    Fix test case for PR117811 which failed for int < 32 bit.
    
            PR middle-end/117811
            PR testsuite/52641
    gcc/testsuite/
            * gcc.dg/torture/pr117811.c: Fix for int < 32 bit.
    
    (cherry picked from commit 07f229c2d7ee6b604e5a86092e675d5d36c1ba4e)

diff --git a/gcc/testsuite/gcc.dg/torture/pr117811.c b/gcc/testsuite/gcc.dg/torture/pr117811.c
index 13d7e134780..05e8622f25e 100644
--- a/gcc/testsuite/gcc.dg/torture/pr117811.c
+++ b/gcc/testsuite/gcc.dg/torture/pr117811.c
@@ -18,8 +18,13 @@ void __attribute__((noclone,noinline)) do_shift (v4 *vec, int shift)
 
 int main ()
 {
+#if __SIZEOF_INT__ >= 4
   v4 vec =  {0x1000000, 0x2000, 0x300, 0x40};
   v4 vec2 = {0x100000,  0x200,  0x30,  0x4};
+#else
+  v4 vec =  {0x4000, 0x2000, 0x300, 0x40};
+  v4 vec2 = {0x400,  0x200,  0x30,  0x4};
+#endif
   do_shift (&vec, 4);
   if (memcmp (&vec, &vec2, sizeof (v4)) != 0)
     __builtin_abort ();

commit f959e68be399a93399551734f629a7d2cd81f0b1
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sat Jun 14 00:22:56 2025 +0000

    Daily bump.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 96ccff31839..792b095b3a6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2025-06-13  Richard Earnshaw  <rearnsha@arm.com>
+
+	Backported from master:
+	2025-03-25  Richard Earnshaw  <rearnsha@arm.com>
+
+	PR middle-end/117811
+	* optabs.cc (expand_binop_directly): Remove LAST as an argument,
+	instead record the last insn on entry.  Only delete insns if
+	we need to restart and restart by calling ourself, not expand_binop.
+	(expand_binop): Update callers to expand_binop_directly.  If it
+	fails to expand the operation, delete back to LAST.
+
 2025-06-05  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* tree-vect-data-refs.cc (vect_can_force_dr_alignment_p): Return
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index c544224c344..b440a372cfd 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250613
+20250614
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 71d2d3780c4..25959114b4f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,20 @@
+2025-06-13  Georg-Johann Lay  <avr@gjlay.de>
+
+	Backported from master:
+	2025-06-12  Georg-Johann Lay  <avr@gjlay.de>
+
+	PR middle-end/117811
+	PR testsuite/52641
+	* gcc.dg/torture/pr117811.c: Fix for int < 32 bit.
+
+2025-06-13  Richard Earnshaw  <rearnsha@arm.com>
+
+	Backported from master:
+	2025-03-25  Richard Earnshaw  <rearnsha@arm.com>
+
+	PR middle-end/117811
+	* gcc.dg/torture/pr117811.c: New test.
+
 2025-06-05  Jason Merrill  <jason@redhat.com>
 
 	PR c++/120123

commit f54841209c8d8c315826ae67e678386279c8e98c
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sun Jun 15 00:21:25 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index b440a372cfd..caed742bd6e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250614
+20250615

commit f996fe08c00f06e557dbf550ef025303b73ac9d1
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Mon Jun 16 00:21:51 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index caed742bd6e..6597a2bbdbd 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250615
+20250616

commit a2ce1bc5daa299bd4a77f6015e67fb3ebbdb4c32
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Tue Jun 17 00:23:16 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 6597a2bbdbd..aaa22e3d56a 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250616
+20250617

commit 21f4d37c3132e5146cee92489f19956d62dd0585
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Wed Jun 18 00:25:03 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index aaa22e3d56a..016543e4365 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250617
+20250618

commit 2f167cfd3ddb790b9fac3e7f7691326457a0e1a5
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Thu Jun 19 00:24:50 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 016543e4365..2aac90aa126 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250618
+20250619

commit 5e0f1800bb38fbc985ce04749f0cfa67b104a8c8
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Fri Jun 20 00:24:25 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 2aac90aa126..48356deb7cf 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250619
+20250620

commit d14ce0869f4f00a935ca45792028aa88dede1759
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sat Jun 21 00:21:37 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 48356deb7cf..51152be9a3a 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250620
+20250621

commit 53653f79033e55697f3687416a61f059360a959c
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sun Jun 22 00:21:42 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 51152be9a3a..9ab4803a623 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250621
+20250622

commit 37d48f0052f2c628f814d46a8498570e7c234f4e
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Mon Jun 23 00:21:52 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 9ab4803a623..29fc2394183 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250622
+20250623

commit 5a461f4d76eb15ef951599ae9d18801cae5f2af1
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Tue Jun 24 00:22:00 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 29fc2394183..8bb1cc74550 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250623
+20250624

commit 5077dd49dcfdd70c50d9a29a2359c60bdfaf35ce
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Wed Jun 25 00:22:49 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 8bb1cc74550..9acd59f73a9 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250624
+20250625

commit b5bdebeca28e19422bbd4e48fa6fc50371520cfe
Author: Haochen Jiang <haochen.jiang@intel.com>
Date:   Tue Jun 17 14:08:38 2025 +0800

    i386: Remove CLDEMOTE for clients
    
    CLDEMOTE is not enabled on clients according to SDM. SDM only mentioned
    it will be enabled on Xeon and Atom servers, not clients. Remove them
    since Alder Lake (where it is introduced).
    
    gcc/ChangeLog:
    
            * config/i386/i386.h (PTA_ALDERLAKE): Use PTA_GOLDMONT_PLUS
            as base to remove PTA_CLDEMOTE.
            (PTA_SIERRAFOREST): Add PTA_CLDEMOTE since PTA_ALDERLAKE
            does not include that anymore.
            * doc/invoke.texi: Update texi file.

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index c147ff8732c..d147d373e8c 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2362,12 +2362,14 @@ constexpr wide_int_bitmask PTA_GOLDMONT_PLUS = PTA_GOLDMONT | PTA_RDPID
   | PTA_SGX | PTA_PTWRITE;
 constexpr wide_int_bitmask PTA_TREMONT = PTA_GOLDMONT_PLUS | PTA_CLWB
   | PTA_GFNI | PTA_MOVDIRI | PTA_MOVDIR64B | PTA_CLDEMOTE | PTA_WAITPKG;
-constexpr wide_int_bitmask PTA_ALDERLAKE = PTA_TREMONT | PTA_ADX | PTA_AVX
+constexpr wide_int_bitmask PTA_ALDERLAKE = PTA_GOLDMONT_PLUS | PTA_CLWB
+  | PTA_GFNI | PTA_MOVDIRI | PTA_MOVDIR64B | PTA_WAITPKG | PTA_ADX | PTA_AVX
   | PTA_AVX2 | PTA_BMI | PTA_BMI2 | PTA_F16C | PTA_FMA | PTA_LZCNT
   | PTA_PCONFIG | PTA_PKU | PTA_VAES | PTA_VPCLMULQDQ | PTA_SERIALIZE
   | PTA_HRESET | PTA_KL | PTA_WIDEKL | PTA_AVXVNNI;
-constexpr wide_int_bitmask PTA_SIERRAFOREST = PTA_ALDERLAKE | PTA_AVXIFMA
-  | PTA_AVXVNNIINT8 | PTA_AVXNECONVERT | PTA_CMPCCXADD | PTA_ENQCMD | PTA_UINTR;
+constexpr wide_int_bitmask PTA_SIERRAFOREST = PTA_ALDERLAKE | PTA_CLDEMOTE
+  | PTA_AVXIFMA | PTA_AVXVNNIINT8 | PTA_AVXNECONVERT | PTA_CMPCCXADD
+  | PTA_ENQCMD | PTA_UINTR;
 constexpr wide_int_bitmask PTA_GRANITERAPIDS = PTA_SAPPHIRERAPIDS | PTA_AMX_FP16
   | PTA_PREFETCHI;
 constexpr wide_int_bitmask PTA_GRANITERAPIDS_D = PTA_GRANITERAPIDS
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index b80966e1353..00d2e4950a3 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -32565,11 +32565,11 @@ VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
 @item alderlake
 @itemx raptorlake
 @itemx meteorlake
-Intel Alder Lake/Raptor Lake/Meteor Lake CPU with 64-bit extensions, MOVBE, MMX,
-SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND,
-XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB,
-MOVDIRI, MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
-LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and
+Intel Alder Lake/Raptor Lake/Meteor Lake CPU with 64-bit extensions, MOVBE,
+MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL,
+RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX,
+GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C,
+FMA, LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and
 AVX-VNNI instruction set support.
 
 @item sapphirerapids

commit 2abf837326e4ab1d92867b77922103c58a618057
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Thu Jun 26 00:23:21 2025 +0000

    Daily bump.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 792b095b3a6..ec25c301c98 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2025-06-25  Haochen Jiang  <haochen.jiang@intel.com>
+
+	* config/i386/i386.h (PTA_ALDERLAKE): Use PTA_GOLDMONT_PLUS
+	as base to remove PTA_CLDEMOTE.
+	(PTA_SIERRAFOREST): Add PTA_CLDEMOTE since PTA_ALDERLAKE
+	does not include that anymore.
+	* doc/invoke.texi: Update texi file.
+
 2025-06-13  Richard Earnshaw  <rearnsha@arm.com>
 
 	Backported from master:
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 9acd59f73a9..efcd83eefd6 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250625
+20250626

commit 493cddb125c165e5882d274a7a2bfb3cdd171fcf
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Fri Jun 27 00:23:47 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index efcd83eefd6..b128998250b 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250626
+20250627

commit 2666791289e679bc48de67d9546783c07cc65f30
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Jun 27 23:47:49 2025 +0200

    Fix misoptimization of CONSTRUCTOR with reverse SSO
    
    fold_ctor_reference already punts on a CONSTRUCTOR whose type has reverse
    storage order, but it can be invoked in a couple of places on a CONSTRUCTOR
    with native storage order that has been wrapped in a VIEW_CONVERT_EXPR to a
    type with reverse storage order; this would require a post adjustment that
    does not currently exist, thus yield wrong code for this admittedly quite
    pathological (but supported) case.
    
    gcc/
            * gimple-fold.cc (fold_const_aggregate_ref_1) <COMPONENT_REF>:
            Bail out immediately if the reference has reverse storage order.
            * tree-ssa-sccvn.cc (fully_constant_vn_reference_p): Likewise.
    gcc/testsuite/
            * gnat.dg/sso20.adb: New test.

diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 180817cc868..1387e03d92b 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -8339,19 +8339,21 @@ fold_const_aggregate_ref_1 (tree t, tree (*valueize) (tree))
       base = get_ref_base_and_extent (t, &offset, &size, &max_size, &reverse);
       ctor = get_base_constructor (base, &offset, valueize);
 
+      /* We cannot determine ctor.  */
+      if (!ctor)
+	return NULL_TREE;
       /* Empty constructor.  Always fold to 0.  */
       if (ctor == error_mark_node)
 	return build_zero_cst (TREE_TYPE (t));
-      /* We do not know precise address.  */
+      /* We do not know precise access.  */
       if (!known_size_p (max_size) || maybe_ne (max_size, size))
 	return NULL_TREE;
-      /* We cannot determine ctor.  */
-      if (!ctor)
-	return NULL_TREE;
-
       /* Out of bound array access.  Value is undefined, but don't fold.  */
       if (maybe_lt (offset, 0))
 	return NULL_TREE;
+      /* Access with reverse storage order.  */
+      if (reverse)
+	return NULL_TREE;
 
       tem = fold_ctor_reference (TREE_TYPE (t), ctor, offset, size, base);
       if (tem)
@@ -8371,7 +8373,6 @@ fold_const_aggregate_ref_1 (tree t, tree (*valueize) (tree))
 	      && offset.is_constant (&coffset)
 	      && (coffset % BITS_PER_UNIT != 0
 		  || csize % BITS_PER_UNIT != 0)
-	      && !reverse
 	      && BYTES_BIG_ENDIAN == WORDS_BIG_ENDIAN)
 	    {
 	      poly_int64 bitoffset;
diff --git a/gcc/testsuite/gnat.dg/sso20.adb b/gcc/testsuite/gnat.dg/sso20.adb
new file mode 100644
index 00000000000..34980d35d87
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/sso20.adb
@@ -0,0 +1,29 @@
+--  { dg-do run }
+--  { dg-options "-O" }
+
+with Ada.Unchecked_Conversion;
+with Interfaces;  use Interfaces;
+with System;      use System;
+
+procedure SSO20 is
+
+  type Bytes_Ref is array (1 .. 4) of Unsigned_8
+    with Convention => Ada_Pass_By_Reference;
+
+  type U32_BE is record
+    Value : Unsigned_32;
+  end record
+    with
+      Pack,
+      Bit_Order            => High_Order_First,
+      Scalar_Storage_Order => High_Order_First;
+
+  function Conv is new Ada.Unchecked_Conversion (Bytes_Ref, U32_BE);
+
+  function Value (B : Bytes_Ref) return Unsigned_32 is (Conv (B).Value);
+
+begin
+  if Value ((16#11#, 16#22#, 16#33#, 16#44#)) /= 16#11223344# then
+     raise Program_Error;
+  end if;
+end;
diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index a526268e078..68b0bdce4e9 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -1576,6 +1576,8 @@ fully_constant_vn_reference_p (vn_reference_t ref)
 	      ++i;
 	      break;
 	    }
+	  if (operands[i].reverse)
+	    return NULL_TREE;
 	  if (known_eq (operands[i].off, -1))
 	    return NULL_TREE;
 	  off += operands[i].off;

commit 059c1fc72b4bfdc94855fe47909b3cf95532f344
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sat Jun 28 00:24:56 2025 +0000

    Daily bump.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ec25c301c98..c53f6d099ac 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2025-06-27  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* gimple-fold.cc (fold_const_aggregate_ref_1) <COMPONENT_REF>:
+	Bail out immediately if the reference has reverse storage order.
+	* tree-ssa-sccvn.cc (fully_constant_vn_reference_p): Likewise.
+
 2025-06-25  Haochen Jiang  <haochen.jiang@intel.com>
 
 	* config/i386/i386.h (PTA_ALDERLAKE): Use PTA_GOLDMONT_PLUS
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index b128998250b..89bcad6c215 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250627
+20250628
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 25959114b4f..a4c7e7bbf26 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2025-06-27  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* gnat.dg/sso20.adb: New test.
+
 2025-06-13  Georg-Johann Lay  <avr@gjlay.de>
 
 	Backported from master:

commit b9706f3db53ccf6d2ed24f140764a400fc2fe2a3
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sun Jun 29 00:22:06 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 89bcad6c215..b64dbd127a1 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250628
+20250629

commit 5a615fb45c04ecbd975435d7440f0184604f8161
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Mon Jun 30 00:22:09 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index b64dbd127a1..258e00165ab 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250629
+20250630

commit bb3d60928330ff3ae2ccf2cb8784319f6f268e28
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Tue Jul 1 00:22:46 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 258e00165ab..ac92899c888 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250630
+20250701

commit 04a71a35c3d0b69473fb82559a579f25740e07c5
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Wed Jul 2 00:22:26 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index ac92899c888..46e9463b427 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250701
+20250702

commit ae837b65aedde7a61c0be041e6ecd106e9ad9e1f
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Thu Jul 3 00:21:25 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 46e9463b427..695297928f6 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250702
+20250703

commit 78ce4720d13b3e82a4c718880a9ca9f0e955cf7e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jul 1 15:28:10 2025 +0200

    c++: Fix up cp_build_array_ref COND_EXPR handling [PR120471]
    
    The following testcase is miscompiled since the introduction of UBSan,
    cp_build_array_ref COND_EXPR handling replaces
    (cond ? a : b)[idx] with cond ? a[idx] : b[idx], but if there are
    SAVE_EXPRs inside of idx, they will be evaluated just in one of the
    branches and the other uses uninitialized temporaries.
    
    Fixed by keeping doing what it did if idx doesn't have side effects
    and is invariant.  Otherwise if op1/op2 are ARRAY_TYPE arrays with
    invariant addresses or pointers with invariant values, use
    SAVE_EXPR <op0>, SAVE_EXPR <idx>, SAVE_EXPR <op0> as a new condition
    and SAVE_EXPR <idx> instead of idx for the recursive calls.
    Otherwise punt, but if op1/op2 are ARRAY_TYPE, furthermore call
    cp_default_conversion on array, so that COND_EXPR with ARRAY_TYPE doesn't
    survive in the IL until expansion.
    
    2025-07-01  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/120471
    gcc/cp/
            * typeck.cc (cp_build_array_ref) <case COND_EXPR>: If idx is not
            INTEGER_CST, don't optimize the case (but cp_default_conversion on
            array early if it has ARRAY_TYPE) or use
            SAVE_EXPR <op0>, SAVE_EXPR <idx>, SAVE_EXPR <op0> as new op0 depending
            on flag_strong_eval_order and whether op1 and op2 are arrays with
            invariant address or tree invariant pointers.  Formatting fixes.
    gcc/testsuite/
            * g++.dg/ubsan/pr120471.C: New test.
            * g++.dg/parse/pr120471.C: New test.
    
    (cherry picked from commit 988e87b66882875b14a6cab11c17516863c74a63)

diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index e3bf1c53a9e..38df8d8e6c2 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -3961,13 +3961,129 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
       }
 
     case COND_EXPR:
-      ret = build_conditional_expr
-	       (loc, TREE_OPERAND (array, 0),
-	       cp_build_array_ref (loc, TREE_OPERAND (array, 1), idx,
-				   complain),
-	       cp_build_array_ref (loc, TREE_OPERAND (array, 2), idx,
-				   complain),
-	       complain);
+      tree op0, op1, op2;
+      op0 = TREE_OPERAND (array, 0);
+      op1 = TREE_OPERAND (array, 1);
+      op2 = TREE_OPERAND (array, 1);
+      if (TREE_SIDE_EFFECTS (idx) || !tree_invariant_p (idx))
+	{
+	  /* If idx could possibly have some SAVE_EXPRs, turning
+	     (op0 ? op1 : op2)[idx] into
+	     op0 ? op1[idx] : op2[idx] can lead into temporaries
+	     initialized in one conditional path and uninitialized
+	     uses of them in the other path.
+	     And if idx is a really large expression, evaluating it
+	     twice is also not optimal.
+	     On the other side, op0 must be sequenced before evaluation
+	     of op1 and op2 and for C++17 op0, op1 and op2 must be
+	     sequenced before idx.
+	     If idx is INTEGER_CST, we can just do the optimization
+	     without any SAVE_EXPRs, if op1 and op2 are both ARRAY_TYPE
+	     VAR_DECLs or COMPONENT_REFs thereof (so their address
+	     is constant or relative to frame), optimize into
+	     (SAVE_EXPR <op0>, SAVE_EXPR <idx>, SAVE_EXPR <op0>)
+	     ? op1[SAVE_EXPR <idx>] : op2[SAVE_EXPR <idx>]
+	     Otherwise avoid this optimization.  */
+	  if (flag_strong_eval_order == 2)
+	    {
+	      if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE)
+		{
+		  tree xop1 = op1;
+		  tree xop2 = op2;
+		  while (xop1 && handled_component_p (xop1))
+		    {
+		      switch (TREE_CODE (xop1))
+			{
+			case ARRAY_REF:
+			case ARRAY_RANGE_REF:
+			  if (!tree_invariant_p (TREE_OPERAND (xop1, 1))
+			      || TREE_OPERAND (xop1, 2) != NULL_TREE
+			      || TREE_OPERAND (xop1, 3) != NULL_TREE)
+			    {
+			      xop1 = NULL_TREE;
+			      continue;
+			    }
+			  break;
+
+			case COMPONENT_REF:
+			  if (TREE_OPERAND (xop1, 2) != NULL_TREE)
+			    {
+			      xop1 = NULL_TREE;
+			      continue;
+			    }
+			  break;
+
+			default:
+			  break;
+			}
+		      xop1 = TREE_OPERAND (xop1, 0);
+		    }
+		  if (xop1)
+		    STRIP_ANY_LOCATION_WRAPPER (xop1);
+		  while (xop2 && handled_component_p (xop2))
+		    {
+		      switch (TREE_CODE (xop2))
+			{
+			case ARRAY_REF:
+			case ARRAY_RANGE_REF:
+			  if (!tree_invariant_p (TREE_OPERAND (xop2, 1))
+			      || TREE_OPERAND (xop2, 2) != NULL_TREE
+			      || TREE_OPERAND (xop2, 3) != NULL_TREE)
+			    {
+			      xop2 = NULL_TREE;
+			      continue;
+			    }
+			  break;
+
+			case COMPONENT_REF:
+			  if (TREE_OPERAND (xop2, 2) != NULL_TREE)
+			    {
+			      xop2 = NULL_TREE;
+			      continue;
+			    }
+			  break;
+
+			default:
+			  break;
+			}
+		      xop2 = TREE_OPERAND (xop2, 0);
+		    }
+		  if (xop2)
+		    STRIP_ANY_LOCATION_WRAPPER (xop2);
+
+		  if (!xop1
+		      || !xop2
+		      || !(CONSTANT_CLASS_P (xop1)
+			   || decl_address_invariant_p (xop1))
+		      || !(CONSTANT_CLASS_P (xop2)
+			   || decl_address_invariant_p (xop2)))
+		    {
+		      /* Force default conversion on array if
+			 we can't optimize this and array is ARRAY_TYPE
+			 COND_EXPR, we can't leave COND_EXPRs with
+			 ARRAY_TYPE in the IL.  */
+		      array = cp_default_conversion (array, complain);
+		      if (error_operand_p (array))
+			return error_mark_node;
+		      break;
+		    }
+		}
+	      else if (!POINTER_TYPE_P (TREE_TYPE (array))
+		       || !tree_invariant_p (op1)
+		       || !tree_invariant_p (op2))
+		break;
+	    }
+	  if (TREE_SIDE_EFFECTS (idx))
+	    {
+	      idx = save_expr (idx);
+	      op0 = save_expr (op0);
+	      tree tem = build_compound_expr (loc, op0, idx);
+	      op0 = build_compound_expr (loc, tem, op0);
+	    }
+	}
+      op1 = cp_build_array_ref (loc, op1, idx, complain);
+      op2 = cp_build_array_ref (loc, op2, idx, complain);
+      ret = build_conditional_expr (loc, op0, op1, op2, complain);
       protected_set_expr_location (ret, loc);
       return ret;
 
diff --git a/gcc/testsuite/g++.dg/parse/pr120471.C b/gcc/testsuite/g++.dg/parse/pr120471.C
new file mode 100644
index 00000000000..ad47e380404
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/pr120471.C
@@ -0,0 +1,42 @@
+// PR c++/120471
+// { dg-do compile }
+
+extern int a1[], a2[], a3[], a4[];
+
+int corge (int);
+
+int
+foo (int p)
+{
+  return (p ? a1 : a2)[1];
+}
+
+int
+bar (int p, int q)
+{
+  return (p ? a1 : a2)[q];
+}
+
+int
+garply (int p, int q)
+{
+  return (p ? a1 : a2)[corge (q)];
+}
+
+int
+baz (int p, int q)
+{
+  return (p ? q ? a1 : a2 : q ? a3 : a4)[1];
+}
+
+int
+qux (int p, int q, int r)
+{
+  return (p ? q ? a1 : a2 : q ? a3 : a4)[r];
+}
+
+int
+fred (int p, int q, int r)
+{
+  return (p ? q ? a1 : a2 : q ? a3 : a4)[corge (r)];
+}
diff --git a/gcc/testsuite/g++.dg/ubsan/pr120471.C b/gcc/testsuite/g++.dg/ubsan/pr120471.C
new file mode 100644
index 00000000000..31b781f9aa7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ubsan/pr120471.C
@@ -0,0 +1,21 @@
+// PR c++/120471
+// { dg-do run }
+// { dg-options "-fsanitize=undefined" }
+
+volatile int b[1], a[1];
+
+void
+foo (int x)
+{
+  volatile int c = 21;
+  volatile int v = (x % 2 ? b : a)[c % 3];
+  if (v != 0)
+    __builtin_abort ();
+}
+
+int
+main ()
+{
+  foo (1);
+  foo (2);
+}

commit 73b173d915f9bbcfd751cefd2bdb1ab690f0b2fc
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri May 2 01:30:56 2025 +0200

    ada: Fix missing error on too large Component_Size not multiple of storage unit
    
    This is a small regression introduced a few years ago.
    
    gcc/ada/ChangeLog:
    
            * gcc-interface/decl.cc (gnat_to_gnu_component_type): Validate the
            Component_Size like the size of a type only if the component type
            is actually packed.

diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 3505723acc4..df93871600e 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -5277,7 +5277,7 @@ gnat_to_gnu_component_type (Entity_Id gnat_array, bool definition,
   const bool is_bit_packed = Is_Bit_Packed_Array (gnat_array);
   tree gnu_type = gnat_to_gnu_type (gnat_type);
   tree gnu_comp_size;
-  bool has_packed_components;
+  bool has_packed_component;
   unsigned int max_align;
 
   /* If an alignment is specified, use it as a cap on the component type
@@ -5298,16 +5298,22 @@ gnat_to_gnu_component_type (Entity_Id gnat_array, bool definition,
       && !TYPE_FAT_POINTER_P (gnu_type)
       && tree_fits_uhwi_p (TYPE_SIZE (gnu_type)))
     {
-      gnu_type = make_packable_type (gnu_type, false, max_align);
-      has_packed_components = true;
+      tree gnu_packable_type = make_packable_type (gnu_type, false, max_align);
+      if (gnu_packable_type != gnu_type)
+	{
+	  gnu_type = gnu_packable_type;
+	  has_packed_component = true;
+	}
+      else
+	has_packed_component = false;
     }
   else
-    has_packed_components = is_bit_packed;
+    has_packed_component = is_bit_packed;
 
   /* Get and validate any specified Component_Size.  */
   gnu_comp_size
     = validate_size (Component_Size (gnat_array), gnu_type, gnat_array,
-		     has_packed_components ? TYPE_DECL : VAR_DECL, true,
+		     has_packed_component ? TYPE_DECL : VAR_DECL, true,
 		     Has_Component_Size_Clause (gnat_array), NULL, NULL);
 
   /* If the component type is a RECORD_TYPE that has a self-referential size,

commit f3689dc2061481fa789dbf7b6ab55a8e5f52f198
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jul 3 22:39:39 2025 +0200

    c++: Fix a pasto in the PR120471 fix [PR120940]
    
    No idea how this slipped in, I'm terribly sorry.
    Strangely nothing in the testsuite has caught this, so I've added
    a new test for that.
    
    2025-07-03  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/120940
            * typeck.cc (cp_build_array_ref): Fix a pasto.
    
            * g++.dg/parse/pr120940.C: New test.
            * g++.dg/warn/Wduplicated-branches9.C: New test.
    
    (cherry picked from commit dc90649466a54ab61926d88500a05f59a55cb055)

diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 38df8d8e6c2..61d716e2a0e 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -3964,7 +3964,7 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
       tree op0, op1, op2;
       op0 = TREE_OPERAND (array, 0);
       op1 = TREE_OPERAND (array, 1);
-      op2 = TREE_OPERAND (array, 1);
+      op2 = TREE_OPERAND (array, 2);
       if (TREE_SIDE_EFFECTS (idx) || !tree_invariant_p (idx))
 	{
 	  /* If idx could possibly have some SAVE_EXPRs, turning
diff --git a/gcc/testsuite/g++.dg/parse/pr120940.C b/gcc/testsuite/g++.dg/parse/pr120940.C
new file mode 100644
index 00000000000..5da36b2f88a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/pr120940.C
@@ -0,0 +1,18 @@
+// PR c++/120940
+// { dg-do run }
+
+int a[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
+int b[8] = { 9, 10, 11, 12, 13, 14, 15, 16 };
+
+__attribute__((noipa)) int
+foo (int x, int y)
+{
+  return (x ? a : b)[y];
+}
+
+int
+main ()
+{
+  if (foo (1, 4) != 5 || foo (0, 6) != 15)
+    __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wduplicated-branches9.C b/gcc/testsuite/g++.dg/warn/Wduplicated-branches9.C
new file mode 100644
index 00000000000..f9fafcd467b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wduplicated-branches9.C
@@ -0,0 +1,11 @@
+// PR c++/120940
+// { dg-do compile }
+// { dg-options "-Wduplicated-branches" }
+
+static char a[16][8], b[16][8];
+
+char *
+foo (int x, int y)
+{
+  return (x ? a : b)[y];
+}

commit 4ee8d2aea70da26217a2b2af4172396e5c8e6ec5
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Fri Jul 4 00:22:03 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 695297928f6..f38cdfd1ac9 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250703
+20250704
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index cfb2a444b5a..d33354757e8 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2025-07-03  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* gcc-interface/decl.cc (gnat_to_gnu_component_type): Validate the
+	Component_Size like the size of a type only if the component type
+	is actually packed.
+
 2025-06-05  Release Manager
 
 	* GCC 13.4.0 released.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 40aa436c2f1..2bc9112c42c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,24 @@
+2025-07-03  Jakub Jelinek  <jakub@redhat.com>
+
+	Backported from master:
+	2025-07-03  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c++/120940
+	* typeck.cc (cp_build_array_ref): Fix a pasto.
+
+2025-07-03  Jakub Jelinek  <jakub@redhat.com>
+
+	Backported from master:
+	2025-07-01  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c++/120471
+	* typeck.cc (cp_build_array_ref) <case COND_EXPR>: If idx is not
+	INTEGER_CST, don't optimize the case (but cp_default_conversion on
+	array early if it has ARRAY_TYPE) or use
+	SAVE_EXPR <op0>, SAVE_EXPR <idx>, SAVE_EXPR <op0> as new op0 depending
+	on flag_strong_eval_order and whether op1 and op2 are arrays with
+	invariant address or tree invariant pointers.  Formatting fixes.
+
 2025-06-05  Jason Merrill  <jason@redhat.com>
 
 	PR c++/120123
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a4c7e7bbf26..f30b113405a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,21 @@
+2025-07-03  Jakub Jelinek  <jakub@redhat.com>
+
+	Backported from master:
+	2025-07-03  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c++/120940
+	* g++.dg/parse/pr120940.C: New test.
+	* g++.dg/warn/Wduplicated-branches9.C: New test.
+
+2025-07-03  Jakub Jelinek  <jakub@redhat.com>
+
+	Backported from master:
+	2025-07-01  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c++/120471
+	* g++.dg/ubsan/pr120471.C: New test.
+	* g++.dg/parse/pr120471.C: New test.
+
 2025-06-27  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* gnat.dg/sso20.adb: New test.

commit 2f343e62273bf4d6bdc345659fc61e9db210303d
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sat Jul 5 00:22:25 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index f38cdfd1ac9..93909f8b31a 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250704
+20250705

commit 446c106a1a2ad5045cd169cc014852900d833ba3
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sun Jul 6 00:22:36 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 93909f8b31a..0f0154fadad 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250705
+20250706

commit 41e178f1433a898e3286a995ac385e6279813c3c
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Mon Jul 7 00:22:09 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 0f0154fadad..d4353d1e2c9 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250706
+20250707

commit 52ae7280a1ce7b73a40d3a6fa1c5fed0a7cdc373
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Tue Jul 8 00:22:58 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index d4353d1e2c9..7475f8cf1b4 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250707
+20250708

commit a8db23fb140622879d96ae9b82f0a8362d94be6a
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Wed Jul 9 00:24:15 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 7475f8cf1b4..fc3b54747ad 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250708
+20250709

commit 8e746cc4666f1471dcb28a65a233c9a519edf913
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Thu Jul 10 00:23:29 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index fc3b54747ad..12032cec602 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250709
+20250710

commit e1bbd77b55865604ca856bdb3cd6a4a83143906e
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Fri Jul 11 00:22:30 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 12032cec602..26b40b2ae3e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250710
+20250711

commit d3acb727b8f4beee40b000ba94e60b1a88fa30e2
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sat Jul 12 00:22:25 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 26b40b2ae3e..e177aad4afb 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250711
+20250712

commit f5464d4a3f246711820fc79932690a9940ad021e
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sun Jul 13 00:27:40 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index e177aad4afb..7bcb4c48a18 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250712
+20250713

commit dde6cbb234acbd854c0297a200d4afc70184a447
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Mon Jul 14 00:20:04 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 7bcb4c48a18..eaad3526d83 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250713
+20250714

commit c8daa32ac81e54c02336aa7cf40f4e34ae26ec09
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Tue Jul 15 00:20:49 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index eaad3526d83..5c2a452f007 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250714
+20250715

commit 6d5023f28a019c70e32614536658ad608b4531e3
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Wed Jul 16 00:19:24 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 5c2a452f007..c02c887d37e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250715
+20250716

commit 97454afb368f79783e99eafee009c88aa4e16845
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Thu Jul 17 00:19:54 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index c02c887d37e..fc3196f0a51 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250716
+20250717

commit 536ed87cfb3a1453730411f217fa119b87ffaf90
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jul 1 17:17:06 2025 +0800

    x86-64: Add RDI clobber to tls_global_dynamic_64 patterns
    
    *tls_global_dynamic_64_<mode> uses RDI as the __tls_get_addr argument.
    Add RDI clobber to tls_global_dynamic_64 patterns to show it.
    
            PR target/120908
            * config/i386/i386.cc (legitimize_tls_address): Pass RDI to
            gen_tls_global_dynamic_64.
            * config/i386/i386.md (*tls_global_dynamic_64_<mode>): Add RDI
            clobber and use it to generate LEA.
            (@tls_global_dynamic_64_<mode>): Add a clobber.
    
    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
    (cherry picked from commit 7710d513a552f1fa1b7485ec6b318bafaa6d4cd7)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 395eeab7006..4761b4272ff 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -11601,11 +11601,12 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
 	  if (TARGET_64BIT)
 	    {
 	      rtx rax = gen_rtx_REG (Pmode, AX_REG);
+	      rtx rdi = gen_rtx_REG (Pmode, DI_REG);
 	      rtx_insn *insns;
 
 	      start_sequence ();
 	      emit_call_insn
-		(gen_tls_global_dynamic_64 (Pmode, rax, x, caddr));
+		(gen_tls_global_dynamic_64 (Pmode, rax, x, caddr, rdi));
 	      insns = get_insns ();
 	      end_sequence ();
 
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index d8419670dc7..3974d6cafe3 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -18621,7 +18621,8 @@
 	 (match_operand 3)))
    (unspec:P [(match_operand 1 "tls_symbolic_operand")
 	      (reg:P SP_REG)]
-	     UNSPEC_TLS_GD)]
+	     UNSPEC_TLS_GD)
+   (clobber (match_operand:P 4 "register_operand" "=D"))]
   "TARGET_64BIT"
 {
   if (!TARGET_X32)
@@ -18638,7 +18639,7 @@
        Use data16 prefix instead, which doesn't have this problem.  */
     fputs ("\tdata16", asm_out_file);
   output_asm_insn
-    ("lea{q}\t{%E1@tlsgd(%%rip), %%rdi|rdi, %E1@tlsgd[rip]}", operands);
+    ("lea{q}\t{%E1@tlsgd(%%rip), %q4|%q4, %E1@tlsgd[rip]}", operands);
   if (TARGET_SUN_TLS || flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT)
     fputs (ASM_SHORT "0x6666\n", asm_out_file);
   else
@@ -18685,7 +18686,8 @@
 	   (const_int 0)))
      (unspec:P [(match_operand 1 "tls_symbolic_operand")
 		(reg:P SP_REG)]
-	       UNSPEC_TLS_GD)])]
+	       UNSPEC_TLS_GD)
+     (clobber (match_operand:P 3 "register_operand"))])]
   "TARGET_64BIT"
   "ix86_tls_descriptor_calls_expanded_in_cfun = true;")
 

commit 7e6a220b18df8ef13dde7c19407f4341ff16f091
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jul 3 10:54:39 2025 +0800

    x86-64: Add RDI clobber to 64-bit dynamic TLS patterns
    
    *tls_global_dynamic_64_largepic, *tls_local_dynamic_64_<mode> and
    *tls_local_dynamic_base_64_largepic use RDI as the __tls_get_addr
    argument.  Add RDI clobber to these patterns to show it.
    
    gcc/
    
            PR target/120908
            * config/i386/i386.cc (legitimize_tls_address): Pass RDI to
            gen_tls_local_dynamic_64.
            * config/i386/i386.md (*tls_global_dynamic_64_largepic): Add
            RDI clobber and use it to generate LEA.
            (*tls_local_dynamic_64_<mode>): Likewise.
            (*tls_local_dynamic_base_64_largepic): Likewise.
            (@tls_local_dynamic_64_<mode>): Add a clobber.
    
    gcc/testsuite/
    
            PR target/120908
            * gcc.target/i386/pr120908.c: New test.
    
    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
    (cherry picked from commit d8d5e2a8031e74f08f61ccdd727476f97940c5a6)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 4761b4272ff..a72e1da904f 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -11656,12 +11656,13 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
 	  if (TARGET_64BIT)
 	    {
 	      rtx rax = gen_rtx_REG (Pmode, AX_REG);
+	      rtx rdi = gen_rtx_REG (Pmode, DI_REG);
 	      rtx_insn *insns;
 	      rtx eqv;
 
 	      start_sequence ();
 	      emit_call_insn
-		(gen_tls_local_dynamic_base_64 (Pmode, rax, caddr));
+		(gen_tls_local_dynamic_base_64 (Pmode, rax, caddr, rdi));
 	      insns = get_insns ();
 	      end_sequence ();
 
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 3974d6cafe3..0965b2a554c 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -18663,14 +18663,15 @@
 	 (match_operand 4)))
    (unspec:DI [(match_operand 1 "tls_symbolic_operand")
 	       (reg:DI SP_REG)]
-	      UNSPEC_TLS_GD)]
+	      UNSPEC_TLS_GD)
+   (clobber (match_operand:DI 5 "register_operand" "=D"))]
   "TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF
    && GET_CODE (operands[3]) == CONST
    && GET_CODE (XEXP (operands[3], 0)) == UNSPEC
    && XINT (XEXP (operands[3], 0), 1) == UNSPEC_PLTOFF"
 {
   output_asm_insn
-    ("lea{q}\t{%E1@tlsgd(%%rip), %%rdi|rdi, %E1@tlsgd[rip]}", operands);
+    ("lea{q}\t{%E1@tlsgd(%%rip), %5|%5, %E1@tlsgd[rip]}", operands);
   output_asm_insn ("movabs{q}\t{%3, %%rax|rax, %3}", operands);
   output_asm_insn ("add{q}\t{%2, %%rax|rax, %2}", operands);
   return "call\t{*%%rax|rax}";
@@ -18738,11 +18739,12 @@
 	(call:P
 	 (mem:QI (match_operand 1 "constant_call_address_operand" "Bz"))
 	 (match_operand 2)))
-   (unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE)]
+   (unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE)
+   (clobber (match_operand:P 3 "register_operand" "=D"))]
   "TARGET_64BIT"
 {
   output_asm_insn
-    ("lea{q}\t{%&@tlsld(%%rip), %%rdi|rdi, %&@tlsld[rip]}", operands);
+    ("lea{q}\t{%&@tlsld(%%rip), %q3|%q3, %&@tlsld[rip]}", operands);
   if (TARGET_SUN_TLS)
     return "call\t%p1@plt";
   if (flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT)
@@ -18758,14 +18760,15 @@
 	 (mem:QI (plus:DI (match_operand:DI 1 "register_operand" "b")
 			  (match_operand:DI 2 "immediate_operand" "i")))
 	 (match_operand 3)))
-   (unspec:DI [(reg:DI SP_REG)] UNSPEC_TLS_LD_BASE)]
+   (unspec:DI [(reg:DI SP_REG)] UNSPEC_TLS_LD_BASE)
+   (clobber (match_operand:DI 4 "register_operand" "=D"))]
   "TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF
    && GET_CODE (operands[2]) == CONST
    && GET_CODE (XEXP (operands[2], 0)) == UNSPEC
    && XINT (XEXP (operands[2], 0), 1) == UNSPEC_PLTOFF"
 {
   output_asm_insn
-    ("lea{q}\t{%&@tlsld(%%rip), %%rdi|rdi, %&@tlsld[rip]}", operands);
+    ("lea{q}\t{%&@tlsld(%%rip), %4|%4, %&@tlsld[rip]}", operands);
   output_asm_insn ("movabs{q}\t{%2, %%rax|rax, %2}", operands);
   output_asm_insn ("add{q}\t{%1, %%rax|rax, %1}", operands);
   return "call\t{*%%rax|rax}";
@@ -18779,7 +18782,8 @@
 	   (call:P
 	    (mem:QI (match_operand 1))
 	    (const_int 0)))
-      (unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE)])]
+      (unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE)
+      (clobber (match_operand:P 2 "register_operand"))])]
   "TARGET_64BIT"
   "ix86_tls_descriptor_calls_expanded_in_cfun = true;")
 
diff --git a/gcc/testsuite/gcc.target/i386/pr120908.c b/gcc/testsuite/gcc.target/i386/pr120908.c
new file mode 100644
index 00000000000..10e5a46d8d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr120908.c
@@ -0,0 +1,16 @@
+/* { dg-do compile { target { lp64 && fpic } } } */
+/* { dg-options "-O2 -fpic -mtls-dialect=gnu -mcmodel=large" } */
+
+extern __thread long bar1;
+long *
+foo1 (void)
+{
+  return &bar1;
+}
+
+static __thread long bar2;
+long *
+foo2 (void)
+{
+  return &bar2;
+}

commit 141089a8db8316b45de332d1a6377b0965ca361f
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Fri Jul 18 00:20:49 2025 +0000

    Daily bump.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c53f6d099ac..461cef09df4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,29 @@
+2025-07-17  H.J. Lu  <hjl.tools@gmail.com>
+
+	Backported from master:
+	2025-07-03  H.J. Lu  <hjl.tools@gmail.com>
+
+	PR target/120908
+	* config/i386/i386.cc (legitimize_tls_address): Pass RDI to
+	gen_tls_local_dynamic_64.
+	* config/i386/i386.md (*tls_global_dynamic_64_largepic): Add
+	RDI clobber and use it to generate LEA.
+	(*tls_local_dynamic_64_<mode>): Likewise.
+	(*tls_local_dynamic_base_64_largepic): Likewise.
+	(@tls_local_dynamic_64_<mode>): Add a clobber.
+
+2025-07-17  H.J. Lu  <hjl.tools@gmail.com>
+
+	Backported from master:
+	2025-07-02  H.J. Lu  <hjl.tools@gmail.com>
+
+	PR target/120908
+	* config/i386/i386.cc (legitimize_tls_address): Pass RDI to
+	gen_tls_global_dynamic_64.
+	* config/i386/i386.md (*tls_global_dynamic_64_<mode>): Add RDI
+	clobber and use it to generate LEA.
+	(@tls_global_dynamic_64_<mode>): Add a clobber.
+
 2025-06-27  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* gimple-fold.cc (fold_const_aggregate_ref_1) <COMPONENT_REF>:
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index fc3196f0a51..9866b70f901 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250717
+20250718
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f30b113405a..0bf0491fca3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2025-07-17  H.J. Lu  <hjl.tools@gmail.com>
+
+	Backported from master:
+	2025-07-03  H.J. Lu  <hjl.tools@gmail.com>
+
+	PR target/120908
+	* gcc.target/i386/pr120908.c: New test.
+
 2025-07-03  Jakub Jelinek  <jakub@redhat.com>
 
 	Backported from master:

commit 9f1660e64e9de91ea96176c07caf18d1a6fff0d9
Author: GCC Administrator <gccadmin@gcc.gnu.org>
Date:   Sat Jul 19 00:22:32 2025 +0000

    Daily bump.

diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 9866b70f901..c64e4865ca8 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250718
+20250719
