[gcc-7] 302/354: * Update to SVN 20170923 (r253114) from the gcc-7-branch.

Ximin Luo infinity0 at debian.org
Thu Nov 23 15:51:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository gcc-7.

commit 90a7a984b373e4ee3e0970af160205ed9bdaa3fd
Author: doko <doko at 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca>
Date:   Sat Sep 23 09:35:59 2017 +0000

      * Update to SVN 20170923 (r253114) from the gcc-7-branch.
    
    
    git-svn-id: svn+ssh://svn.debian.org/svn/gcccvs/branches/sid/gcc-7@9711 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca
---
 debian/changelog                |    6 +-
 debian/patches/svn-updates.diff | 1295 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 1235 insertions(+), 66 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 56caf40..6ff0348 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,12 @@
 gcc-7 (7.2.0-7) UNRELEASED; urgency=medium
 
+  * Update to SVN 20170923 (r253114) from the gcc-7-branch.
+    - Fix PR libstdc++/79162, PR libstdc++/79162, PR libstdc++/82262,
+      PR libstdc++/82254, PR target/81996 (PPC), PR target/71951 (AArch64),
+      PR sanitizer/81929.
   * Fix PR go/82284, taken from the trunk. Closes: #876353.
 
- -- Matthias Klose <doko at debian.org>  Fri, 22 Sep 2017 08:51:22 +0200
+ -- Matthias Klose <doko at debian.org>  Sat, 23 Sep 2017 11:31:21 +0200
 
 gcc-7 (7.2.0-6) unstable; urgency=medium
 
diff --git a/debian/patches/svn-updates.diff b/debian/patches/svn-updates.diff
index fbfd694..cc7f835 100644
--- a/debian/patches/svn-updates.diff
+++ b/debian/patches/svn-updates.diff
@@ -1,10 +1,10 @@
-# DP: updates from the 7 branch upto 20170920 (r253002).
+# DP: updates from the 7 branch upto 20170923 (r253114).
 
 last_update()
 {
 	cat > ${dir}LAST_UPDATED <EOF
-Wed Sep 20 10:24:10 CEST 2017
-Wed Sep 20 08:24:10 UTC 2017 (revision 253002)
+Sat Sep 23 11:21:54 CEST 2017
+Sat Sep 23 09:21:54 UTC 2017 (revision 253114)
 EOF
 }
 
@@ -330,6 +330,40 @@ Index: libstdc++-v3/doc/doxygen/mainpage.html
     these terms</a>.
  </p>
  <p>Part of the generated documentation involved comments and notes from
+Index: libstdc++-v3/include/std/optional
+===================================================================
+--- a/src/libstdc++-v3/include/std/optional	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/std/optional	(.../branches/gcc-7-branch)
+@@ -1000,23 +1000,23 @@
+ 
+   // Hash.
+ 
+-  template<typename _Tp, bool
+-           = __poison_hash<remove_const_t<_Tp>>::__enable_hash_call>
++  template<typename _Tp, typename _Up = remove_const_t<_Tp>,
++           bool = __poison_hash<_Up>::__enable_hash_call>
+     struct __optional_hash_call_base
+     {
+       size_t
+       operator()(const optional<_Tp>& __t) const
+-      noexcept(noexcept(hash<_Tp> {}(*__t)))
++      noexcept(noexcept(hash<_Up>{}(*__t)))
+       {
+         // We pick an arbitrary hash for disengaged optionals which hopefully
+         // usual values of _Tp won't typically hash to.
+         constexpr size_t __magic_disengaged_hash = static_cast<size_t>(-3333);
+-        return __t ? hash<_Tp> {}(*__t) : __magic_disengaged_hash;
++        return __t ? hash<_Up>{}(*__t) : __magic_disengaged_hash;
+       }
+     };
+ 
+-  template<typename _Tp>
+-    struct __optional_hash_call_base<_Tp, false> {};
++  template<typename _Tp, typename _Up>
++    struct __optional_hash_call_base<_Tp, _Up, false> {};
+ 
+   template<typename _Tp>
+     struct hash<optional<_Tp>>
 Index: libstdc++-v3/include/std/string_view
 ===================================================================
 --- a/src/libstdc++-v3/include/std/string_view	(.../tags/gcc_7_2_0_release)
@@ -709,7 +743,51 @@ Index: libstdc++-v3/include/std/type_traits
 ===================================================================
 --- a/src/libstdc++-v3/include/std/type_traits	(.../tags/gcc_7_2_0_release)
 +++ b/src/libstdc++-v3/include/std/type_traits	(.../branches/gcc-7-branch)
-@@ -3043,14 +3043,16 @@
+@@ -2758,9 +2758,14 @@
+ 
+   template<typename _Result, typename _Ret>
+     struct __is_invocable_impl<_Result, _Ret, __void_t<typename _Result::type>>
+-    : __or_<is_void<_Ret>, is_convertible<typename _Result::type, _Ret>>::type
++    : is_convertible<typename _Result::type, _Ret>::type
+     { };
+ 
++  template<typename _Result>
++    struct __is_invocable_impl<_Result, void, __void_t<typename _Result::type>>
++    : true_type
++    { };
++
+   template<typename _Fn, typename... _ArgTypes>
+     struct __is_invocable
+     : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
+@@ -2857,10 +2862,26 @@
+              __call_is_nothrow_<_Fn, _ArgTypes...>>::type
+     { };
+ 
++  template<typename _Result, typename _Ret, typename = void>
++    struct __is_nt_invocable_impl : false_type { };
++
++  template<typename _Result, typename _Ret>
++    struct __is_nt_invocable_impl<_Result, _Ret,
++				  __void_t<typename _Result::type>>
++    : __and_<is_convertible<typename _Result::type, _Ret>,
++	     is_nothrow_constructible<_Ret, typename _Result::type>>
++    { };
++
++  template<typename _Result>
++    struct __is_nt_invocable_impl<_Result, void,
++				  __void_t<typename _Result::type>>
++    : true_type
++    { };
++
+   /// std::is_nothrow_invocable_r
+   template<typename _Ret, typename _Fn, typename... _ArgTypes>
+     struct is_nothrow_invocable_r
+-    : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
++    : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
+              __call_is_nothrow_<_Fn, _ArgTypes...>>::type
+     { };
+ 
+@@ -3043,14 +3064,16 @@
  template <typename _From, typename _To>
    inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
  
@@ -731,7 +809,7 @@ Index: libstdc++-v3/include/std/type_traits
  # define __cpp_lib_has_unique_object_representations 201606
    /// has_unique_object_representations
    template<typename _Tp>
-@@ -3060,13 +3062,13 @@
+@@ -3060,13 +3083,13 @@
        )>
      { };
  #endif
@@ -1335,8 +1413,11 @@ Index: libstdc++-v3/include/bits/basic_string.h
 ===================================================================
 --- a/src/libstdc++-v3/include/bits/basic_string.h	(.../tags/gcc_7_2_0_release)
 +++ b/src/libstdc++-v3/include/bits/basic_string.h	(.../branches/gcc-7-branch)
-@@ -117,6 +117,21 @@
+@@ -115,8 +115,24 @@
+       template<typename _Tp, typename _Res>
+ 	using _If_sv = enable_if_t<
  	  __and_<is_convertible<const _Tp&, __sv_type>,
++		 __not_<is_convertible<const _Tp*, const basic_string*>>,
  		 __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
  	  _Res>;
 +
@@ -1357,7 +1438,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif
  
        // Use empty-base optimization: http://www.cantrip.org/emptyopt.html
-@@ -593,7 +608,7 @@
+@@ -593,7 +609,7 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Construct string from a substring of a string_view.
@@ -1366,7 +1447,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
         *  @param  __pos The index of the first character to copy from __t.
         *  @param  __n   The number of characters to copy from __t.
         *  @param  __a   Allocator to use.
-@@ -601,16 +616,27 @@
+@@ -601,16 +617,27 @@
        template<typename _Tp, typename = _If_sv<_Tp, void>>
  	basic_string(const _Tp& __t, size_type __pos, size_type __n,
  		     const _Alloc& __a = _Alloc())
@@ -1398,7 +1479,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -756,12 +782,12 @@
+@@ -756,12 +783,12 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Set value to string constructed from a string_view.
@@ -1416,7 +1497,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  
        /**
         *  @brief  Convert to a string_view.
-@@ -768,7 +794,7 @@
+@@ -768,7 +795,7 @@
         *  @return A string_view.
         */
        operator __sv_type() const noexcept
@@ -1425,7 +1506,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        // Iterators:
-@@ -1157,12 +1183,13 @@
+@@ -1157,12 +1184,13 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Append a string_view.
@@ -1443,7 +1524,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -1265,22 +1292,26 @@
+@@ -1265,22 +1293,26 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Append a string_view.
@@ -1477,7 +1558,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  	append(const _Tp& __svt, size_type __pos, size_type __n = npos)
  	{
  	  __sv_type __sv = __svt;
-@@ -1433,21 +1464,25 @@
+@@ -1433,21 +1465,25 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Set value from a string_view.
@@ -1509,7 +1590,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  	_If_sv<_Tp, basic_string&>
  	assign(const _Tp& __svt, size_type __pos, size_type __n = npos)
  	{
-@@ -1692,23 +1727,27 @@
+@@ -1692,23 +1728,27 @@
        /**
         *  @brief  Insert a string_view.
         *  @param __pos  Iterator referencing position in string to insert at.
@@ -1543,7 +1624,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  	_If_sv<_Tp, basic_string&>
  	insert(size_type __pos1, const _Tp& __svt,
  	       size_type __pos2, size_type __n = npos)
-@@ -2120,23 +2159,27 @@
+@@ -2120,23 +2160,27 @@
         *  @brief  Replace range of characters with string_view.
         *  @param __pos  The position to replace at.
         *  @param __n    The number of characters to replace.
@@ -1577,7 +1658,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  	_If_sv<_Tp, basic_string&>
  	replace(size_type __pos1, size_type __n1, const _Tp& __svt,
  		size_type __pos2, size_type __n2 = npos)
-@@ -2153,12 +2196,16 @@
+@@ -2153,12 +2197,16 @@
            to replace at.
         *  @param __i2    An iterator referencing the end position
            for the replace.
@@ -1598,7 +1679,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
      private:
-@@ -2288,13 +2335,18 @@
+@@ -2288,13 +2336,18 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find position of a string_view.
@@ -1621,7 +1702,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -2345,13 +2397,18 @@
+@@ -2345,13 +2398,18 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find last position of a string_view.
@@ -1644,7 +1725,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -2419,13 +2476,19 @@
+@@ -2419,13 +2477,19 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find position of a character of a string_view.
@@ -1668,7 +1749,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -2497,13 +2560,19 @@
+@@ -2497,13 +2561,19 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find last position of a character of string.
@@ -1692,7 +1773,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -2574,13 +2643,19 @@
+@@ -2574,13 +2644,19 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find position of a character not in a string_view.
@@ -1716,7 +1797,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -2650,13 +2725,19 @@
+@@ -2650,13 +2726,19 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find last position of a character not in a string_view.
@@ -1740,7 +1821,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -2754,46 +2835,57 @@
+@@ -2754,46 +2836,57 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Compare to a string_view.
@@ -1816,7 +1897,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  	{
  	  __sv_type __sv = __svt;
  	  return __sv_type(*this)
-@@ -2918,7 +3010,10 @@
+@@ -2918,7 +3011,10 @@
        int
        compare(size_type __pos, size_type __n1, const _CharT* __s,
  	      size_type __n2) const;
@@ -1828,8 +1909,11 @@ Index: libstdc++-v3/include/bits/basic_string.h
  _GLIBCXX_END_NAMESPACE_CXX11
  #else  // !_GLIBCXX_USE_CXX11_ABI
    // Reference-counted COW string implentation
-@@ -3345,6 +3440,21 @@
+@@ -3343,8 +3439,24 @@
+       template<typename _Tp, typename _Res>
+ 	using _If_sv = enable_if_t<
  	  __and_<is_convertible<const _Tp&, __sv_type>,
++		 __not_<is_convertible<const _Tp*, const basic_string*>>,
  		 __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
  	  _Res>;
 +
@@ -1850,7 +1934,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif
  
      public:
-@@ -3471,7 +3581,7 @@
+@@ -3471,7 +3583,7 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Construct string from a substring of a string_view.
@@ -1859,7 +1943,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
         *  @param  __pos The index of the first character to copy from __t.
         *  @param  __n   The number of characters to copy from __t.
         *  @param  __a   Allocator to use.
-@@ -3479,16 +3589,27 @@
+@@ -3479,16 +3591,27 @@
        template<typename _Tp, typename = _If_sv<_Tp, void>>
  	basic_string(const _Tp& __t, size_type __pos, size_type __n,
  		     const _Alloc& __a = _Alloc())
@@ -1891,7 +1975,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -3559,12 +3680,12 @@
+@@ -3559,12 +3682,12 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Set value to string constructed from a string_view.
@@ -1907,7 +1991,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  
        /**
         *  @brief  Convert to a string_view.
-@@ -3981,12 +4102,13 @@
+@@ -3981,12 +4104,13 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Append a string_view.
@@ -1925,7 +2009,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -4072,22 +4194,27 @@
+@@ -4072,22 +4196,27 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Append a string_view.
@@ -1960,7 +2044,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  	append(const _Tp& __svt, size_type __pos, size_type __n = npos)
  	{
  	  __sv_type __sv = __svt;
-@@ -4225,23 +4352,27 @@
+@@ -4225,23 +4354,27 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Set value from a string_view.
@@ -1996,7 +2080,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  	{
  	  __sv_type __sv = __svt;
  	  return assign(__sv.data()
-@@ -4429,25 +4560,29 @@
+@@ -4429,25 +4562,29 @@
        /**
         *  @brief  Insert a string_view.
         *  @param __pos  Iterator referencing position in string to insert at.
@@ -2034,7 +2118,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  	       size_type __pos2, size_type __n = npos)
  	{
  	  __sv_type __sv = __svt;
-@@ -4790,7 +4925,7 @@
+@@ -4790,7 +4927,7 @@
  	return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
  			     __k1.base(), __k2 - __k1);
        }
@@ -2043,7 +2127,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #if __cplusplus >= 201103L
        /**
         *  @brief  Replace range of characters with initializer_list.
-@@ -4816,31 +4951,35 @@
+@@ -4816,31 +4953,35 @@
         *  @brief  Replace range of characters with string_view.
         *  @param __pos  The position to replace at.
         *  @param __n    The number of characters to replace.
@@ -2090,7 +2174,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  	}
  
        /**
-@@ -4849,12 +4988,16 @@
+@@ -4849,12 +4990,16 @@
            to replace at.
         *  @param __i2    An iterator referencing the end position
            for the replace.
@@ -2111,7 +2195,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
      private:
-@@ -5059,13 +5202,18 @@
+@@ -5059,13 +5204,18 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find position of a string_view.
@@ -2134,7 +2218,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -5132,13 +5280,18 @@
+@@ -5132,13 +5282,18 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find last position of a string_view.
@@ -2157,7 +2241,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -5210,13 +5363,19 @@
+@@ -5210,13 +5365,19 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find position of a character of a string_view.
@@ -2181,7 +2265,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -5288,13 +5447,19 @@
+@@ -5288,13 +5449,19 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find last position of a character of string.
@@ -2205,7 +2289,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -5363,13 +5528,19 @@
+@@ -5363,13 +5530,19 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find position of a character not in a string_view.
@@ -2229,7 +2313,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -5439,13 +5610,19 @@
+@@ -5439,13 +5612,19 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Find last position of a character not in a string_view.
@@ -2253,7 +2337,7 @@ Index: libstdc++-v3/include/bits/basic_string.h
  #endif // C++17
  
        /**
-@@ -5495,46 +5672,57 @@
+@@ -5495,46 +5674,57 @@
  #if __cplusplus > 201402L
        /**
         *  @brief  Compare to a string_view.
@@ -2694,7 +2778,77 @@ Index: libstdc++-v3/ChangeLog
 ===================================================================
 --- a/src/libstdc++-v3/ChangeLog	(.../tags/gcc_7_2_0_release)
 +++ b/src/libstdc++-v3/ChangeLog	(.../branches/gcc-7-branch)
-@@ -1,3 +1,247 @@
+@@ -1,3 +1,317 @@
++2017-09-21  Jonathan Wakely  <jwakely at redhat.com>
++
++	* testsuite/25_algorithms/clamp/1.cc: Fix order of arguments and
++	expected results when using predicate defining reverse order.
++	* testsuite/25_algorithms/clamp/constexpr.cc: Likewise.
++
++2017-09-20  Jonathan Wakely  <jwakely at redhat.com>
++
++	Backport from mainline
++	2017-06-14  Jonathan Wakely  <jwakely at redhat.com>
++
++	* doc/xml/manual/test.xml: Correct instructions on running tests.
++	* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Adjust to pass when
++	-D_GLIBCXX_USE_CXX11_ABI=0 added to RUNTESTFLAGS.
++	* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
++	* testsuite/27_io/basic_istream/extractors_arithmetic/char/
++	exceptions_failbit.cc: Likewise.
++	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
++	exceptions_failbit.cc: Likewise.
++	* testsuite/27_io/basic_istream/extractors_other/char/
++	exceptions_null.cc: Likewise.
++	* testsuite/27_io/basic_istream/extractors_other/wchar_t/
++	exceptions_null.cc: Likewise.
++	* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
++	* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
++	* testsuite/27_io/basic_ostream/inserters_other/char/
++	exceptions_null.cc: Likewise.
++	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
++	exceptions_null.cc: Likewise.
++	* testsuite/27_io/ios_base/storage/2.cc: Likewise.
++
++	PR libstdc++/79162
++	* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
++	(basic_string::_If_sv): Remove from the overload set when the
++	argument is derived from basic_string.
++
++	PR libstdc++/79162
++	* include/bits/basic_string.h (basic_string::_If_sv): Remove from the
++	overload set when the argument is derived from basic_string.
++	* testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc: New
++	test.
++	* testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc:
++	New test.
++
++	* testsuite/24_iterators/range_access_cpp17.cc: Fix order of dg-do
++	and dg-options directives. Fix invalid test.
++
++	Backport from mainline
++	2017-09-20  Jonathan Wakely  <jwakely at redhat.com>
++
++	PR libstdc++/82262
++	* include/std/optional (__optional_hash_call_base): Add template
++	parameter for remove_const_t<_Tp> and use it consistently.
++	* testsuite/20_util/optional/hash.cc: Test optional<const T>.
++
++	Backport from mainline
++	2017-09-19  Jonathan Wakely  <jwakely at redhat.com>
++
++	PR libstdc++/82254
++	* include/std/type_traits (__is_invocable): Add partial specialization
++	for INVOKE<void> case and remove is_void<R> check from partial
++	specialization for INVOKE<R> case.
++	(__is_nt_invocable_impl): New helper for is_nothrow_invocable_r.
++	(is_nothrow_invocable_r): Use __is_nt_invocable_impl.
++	* testsuite/20_util/is_nothrow_invocable/value.cc: Add tests for
++	conversions that can throw or fail to convert. Use static assert
++	strings to explain negative results.
++	* testsuite/20_util/is_nothrow_invocable/value_ext.cc: Use
++	is_nothrow_constructible in is_nt_invocable_conv.
++
 +2017-09-13  Jonathan Wakely  <jwakely at redhat.com>
 +
 +	Backport from mainline
@@ -2942,6 +3096,41 @@ Index: libstdc++-v3/ChangeLog
  2017-08-14  Release Manager
  
  	* GCC 7.2.0 released.
+Index: libstdc++-v3/testsuite/25_algorithms/clamp/1.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc	(.../branches/gcc-7-branch)
+@@ -30,12 +30,12 @@
+   VERIFY( y == 3 );
+   VERIFY( z == 4 );
+ 
+-  const int xc = std::clamp(1, 2, 4, std::greater<int>());
+-  const int yc = std::clamp(3, 2, 4, std::greater<int>());
+-  const int zc = std::clamp(5, 2, 4, std::greater<int>());
+-  VERIFY( xc == 4 );
+-  VERIFY( yc == 2 );
+-  VERIFY( zc == 2 );
++  const int xc = std::clamp(1, 4, 2, std::greater<int>());
++  const int yc = std::clamp(3, 4, 2, std::greater<int>());
++  const int zc = std::clamp(5, 4, 2, std::greater<int>());
++  VERIFY( xc == 2 );
++  VERIFY( yc == 3 );
++  VERIFY( zc == 4 );
+ }
+ 
+ int
+Index: libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc	(.../branches/gcc-7-branch)
+@@ -27,5 +27,5 @@
+ # error "Feature-test macro for clamp has wrong value"
+ #endif
+ 
+-static_assert(std::clamp(2, 0, 1) == 1, "");
+-static_assert(std::clamp(2, 0, 1, std::greater<int>()) == 0, "");
++static_assert(std::clamp(2, 0, 1) == 1);
++static_assert(std::clamp(2, 1, 0, std::greater<int>()) == 1);
 Index: libstdc++-v3/testsuite/24_iterators/container_access.cc
 ===================================================================
 --- a/src/libstdc++-v3/testsuite/24_iterators/container_access.cc	(.../tags/gcc_7_2_0_release)
@@ -2991,8 +3180,8 @@ Index: libstdc++-v3/testsuite/24_iterators/range_access_cpp17.cc
 --- a/src/libstdc++-v3/testsuite/24_iterators/range_access_cpp17.cc	(.../tags/gcc_7_2_0_release)
 +++ b/src/libstdc++-v3/testsuite/24_iterators/range_access_cpp17.cc	(.../branches/gcc-7-branch)
 @@ -0,0 +1,57 @@
-+// { dg-do compile { target c++1z } }
 +// { dg-options "-std=gnu++17" }
++// { dg-do compile { target c++1z } }
 +
 +// Copyright (C) 2017 Free Software Foundation, Inc.
 +//
@@ -3040,7 +3229,7 @@ Index: libstdc++-v3/testsuite/24_iterators/range_access_cpp17.cc
 +test03()
 +{
 +  using std::reverse_iterator;
-+  static std::initializer_list<int> il{1};
++  static constexpr std::initializer_list<int> il{1};
 +  static_assert(std::cbegin(il) == il.begin());
 +  static_assert(std::cend(il) == il.end());
 +  static_assert(std::rbegin(il) == reverse_iterator<const int*>(il.end()));
@@ -3268,6 +3457,218 @@ Index: libstdc++-v3/testsuite/27_io/basic_stringstream/assign/81338.cc
 +{
 +  test01();
 +}
+Index: libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc	(.../branches/gcc-7-branch)
+@@ -26,11 +26,8 @@
+ // Skip test at -m64 on Darwin because RLIMITS are not being honored.
+ // Radar 6467883: 10.4/10.5 setrlimits are not honored by memory allocators
+ // Radar 6467884: 10.X systems are not robust when paging space is exceeded
+-// { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } } 
++// { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } }
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ #include <sstream>
+ #include <iostream>
+ #include <limits>
+@@ -52,12 +49,19 @@
+   // pword
+   ios.pword(1) = v;
+   VERIFY( ios.pword(1) == v );
+-  
+-  try 
++
++  // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
++  try
+     {
+       v = ios.pword(max);
+     }
+-  catch(std::ios_base::failure& obj)
++  catch(exception_type&)
+     {
+       // Ok.
+       VERIFY( ios.bad() );
+@@ -69,7 +73,7 @@
+   VERIFY( v == 0 );
+ 
+   VERIFY( ios.pword(1) == v );
+-  
++
+   // max is different code path from max-1
+   v = &test;
+   try
+@@ -76,7 +80,7 @@
+     {
+       v = ios.pword(std::numeric_limits<int>::max());
+     }
+-  catch(std::ios_base::failure& obj)
++  catch(exception_type&)
+     {
+       // Ok.
+       VERIFY( ios.bad() );
+@@ -90,12 +94,12 @@
+   // iword
+   ios.iword(1) = 1;
+   VERIFY( ios.iword(1) == 1 );
+-  
+-  try 
++
++  try
+     {
+       l = ios.iword(max);
+     }
+-  catch(std::ios_base::failure& obj)
++  catch(exception_type&)
+     {
+       // Ok.
+       VERIFY( ios.bad() );
+@@ -110,11 +114,11 @@
+ 
+   // max is different code path from max-1
+   l = 1;
+-  try 
++  try
+     {
+       l = ios.iword(std::numeric_limits<int>::max());
+     }
+-  catch(std::ios_base::failure& obj)
++  catch(exception_type&)
+     {
+       // Ok.
+       VERIFY( ios.bad() );
+Index: libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc	(.../branches/gcc-7-branch)
+@@ -17,9 +17,6 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ // 27.4.4.2 basic_ios member functions
+ 
+ // NB: Don't include any other headers in this file.
+@@ -36,13 +33,13 @@
+   // basic_ios& copyfmt(const basic_ios& rhs)
+   {
+     std::ios ios_01(0);
+-    std::ios ios_02(0);  
++    std::ios ios_02(0);
+     ios_01.exceptions(std::ios_base::eofbit);
+     ios_02.exceptions(std::ios_base::eofbit);
+-    
++
+     try {
+-    ios_01.copyfmt(ios_02);
+-    }		 
++      ios_01.copyfmt(ios_02);
++    }
+     catch(...) {
+       VERIFY( false );
+     }
+@@ -49,8 +46,15 @@
+   }
+ 
+   {
++    // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
+     std::ios ios_01(0);
+-    std::ios ios_02(0);  
++    std::ios ios_02(0);
+     ios_01.clear(std::ios_base::eofbit);
+     ios_02.exceptions(std::ios_base::eofbit);
+ 
+@@ -57,8 +61,8 @@
+     try {
+       ios_01.copyfmt(ios_02);
+       VERIFY( false );
+-    }		 
+-    catch(std::ios_base::failure& fail) {
++    }
++    catch(exception_type&) {
+       VERIFY( true );
+     }
+     catch(...) {
+@@ -67,7 +71,7 @@
+   }
+ }
+ 
+-int main() 
++int main()
+ {
+   test02();
+   return 0;
+Index: libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc	(.../branches/gcc-7-branch)
+@@ -17,9 +17,6 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ // 27.4.4.2 basic_ios member functions
+ 
+ // NB: Don't include any other headers in this file.
+@@ -44,7 +41,7 @@
+     std::ios ios_01(0);
+     try {
+       ios_01.exceptions(std::ios_base::eofbit);
+-    }		 
++    }
+     catch(...) {
+       VERIFY( false );
+     }
+@@ -53,13 +50,20 @@
+   }
+ 
+   {
++    // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
+     std::ios ios_01(0);
+     ios_01.clear(std::ios_base::eofbit);
+     try {
+       ios_01.exceptions(std::ios_base::eofbit);
+       VERIFY( false );
+-    }		 
+-    catch(std::ios_base::failure& fail) {
++    }
++    catch(exception_type&) {
+       iostate02 = ios_01.exceptions();
+       VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) );
+     }
+@@ -69,7 +73,7 @@
+   }
+ }
+ 
+-int main() 
++int main()
+ {
+   test01();
+   return 0;
 Index: libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc
 ===================================================================
 --- a/src/libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc	(.../tags/gcc_7_2_0_release)
@@ -3337,6 +3738,47 @@ Index: libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc
 +{
 +  test01();
 +}
+Index: libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc	(.../branches/gcc-7-branch)
+@@ -15,9 +15,6 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ // 27.6.1.1.2 class basic_istream::sentry
+ 
+ #include <sstream>
+@@ -28,16 +25,23 @@
+   using namespace std;
+   wistringstream stream;
+   stream.exceptions(ios_base::eofbit);
+-  
++
++  // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
+   try
+     {
+       wistream::sentry sentry(stream, false);
+       VERIFY( false );
+     }
+-  catch (ios_base::failure&)
++  catch (exception_type&)
+     {
+       VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) );
+     }
+-  
++
+   return 0;
+ }
 Index: libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/53984.cc
 ===================================================================
 --- a/src/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/53984.cc	(.../tags/gcc_7_2_0_release)
@@ -3383,6 +3825,288 @@ Index: libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/53984.cc
 +{
 +  test01();
 +}
+Index: libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc	(.../branches/gcc-7-branch)
+@@ -15,12 +15,8 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-
+ // 27.6.1.1.2 class basic_istream::sentry
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ #include <sstream>
+ #include <testsuite_hooks.h>
+ 
+@@ -29,16 +25,23 @@
+   using namespace std;
+   istringstream stream;
+   stream.exceptions(ios_base::eofbit);
+-  
++
++  // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
+   try
+     {
+       istream::sentry sentry(stream, false);
+       VERIFY( false );
+     }
+-  catch (ios_base::failure&)
++  catch (exception_type&)
+     {
+       VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) );
+     }
+-  
++
+   return 0;
+ }
+Index: libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc	(.../branches/gcc-7-branch)
+@@ -15,9 +15,6 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ #include <istream>
+ #include <ostream>
+ #include <streambuf>
+@@ -38,12 +35,19 @@
+   wistringstream stream;
+   stream.exceptions(ios_base::failbit);
+ 
++  // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
+   try
+     {
+       stream >> static_cast<wstreambuf*>(0);
+       VERIFY( false );
+     }
+-  catch (ios_base::failure&)
++  catch (exception_type&)
+     {
+     }
+ 
+Index: libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc	(.../branches/gcc-7-branch)
+@@ -15,9 +15,6 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ #include <istream>
+ #include <ostream>
+ #include <streambuf>
+@@ -38,12 +35,19 @@
+   istringstream stream;
+   stream.exceptions(ios_base::failbit);
+ 
++  // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
+   try
+     {
+       stream >> static_cast<streambuf*>(0);
+       VERIFY(false);
+     }
+-  catch (ios_base::failure&)
++  catch (exception_type&)
+     {
+     }
+ 
+Index: libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc	(.../branches/gcc-7-branch)
+@@ -15,9 +15,6 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ #include <sstream>
+ #include <testsuite_hooks.h>
+ 
+@@ -29,7 +26,14 @@
+ 
+   wistringstream stream(L"jaylib - champion sound");
+   stream.exceptions(ios_base::failbit);
+-  
++
++  // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
+   try
+     {
+       T i;
+@@ -36,13 +40,13 @@
+       stream >> i;
+       VERIFY( false );
+     }
+-  catch (const ios_base::failure&)
+-    { 
++  catch (const exception_type&)
++    {
+       // stream should set failbit and throw ios_base::failure.
+       VERIFY( stream.fail() );
+       VERIFY( !stream.bad() );
+       VERIFY( !stream.eof() );
+-    }  
++    }
+   catch(...)
+     { VERIFY( false ); }
+ }
+Index: libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc	(.../branches/gcc-7-branch)
+@@ -15,9 +15,6 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ #include <sstream>
+ #include <testsuite_hooks.h>
+ 
+@@ -29,7 +26,14 @@
+ 
+   istringstream stream("jaylib - champion sound");
+   stream.exceptions(ios_base::failbit);
+-  
++
++  // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
+   try
+     {
+       T i;
+@@ -36,13 +40,13 @@
+       stream >> i;
+       VERIFY( false );
+     }
+-  catch (const ios_base::failure&)
+-    { 
++  catch (const exception_type&)
++    {
+       // stream should set failbit and throw ios_base::failure.
+       VERIFY( stream.fail() );
+       VERIFY( !stream.bad() );
+       VERIFY( !stream.eof() );
+-    }  
++    }
+   catch(...)
+     { VERIFY( false ); }
+ }
+Index: libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc	(.../branches/gcc-7-branch)
+@@ -15,9 +15,6 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ #include <istream>
+ #include <ostream>
+ #include <streambuf>
+@@ -39,13 +36,20 @@
+ 
+   wostringstream stream;
+   stream.exceptions(ios_base::badbit);
+-	
++
++  // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
+   try
+     {
+       stream << static_cast<wstreambuf*>(0);
+       VERIFY( false );
+     }
+-  catch (ios_base::failure&)
++  catch (exception_type&)
+     {
+     }
+ 
+Index: libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc	(.../branches/gcc-7-branch)
+@@ -15,9 +15,6 @@
+ // with this library; see the file COPYING3.  If not see
+ // <http://www.gnu.org/licenses/>.
+ 
+-// The library throws the new definition of std::ios::failure
+-// { dg-options "-D_GLIBCXX_USE_CXX11_ABI=1" }
+-
+ #include <istream>
+ #include <ostream>
+ #include <streambuf>
+@@ -39,13 +36,20 @@
+ 
+   ostringstream stream;
+   stream.exceptions(ios_base::badbit);
+-	
++
++  // The library throws the new definition of std::ios::failure
++#if _GLIBCXX_USE_CXX11_ABI
++    typedef std::ios_base::failure exception_type;
++#else
++    typedef std::exception exception_type;
++#endif
++
+   try
+     {
+       stream << static_cast<streambuf*>(0);
+       VERIFY( false );
+     }
+-  catch (ios_base::failure&)
++  catch (exception_type&)
+     {
+     }
+ 
 Index: libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc
 ===================================================================
 --- a/src/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc	(.../tags/gcc_7_2_0_release)
@@ -4929,6 +5653,122 @@ Index: libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_func
  #endif
  static_assert( test_assign<std::char_traits<char16_t>>() );
  static_assert( test_compare<std::char_traits<char16_t>>() );
+Index: libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc	(.../branches/gcc-7-branch)
+@@ -0,0 +1,53 @@
++// { dg-options "-std=gnu++17" }
++// { dg-do run { target c++1z } }
++
++// Copyright (C) 2011-2017 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 3, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING3.  If not see
++// <http://www.gnu.org/licenses/>.
++
++// NOTE: This makes use of the fact that we know how moveable
++// is implemented on string (via swap). If the implementation changed
++// this test may begin to fail.
++
++#include <string>
++#include <utility>
++#include <testsuite_hooks.h>
++
++class tstring : public std::basic_string<wchar_t>
++{
++public:
++  tstring() : std::basic_string<wchar_t>() {}
++  tstring(tstring&& s) : std::basic_string<wchar_t>(std::move(s)) {}
++  tstring& operator=(tstring&& s) = default;
++};
++
++void test01()
++{
++  tstring a, b;
++  a.push_back(L'1');
++  b = std::move(a);
++  VERIFY( b.size() == 1 && b[0] == L'1' && a.size() == 0 );
++
++  tstring c(std::move(b));
++  VERIFY( c.size() == 1 && c[0] == L'1' );
++  VERIFY( b.size() == 0 );
++}
++
++int main()
++{
++  test01();
++  return 0;
++}
+Index: libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc	(.../branches/gcc-7-branch)
+@@ -0,0 +1,53 @@
++// { dg-options "-std=gnu++17" }
++// { dg-do run { target c++1z } }
++
++// Copyright (C) 2011-2017 Free Software Foundation, Inc.
++//
++// This file is part of the GNU ISO C++ Library.  This library is free
++// software; you can redistribute it and/or modify it under the
++// terms of the GNU General Public License as published by the
++// Free Software Foundation; either version 3, or (at your option)
++// any later version.
++
++// This library is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++
++// You should have received a copy of the GNU General Public License along
++// with this library; see the file COPYING3.  If not see
++// <http://www.gnu.org/licenses/>.
++
++// NOTE: This makes use of the fact that we know how moveable
++// is implemented on string (via swap). If the implementation changed
++// this test may begin to fail.
++
++#include <string>
++#include <utility>
++#include <testsuite_hooks.h>
++
++class tstring : public std::basic_string<char>
++{
++public:
++  tstring() : std::basic_string<char>() {}
++  tstring(tstring&& s) : std::basic_string<char>(std::move(s)) {}
++  tstring& operator=(tstring&& s) = default;
++};
++
++void test01()
++{
++  tstring a, b;
++  a.push_back('1');
++  b = std::move(a);
++  VERIFY( b.size() == 1 && b[0] == '1' && a.size() == 0 );
++
++  tstring c(std::move(b));
++  VERIFY( c.size() == 1 && c[0] == '1' );
++  VERIFY( b.size() == 0 );
++}
++
++int main()
++{
++  test01();
++  return 0;
++}
 Index: libstdc++-v3/testsuite/21_strings/basic_string/lwg2946.cc
 ===================================================================
 --- a/src/libstdc++-v3/testsuite/21_strings/basic_string/lwg2946.cc	(.../tags/gcc_7_2_0_release)
@@ -5162,6 +6002,180 @@ Index: libstdc++-v3/testsuite/20_util/duration/cons/dr1177.cc
 +    "unless it has a floating-point representation");
 +static_assert(is_constructible<duration<float>, duration<int, ratio<1,3>>>{},
 +    "or a period that is an integral multiple of the original");
+Index: libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc	(.../branches/gcc-7-branch)
+@@ -40,6 +40,10 @@
+ 
+ void test01()
+ {
++  struct T { T(int) { } };
++  struct NT { NT(int) noexcept { } };
++  struct Ex { explicit Ex(int) noexcept { } };
++
+   using func_type = void(*)();
+   static_assert( ! is_nt_invocable< func_type>(),     "");
+ 
+@@ -55,28 +59,46 @@
+   static_assert( ! is_nt_invocable< mem_type, int >(),   "");
+   static_assert( ! is_nt_invocable< mem_type, int& >(),	"");
+ 
+-  static_assert(   is_nt_invocable< mem_type, X& >(),       "");
+-  static_assert(   is_nt_invocable_r< int,  mem_type, X& >(), "");
+-  static_assert(   is_nt_invocable_r< int&, mem_type, X& >(), "");
+-  static_assert(   is_nt_invocable_r< long, mem_type, X& >(), "");
+-  static_assert(   is_nt_invocable_r< int&, mem_type, X* >(), "");
++  static_assert(   is_nt_invocable< mem_type, X& >(),          "");
++  static_assert(   is_nt_invocable_r< int,   mem_type, X& >(), "");
++  static_assert(   is_nt_invocable_r< int&,  mem_type, X& >(), "");
++  static_assert(   is_nt_invocable_r< long,  mem_type, X& >(), "");
++  static_assert( ! is_nt_invocable_r< long&, mem_type, X& >(),
++		   "conversion fails, cannot bind long& to int");
++  static_assert(   is_nt_invocable_r< int&,  mem_type, X* >(), "");
+ 
++  static_assert( ! is_nt_invocable_r< T,  mem_type, X& >(),
++		   "conversion throws");
++  static_assert(   is_nt_invocable_r< NT, mem_type, X& >(), "");
++  static_assert( ! is_nt_invocable_r< Ex, mem_type, X& >(),
++		   "conversion fails, would use explicit constructor");
++
+   using memfun_type = int (X::*)();
+ 
+-  static_assert( ! is_nt_invocable< memfun_type >(),     "");
+-  static_assert( ! is_nt_invocable< memfun_type, int >(),  "");
+-  static_assert( ! is_nt_invocable< memfun_type, int& >(), "");
+-  static_assert( ! is_nt_invocable< memfun_type, X& >(),   "");
+-  static_assert( ! is_nt_invocable< memfun_type, X* >(),   "");
++  static_assert( ! is_nt_invocable< memfun_type >(),       "no object");
++  static_assert( ! is_nt_invocable< memfun_type, int >(),  "no object");
++  static_assert( ! is_nt_invocable< memfun_type, int& >(), "no object");
++  static_assert( ! is_nt_invocable< memfun_type, X& >(),   "call throws");
++  static_assert( ! is_nt_invocable< memfun_type, X* >(),   "call throws");
+ 
++  static_assert( ! is_nt_invocable_r< T,  memfun_type, X& >(), "call throws");
++  static_assert( ! is_nt_invocable_r< NT, memfun_type, X& >(), "call throws");
++  static_assert( ! is_nt_invocable_r< Ex, memfun_type, X& >(), "call throws");
++
+ #if __cpp_noexcept_function_type
+   using memfun_type_nt = int (X::*)() noexcept;
+ 
+-  static_assert( ! is_nt_invocable< memfun_type_nt >(),	    "");
+-  static_assert( ! is_nt_invocable< memfun_type_nt, int >(),  "");
+-  static_assert( ! is_nt_invocable< memfun_type_nt, int& >(), "");
++  static_assert( ! is_nt_invocable< memfun_type_nt >(),	      "no object");
++  static_assert( ! is_nt_invocable< memfun_type_nt, int >(),  "no object");
++  static_assert( ! is_nt_invocable< memfun_type_nt, int& >(), "no object");
+   static_assert(   is_nt_invocable< memfun_type_nt, X& >(),   "");
+   static_assert(   is_nt_invocable< memfun_type_nt, X* >(),   "");
++
++  static_assert( ! is_nt_invocable_r< T,  memfun_type_nt, X& >(),
++		   "conversion throws");
++  static_assert(   is_nt_invocable_r< NT, memfun_type_nt, X& >(), "");
++  static_assert( ! is_nt_invocable_r< Ex, memfun_type_nt, X& >(),
++		   "conversion fails, would use explicit constructor");
+ #endif
+ 
+   struct F {
+@@ -89,12 +111,44 @@
+   };
+   using CF = const F;
+ 
+-  static_assert( ! is_nt_invocable_r< int&,  F  >(), "");
+-  static_assert(   is_nt_invocable_r< long&, CF >(),  "");
+-  static_assert( ! is_nt_invocable_r< short&, F,   int >(), "" );
+-  static_assert(   is_nt_invocable_r< char&,  F&,  int >(), "" );
+-  static_assert(   is_nt_invocable_r< char&,  CF,  int >(), "" );
+-  static_assert(   is_nt_invocable_r< char&,  CF&, int >(), "" );
++  static_assert( ! is_nt_invocable< F  >(), "call throws");
++  static_assert(   is_nt_invocable< CF >(), "");
+ 
+-  static_assert( ! is_nt_invocable< F, int, int >(), "");
++  static_assert( ! is_nt_invocable_r< int&,  F  >(), "call throws");
++  static_assert(   is_nt_invocable_r< long&, CF >(), "");
++  static_assert( ! is_nt_invocable_r< T,     F  >(), "call throws");
++  static_assert( ! is_nt_invocable_r< NT,    F  >(), "call throws");
++  static_assert( ! is_nt_invocable_r< Ex,    F  >(), "call throws");
++  static_assert( ! is_nt_invocable_r< T,     CF >(), "conversion throws");
++  static_assert(   is_nt_invocable_r< NT,    CF >(), "" );
++  static_assert( ! is_nt_invocable_r< Ex,    CF >(), "conversion fails");
++
++  static_assert( ! is_nt_invocable< F,   int >(), "call throws");
++  static_assert(   is_nt_invocable< F&,  int >(), "");
++
++  static_assert( ! is_nt_invocable_r< short&, F,   int >(),
++		   "call throws" );
++  static_assert(   is_nt_invocable_r< char&,  F&,  int >(), "");
++  static_assert( ! is_nt_invocable_r< T,      F&,  int >(),
++		   "conversion throws");
++  static_assert(   is_nt_invocable_r< NT,     F&,  int >(), "");
++  static_assert( ! is_nt_invocable_r< Ex,     F&,  int >(),
++		   "conversion fails, would use explicit constructor");
++
++  static_assert(   is_nt_invocable< CF,   int >(), "");
++  static_assert(   is_nt_invocable< CF&,  int >(), "");
++
++  static_assert(   is_nt_invocable_r< char&,  CF,  int >(), "");
++  static_assert(   is_nt_invocable_r< char&,  CF&, int >(), "");
++
++  static_assert( ! is_nt_invocable_r< T,      CF&, int >(),
++		   "conversion throws");
++  static_assert(   is_nt_invocable_r< NT,     CF&, int >(), "");
++  static_assert( ! is_nt_invocable_r< Ex,     CF&, int >(),
++		   "conversion fails, would use explicit constructor");
++
++  static_assert( ! is_nt_invocable< F, int, int >(),
++		   "would call private member");
++  static_assert( ! is_nt_invocable_r<void, F, int, int >(),
++		   "would call private member");
+ }
+Index: libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc	(.../branches/gcc-7-branch)
+@@ -27,7 +27,9 @@
+   constexpr bool is_nt_invocable_conv(std::true_type)
+   {
+     using result_type = typename std::__invoke_result<T...>::type;
+-    return std::is_void<R>::value || std::is_convertible<result_type, R>::value;
++    return std::is_void<R>::value
++      || (std::is_convertible<result_type, R>::value
++	  && std::is_nothrow_constructible<R, result_type>::value);
+   }
+ 
+ template<typename R, typename... T>
+Index: libstdc++-v3/testsuite/20_util/optional/hash.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/20_util/optional/hash.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/20_util/optional/hash.cc	(.../branches/gcc-7-branch)
+@@ -29,14 +29,23 @@
+ auto f(...) -> decltype(std::false_type());
+ 
+ static_assert(!decltype(f<S>(0))::value, "");
+-static_assert(!std::is_invocable_v<
+-    std::hash<std::optional<S>>&, std::optional<S> const&> );
+-static_assert(std::is_invocable_v<
+-    std::hash<std::optional<int>>&, std::optional<int> const&> );
+ 
++template<typename T>
++constexpr bool hashable()
++{ return std::is_invocable_v<std::hash<T>&, const T&>; }
++
++static_assert(!hashable<std::optional<S>>());
++static_assert(!hashable<std::optional<const S>>());
++static_assert(hashable<std::optional<int>>());
++static_assert(hashable<std::optional<const int>>());
++
+ int main()
+ {
+   int x = 42;
+   std::optional<int> x2 = 42;
+   VERIFY(std::hash<int>()(x) == std::hash<std::optional<int>>()(x2));
++
++  // PR libstdc++/82262
++  std::optional<const int> x3 = x2;
++  VERIFY(std::hash<int>()(x) == std::hash<std::optional<const int>>()(x3));
+ }
 Index: libstdc++-v3/testsuite/20_util/time_point/cons/81468.cc
 ===================================================================
 --- a/src/libstdc++-v3/testsuite/20_util/time_point/cons/81468.cc	(.../tags/gcc_7_2_0_release)
@@ -5544,7 +6558,7 @@ Index: gcc/DATESTAMP
 +++ b/src/gcc/DATESTAMP	(.../branches/gcc-7-branch)
 @@ -1 +1 @@
 -20170814
-+20170920
++20170923
 Index: gcc/tree.c
 ===================================================================
 --- a/src/gcc/tree.c	(.../tags/gcc_7_2_0_release)
@@ -5921,7 +6935,19 @@ Index: gcc/ChangeLog
 ===================================================================
 --- a/src/gcc/ChangeLog	(.../tags/gcc_7_2_0_release)
 +++ b/src/gcc/ChangeLog	(.../branches/gcc-7-branch)
-@@ -1,3 +1,484 @@
+@@ -1,3 +1,496 @@
++2017-09-21  Alan Modra  <amodra at gmail.com>
++
++	PR target/81996
++	* gcc/config/rs6000/rs6000.c (rs6000_return_addr): Use
++	stack_pointer_rtx for count 0.  Update comments.  Break up
++	large rtl expression.
++
++2017-09-21  Wilco Dijkstra  <wdijkstr at arm.com>
++
++	PR target/71951
++	* config/aarch64/aarch64.h (LIBGCC2_UNWIND_ATTRIBUTE): Define.
++
 +2017-09-19  Uros Bizjak  <ubizjak at gmail.com>
 +
 +	* config/i386/i386.c (fold_builtin_cpu): Add M_AMDFAM17H
@@ -8446,7 +9472,12 @@ Index: gcc/testsuite/ChangeLog
 ===================================================================
 --- a/src/gcc/testsuite/ChangeLog	(.../tags/gcc_7_2_0_release)
 +++ b/src/gcc/testsuite/ChangeLog	(.../branches/gcc-7-branch)
-@@ -1,3 +1,365 @@
+@@ -1,3 +1,370 @@
++2017-09-22  Jakub Jelinek  <jakub at redhat.com>
++
++	PR sanitizer/81929
++	* g++.dg/ubsan/pr81929.C: New test.
++
 +2017-09-19  Martin Liska  <mliska at suse.cz>
 +
 +	Revert backport:
@@ -8812,6 +9843,25 @@ Index: gcc/testsuite/ChangeLog
  2017-08-14  Release Manager
  
  	* GCC 7.2.0 released.
+Index: gcc/testsuite/g++.dg/ubsan/pr81929.C
+===================================================================
+--- a/src/gcc/testsuite/g++.dg/ubsan/pr81929.C	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/g++.dg/ubsan/pr81929.C	(.../branches/gcc-7-branch)
+@@ -0,0 +1,14 @@
++// PR sanitizer/81929
++// { dg-do compile }
++// { dg-options "-std=c++14 -fsanitize=undefined" }
++
++struct S { S &operator<< (long); S foo (); S (); };
++
++void
++bar ()
++{
++  static_cast<S&>(S () << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
++		       << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
++		       << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
++		       << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0).foo ();
++}
 Index: gcc/testsuite/g++.dg/cpp0x/nullptr39.C
 ===================================================================
 --- a/src/gcc/testsuite/g++.dg/cpp0x/nullptr39.C	(.../tags/gcc_7_2_0_release)
@@ -9604,11 +10654,72 @@ Index: gcc/cp/decl.c
  	  cp_function_chain->invalid_constexpr = true;
  	}
  
+Index: gcc/cp/tree.c
+===================================================================
+--- a/src/gcc/cp/tree.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/cp/tree.c	(.../branches/gcc-7-branch)
+@@ -2767,6 +2767,7 @@
+ {
+   tree obj;	    /* The object to be substituted for a PLACEHOLDER_EXPR.  */
+   bool seen;	    /* Whether we've encountered a PLACEHOLDER_EXPR.  */
++  hash_set<tree> *pset;	/* To avoid walking same trees multiple times.  */
+ };
+ 
+ /* Like substitute_placeholder_in_expr, but handle C++ tree codes and
+@@ -2789,8 +2790,8 @@
+     case PLACEHOLDER_EXPR:
+       {
+ 	tree x = obj;
+-	for (; !(same_type_ignoring_top_level_qualifiers_p
+-		 (TREE_TYPE (*t), TREE_TYPE (x)));
++	for (; !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (*t),
++							   TREE_TYPE (x));
+ 	     x = TREE_OPERAND (x, 0))
+ 	  gcc_assert (TREE_CODE (x) == COMPONENT_REF);
+ 	*t = x;
+@@ -2822,8 +2823,7 @@
+ 		  valp = &TARGET_EXPR_INITIAL (*valp);
+ 	      }
+ 	    d->obj = subob;
+-	    cp_walk_tree (valp, replace_placeholders_r,
+-			  data_, NULL);
++	    cp_walk_tree (valp, replace_placeholders_r, data_, d->pset);
+ 	    d->obj = obj;
+ 	  }
+ 	*walk_subtrees = false;
+@@ -2855,10 +2855,11 @@
+     return exp;
+ 
+   tree *tp = &exp;
+-  replace_placeholders_t data = { obj, false };
++  hash_set<tree> pset;
++  replace_placeholders_t data = { obj, false, &pset };
+   if (TREE_CODE (exp) == TARGET_EXPR)
+     tp = &TARGET_EXPR_INITIAL (exp);
+-  cp_walk_tree (tp, replace_placeholders_r, &data, NULL);
++  cp_walk_tree (tp, replace_placeholders_r, &data, &pset);
+   if (seen_p)
+     *seen_p = data.seen;
+   return exp;
 Index: gcc/cp/ChangeLog
 ===================================================================
 --- a/src/gcc/cp/ChangeLog	(.../tags/gcc_7_2_0_release)
 +++ b/src/gcc/cp/ChangeLog	(.../branches/gcc-7-branch)
-@@ -1,3 +1,62 @@
+@@ -1,3 +1,76 @@
++2017-09-22  Eric Botcazou  <ebotcazou at adacore.com>
++
++	PR bootstrap/81926
++	* cp-objcp-common.c (cp_get_debug_type): Do only one lookup
++
++2017-09-22  Jakub Jelinek  <jakub at redhat.com>
++
++	PR sanitizer/81929
++	* tree.c (struct replace_placeholders_t): Add pset field.
++	(replace_placeholders_r): Call cp_walk_tree with d->pset as
++	last argument instead of NULL.  Formatting fix.
++	(replace_placeholders): Add pset variable, add its address
++	into data.  Pass &pset instead of NULL to cp_walk_tree.
++
 +2017-09-18  Jason Merrill  <jason at redhat.com>
 +
 +	PR c++/81236 - ICE with template-id in generic lambda
@@ -9671,7 +10782,7 @@ Index: gcc/cp/ChangeLog
  2017-08-14  Release Manager
  
  	* GCC 7.2.0 released.
-@@ -4,8 +63,8 @@
+@@ -4,8 +77,8 @@
  
  2017-08-09  Leonid Koppel  <lkoppel at uwaterloo.ca>
  
@@ -9897,13 +11008,13 @@ Index: gcc/cp/cp-objcp-common.c
 +	 types on the fly for the debug info only, they would not be attached
 +	 to any GC root and always be swept, so we would make the contents of
 +	 the debug info depend on the collection points.  */
-+      struct tree_map in, *h;
++      struct tree_map in, *h, **slot;
 +
 +      in.base.from = CONST_CAST_TREE (type);
 +      in.hash = htab_hash_pointer (type);
-+      h = debug_type_hash->find_with_hash (&in, in.hash);
-+      if (h)
-+	return h->to;
++      slot = debug_type_hash->find_slot_with_hash (&in, in.hash, INSERT);
++      if (*slot)
++	return (*slot)->to;
 +
 +      tree t = build_offset_type (TYPE_PTRMEMFUNC_OBJECT_TYPE (type),
 +				  TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (type)));
@@ -9912,7 +11023,7 @@ Index: gcc/cp/cp-objcp-common.c
 +      h->base.from = CONST_CAST_TREE (type);
 +      h->hash = htab_hash_pointer (type);
 +      h->to = t;
-+      *debug_type_hash->find_slot_with_hash (h, h->hash, INSERT) = h;
++      *slot = h;
 +
 +      return t;
 +    }
@@ -314106,6 +315217,23 @@ Index: gcc/config/riscv/rtems.h
 +	builtin_define ("__USE_INIT_FINI__");	\
 +	builtin_assert ("system=rtems");	\
 +    } while (0)
+Index: gcc/config/aarch64/aarch64.h
+===================================================================
+--- a/src/gcc/config/aarch64/aarch64.h	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/config/aarch64/aarch64.h	(.../branches/gcc-7-branch)
+@@ -958,4 +958,12 @@
+ extern tree aarch64_fp16_type_node;
+ extern tree aarch64_fp16_ptr_type_node;
+ 
++/* The generic unwind code in libgcc does not initialize the frame pointer.
++   So in order to unwind a function using a frame pointer, the very first
++   function that is unwound must save the frame pointer.  That way the frame
++   pointer is restored and its value is now valid - otherwise _Unwind_GetGR
++   crashes.  Libgcc can now be safely built with -fomit-frame-pointer.  */
++#define LIBGCC2_UNWIND_ATTRIBUTE \
++  __attribute__((optimize ("no-omit-frame-pointer")))
++
+ #endif /* GCC_AARCH64_H */
 Index: gcc/config/rs6000/rtems.h
 ===================================================================
 --- a/src/gcc/config/rs6000/rtems.h	(.../tags/gcc_7_2_0_release)
@@ -314276,7 +315404,44 @@ Index: gcc/config/rs6000/rs6000.c
  
        default:
          gcc_unreachable ();
-@@ -39555,6 +39567,22 @@
+@@ -27718,24 +27730,23 @@
+ rtx
+ rs6000_return_addr (int count, rtx frame)
+ {
+-  /* Currently we don't optimize very well between prolog and body
+-     code and for PIC code the code can be actually quite bad, so
+-     don't try to be too clever here.  */
++  /* We can't use get_hard_reg_initial_val for LR when count == 0 if LR
++     is trashed by the prologue, as it is for PIC on ABI_V4 and Darwin.  */
+   if (count != 0
+       || ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN) && flag_pic))
+     {
+       cfun->machine->ra_needs_full_frame = 1;
+ 
+-      return
+-	gen_rtx_MEM
+-	  (Pmode,
+-	   memory_address
+-	   (Pmode,
+-	    plus_constant (Pmode,
+-			   copy_to_reg
+-			   (gen_rtx_MEM (Pmode,
+-					 memory_address (Pmode, frame))),
+-			   RETURN_ADDRESS_OFFSET)));
++      if (count == 0)
++	/* FRAME is set to frame_pointer_rtx by the generic code, but that
++	   is good for loading 0(r1) only when !FRAME_GROWS_DOWNWARD.  */
++	frame = stack_pointer_rtx;
++      rtx prev_frame_addr = memory_address (Pmode, frame);
++      rtx prev_frame = copy_to_reg (gen_rtx_MEM (Pmode, prev_frame_addr));
++      rtx lr_save_off = plus_constant (Pmode,
++				       prev_frame, RETURN_ADDRESS_OFFSET);
++      rtx lr_save_addr = memory_address (Pmode, lr_save_off);
++      return gen_rtx_MEM (Pmode, lr_save_addr);
+     }
+ 
+   cfun->machine->ra_need_lr = 1;
+@@ -39555,6 +39566,22 @@
  /* Remember the last target of rs6000_set_current_function.  */
  static GTY(()) tree rs6000_previous_fndecl;
  
@@ -314299,7 +315464,7 @@ Index: gcc/config/rs6000/rs6000.c
  /* Establish appropriate back-end context for processing the function
     FNDECL.  The argument might be NULL to indicate processing at top
     level, outside of any function scope.  */
-@@ -39561,17 +39589,8 @@
+@@ -39561,17 +39588,8 @@
  static void
  rs6000_set_current_function (tree fndecl)
  {
@@ -314317,7 +315482,7 @@ Index: gcc/config/rs6000/rs6000.c
        fprintf (stderr, "\n==================== rs6000_set_current_function");
  
        if (fndecl)
-@@ -39584,11 +39603,43 @@
+@@ -39584,11 +39602,43 @@
  	fprintf (stderr, ", prev_fndecl (%p)", (void *)rs6000_previous_fndecl);
  
        fprintf (stderr, "\n");
@@ -314362,7 +315527,7 @@ Index: gcc/config/rs6000/rs6000.c
  	}
  
        if (old_tree)
-@@ -39595,47 +39646,17 @@
+@@ -39595,47 +39645,17 @@
  	{
  	  fprintf (stderr, "\nold fndecl target specific options:\n");
  	  debug_tree (old_tree);
@@ -314415,7 +315580,7 @@ Index: gcc/config/rs6000/rs6000.c
  }
  
  

-@@ -42693,9 +42714,10 @@
+@@ -42693,9 +42713,10 @@
  }
  
  /* Given INSN that's a load or store based at BASE_REG, look for a
@@ -314428,7 +315593,7 @@ Index: gcc/config/rs6000/rs6000.c
  {
    df_ref base_use;
    struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
-@@ -42716,8 +42738,8 @@
+@@ -42716,8 +42737,8 @@
        if (DF_REF_IS_ARTIFICIAL (base_def_link->ref))
  	break;
  
@@ -314439,7 +315604,7 @@ Index: gcc/config/rs6000/rs6000.c
        if (and_operation != 0)
  	break;
      }
-@@ -42739,7 +42761,8 @@
+@@ -42739,7 +42760,8 @@
    rtx mem = XEXP (SET_SRC (body), 0);
    rtx base_reg = XEXP (mem, 0);
  
@@ -314449,7 +315614,7 @@ Index: gcc/config/rs6000/rs6000.c
  
    if (and_operation != 0)
      {
-@@ -42763,7 +42786,21 @@
+@@ -42763,7 +42785,21 @@
  	  to_delete[INSN_UID (swap_insn)].replace = true;
  	  to_delete[INSN_UID (swap_insn)].replace_insn = swap_insn;
  
@@ -314472,7 +315637,7 @@ Index: gcc/config/rs6000/rs6000.c
  	  SET_SRC (body) = mem;
  	  INSN_CODE (insn) = -1; /* Force re-recognition.  */
  	  df_insn_rescan (insn);
-@@ -42786,7 +42823,8 @@
+@@ -42786,7 +42822,8 @@
    rtx mem = SET_DEST (body);
    rtx base_reg = XEXP (mem, 0);
  
@@ -314482,7 +315647,7 @@ Index: gcc/config/rs6000/rs6000.c
  
    if (and_operation != 0)
      {
-@@ -42814,7 +42852,21 @@
+@@ -42814,7 +42851,21 @@
  	  to_delete[INSN_UID (swap_insn)].replace = true;
  	  to_delete[INSN_UID (swap_insn)].replace_insn = swap_insn;
  

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/gcc-7.git



More information about the Reproducible-commits mailing list