[gcc-7] 326/354: * Update to SVN 20171025 (r254073) from the gcc-7-branch.

Ximin Luo infinity0 at debian.org
Thu Nov 23 15:51:35 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 fec67dbfe25448571a84c2d1004e480e1fc326eb
Author: doko <doko at 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca>
Date:   Wed Oct 25 10:18:05 2017 +0000

      * Update to SVN 20171025 (r254073) from the gcc-7-branch.
    
    
    git-svn-id: svn+ssh://svn.debian.org/svn/gcccvs/branches/sid/gcc-7@9775 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca
---
 debian/changelog                |    8 +-
 debian/patches/svn-updates.diff | 1865 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 1823 insertions(+), 50 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0f53bfb..10ed237 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,16 @@
 gcc-7 (7.2.0-12) UNRELEASED; urgency=medium
 
+  * Update to SVN 20171025 (r254073) from the gcc-7-branch.
+    - Fix PR sanitizer/82595, PR libstdc++/81395, PR libstdc++/82481,
+      PR libstdc++/79433, PR tree-optimization/82603, PR target/82445 (ARM),
+      PR tree-optimization/82436, PR rtl-optimization/82602,
+      PR middle-end/82556, PR tree-optimization/82549, PR c++/82560,
+      PR fortran/82312, PR fortran/79795, PR libfortran/82233.
   * Install the gcov.h header file.
   * Do the extra/optional dance ...
   * Override hardening-no-pie flags for compiler executables.
 
- -- Matthias Klose <doko at debian.org>  Fri, 20 Oct 2017 11:55:06 +0200
+ -- Matthias Klose <doko at debian.org>  Wed, 25 Oct 2017 12:10:43 +0200
 
 gcc-7 (7.2.0-11) unstable; urgency=medium
 
diff --git a/debian/patches/svn-updates.diff b/debian/patches/svn-updates.diff
index 05479f6..4b886c1 100644
--- a/debian/patches/svn-updates.diff
+++ b/debian/patches/svn-updates.diff
@@ -1,10 +1,10 @@
-# DP: updates from the 7 branch upto 20171017 (r253807).
+# DP: updates from the 7 branch upto 20171025 (r254073).
 
 last_update()
 {
 	cat > ${dir}LAST_UPDATED <EOF
-Tue Oct 17 12:44:50 CEST 2017
-Tue Oct 17 10:44:50 UTC 2017 (revision 253807)
+Wed Oct 25 12:05:06 CEST 2017
+Wed Oct 25 10:05:06 UTC 2017 (revision 254073)
 EOF
 }
 
@@ -218,7 +218,13 @@ Index: libsanitizer/ChangeLog
 ===================================================================
 --- a/src/libsanitizer/ChangeLog	(.../tags/gcc_7_2_0_release)
 +++ b/src/libsanitizer/ChangeLog	(.../branches/gcc-7-branch)
-@@ -1,3 +1,19 @@
+@@ -1,3 +1,25 @@
++2017-10-20  Jakub Jelinek  <jakub at redhat.com>
++
++	PR sanitizer/82595
++	* lsan/Makefile.am (lsan_files): Remove lsan_preinit.cc.
++	* lsan/Makefile.in: Regenerated.
++
 +2017-10-05  H.J. Lu  <hongjiu.lu at intel.com>
 +
 +	Backported from mainline
@@ -238,6 +244,47 @@ Index: libsanitizer/ChangeLog
  2017-08-14  Release Manager
  
  	* GCC 7.2.0 released.
+Index: libsanitizer/lsan/Makefile.in
+===================================================================
+--- a/src/libsanitizer/lsan/Makefile.in	(.../tags/gcc_7_2_0_release)
++++ b/src/libsanitizer/lsan/Makefile.in	(.../branches/gcc-7-branch)
+@@ -109,7 +109,7 @@
+ 	$(am__append_1) $(am__DEPENDENCIES_1)
+ am__objects_1 = lsan_common.lo lsan_common_linux.lo
+ am__objects_2 = $(am__objects_1) lsan.lo lsan_allocator.lo \
+-	lsan_interceptors.lo lsan_preinit.lo lsan_thread.lo
++	lsan_interceptors.lo lsan_thread.lo
+ am_liblsan_la_OBJECTS = $(am__objects_2)
+ liblsan_la_OBJECTS = $(am_liblsan_la_OBJECTS)
+ liblsan_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+@@ -306,7 +306,6 @@
+ 	lsan.cc \
+ 	lsan_allocator.cc \
+ 	lsan_interceptors.cc \
+-	lsan_preinit.cc \
+ 	lsan_thread.cc
+ 
+ libsanitizer_lsan_la_SOURCES = $(sanitizer_lsan_files)
+@@ -447,7 +446,6 @@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lsan_common.Plo at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lsan_common_linux.Plo at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lsan_interceptors.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lsan_preinit.Plo at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lsan_thread.Plo at am__quote@
+ 
+ .cc.o:
+Index: libsanitizer/lsan/Makefile.am
+===================================================================
+--- a/src/libsanitizer/lsan/Makefile.am	(.../tags/gcc_7_2_0_release)
++++ b/src/libsanitizer/lsan/Makefile.am	(.../branches/gcc-7-branch)
+@@ -23,7 +23,6 @@
+ 	lsan.cc \
+ 	lsan_allocator.cc \
+ 	lsan_interceptors.cc \
+-	lsan_preinit.cc \
+ 	lsan_thread.cc
+ 
+ libsanitizer_lsan_la_SOURCES = $(sanitizer_lsan_files)
 Index: libsanitizer/configure.tgt
 ===================================================================
 --- a/src/libsanitizer/configure.tgt	(.../tags/gcc_7_2_0_release)
@@ -255,7 +302,62 @@ Index: libstdc++-v3/doc/xml/manual/status_cxx2017.xml
 ===================================================================
 --- a/src/libstdc++-v3/doc/xml/manual/status_cxx2017.xml	(.../tags/gcc_7_2_0_release)
 +++ b/src/libstdc++-v3/doc/xml/manual/status_cxx2017.xml	(.../branches/gcc-7-branch)
-@@ -482,7 +482,6 @@
+@@ -98,7 +98,9 @@
+ 	</link>
+       </entry>
+       <entry align="center"> 7 </entry>
+-      <entry> <code>__has_include(<variant>)</code> </entry>
++      <entry> <code>__has_include(<variant>)</code>,
++              <code>__cpp_lib_variant >= 201603</code>
++      </entry>
+     </row>
+ 
+     <row>
+@@ -109,7 +111,9 @@
+ 	</link>
+       </entry>
+       <entry align="center"> 7 </entry>
+-      <entry> <code>__has_include(<optional>)</code> </entry>
++      <entry> <code>__has_include(<optional>)</code>,
++              <code>__cpp_lib_optional >= 201603</code>
++      </entry>
+     </row>
+ 
+     <row>
+@@ -120,7 +124,9 @@
+ 	</link>
+       </entry>
+       <entry align="center"> 7 </entry>
+-      <entry> <code>__has_include(<any>)</code> </entry>
++      <entry> <code>__has_include(<any>)</code>,
++              <code>__cpp_lib_any >= 201603</code>
++      </entry>
+     </row>
+ 
+     <row>
+@@ -131,7 +137,9 @@
+ 	</link>
+       </entry>
+       <entry align="center"> 7 </entry>
+-      <entry> <code>__has_include(<string_view>)</code> </entry>
++      <entry> <code>__has_include(<string_view>)</code>,
++              <code>__cpp_lib_string_view >= 201603</code>
++      </entry>
+     </row>
+ 
+     <row>
+@@ -143,7 +151,9 @@
+ 	</link>
+       </entry>
+       <entry align="center"> No </entry>
+-      <entry> <code>__has_include(<memory_resource>)</code> </entry>
++      <entry> <code>__has_include(<memory_resource>)</code>,
++              <code>__cpp_lib_memory_resource >= 201603</code>
++      </entry>
+     </row>
+ 
+     <row>
+@@ -482,7 +492,6 @@
      </row>
  
      <row>
@@ -263,7 +365,7 @@ Index: libstdc++-v3/doc/xml/manual/status_cxx2017.xml
        <entry> Constexpr for <code>std::char_traits</code> </entry>
        <entry>
  	<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0426r1.html">
-@@ -489,8 +488,8 @@
+@@ -489,8 +498,8 @@
  	P0426R1
  	</link>
        </entry>
@@ -274,6 +376,28 @@ Index: libstdc++-v3/doc/xml/manual/status_cxx2017.xml
      </row>
  
      <row>
+@@ -617,7 +626,9 @@
+       </entry>
+       <entry align="center"> No </entry>
+       <entry><code> __has_include(<execution>) </code>,
+-	     <code> __cpp_lib_parallel_algorithm >= 201603 </code></entry>
++	     <code> __cpp_lib_execution >= 201603 </code>,
++	     <code> __cpp_lib_parallel_algorithm >= 201603 </code>
++      </entry>
+     </row>
+ 
+     <row>
+@@ -639,9 +650,7 @@
+ 	</link>
+       </entry>
+       <entry align="center"> 7 </entry>
+-      <entry><code> __cpp_lib_gcd >= 201606 </code>,
+-	     <code> __cpp_lib_lcm >= 201606 </code>
+-      </entry>
++      <entry><code> __cpp_lib_gcd_lcm >= 201606 </code></entry>
+     </row>
+ 
+     <row>
 Index: libstdc++-v3/doc/xml/manual/extensions.xml
 ===================================================================
 --- a/src/libstdc++-v3/doc/xml/manual/extensions.xml	(.../tags/gcc_7_2_0_release)
@@ -352,11 +476,46 @@ 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/Makefile.in
+===================================================================
+--- a/src/libstdc++-v3/include/Makefile.in	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/Makefile.in	(.../branches/gcc-7-branch)
+@@ -389,7 +389,6 @@
+ 	${bits_srcdir}/boost_concept_check.h \
+ 	${bits_srcdir}/c++0x_warning.h \
+ 	${bits_srcdir}/c++14_warning.h \
+-	${bits_srcdir}/c++17_warning.h \
+ 	${bits_srcdir}/char_traits.h \
+ 	${bits_srcdir}/codecvt.h \
+ 	${bits_srcdir}/concept_check.h \
 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 @@
+@@ -29,10 +29,10 @@
+ #ifndef _GLIBCXX_OPTIONAL
+ #define _GLIBCXX_OPTIONAL 1
+ 
+-#if __cplusplus <= 201402L
+-# include <bits/c++17_warning.h>
+-#else
++#pragma GCC system_header
+ 
++#if __cplusplus >= 201703L
++
+ #include <utility>
+ #include <type_traits>
+ #include <stdexcept>
+@@ -51,6 +51,8 @@
+    *  @{
+    */
+ 
++#define __cpp_lib_optional 201603
++
+   template<typename _Tp>
+     class optional;
+ 
+@@ -1000,23 +1002,23 @@
  
    // Hash.
  
@@ -386,10 +545,78 @@ Index: libstdc++-v3/include/std/optional
  
    template<typename _Tp>
      struct hash<optional<_Tp>>
+Index: libstdc++-v3/include/std/any
+===================================================================
+--- a/src/libstdc++-v3/include/std/any	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/std/any	(.../branches/gcc-7-branch)
+@@ -31,9 +31,7 @@
+ 
+ #pragma GCC system_header
+ 
+-#if __cplusplus <= 201402L
+-# include <bits/c++17_warning.h>
+-#else
++#if __cplusplus >= 201703L
+ 
+ #include <typeinfo>
+ #include <new>
+@@ -68,6 +66,8 @@
+ #endif
+   }
+ 
++#define __cpp_lib_any 201603
++
+   /**
+    *  @brief A type-safe container of any type.
+    * 
+Index: libstdc++-v3/include/std/shared_mutex
+===================================================================
+--- a/src/libstdc++-v3/include/std/shared_mutex	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/std/shared_mutex	(.../branches/gcc-7-branch)
+@@ -31,9 +31,7 @@
+ 
+ #pragma GCC system_header
+ 
+-#if __cplusplus <= 201103L
+-# include <bits/c++14_warning.h>
+-#else
++#if __cplusplus >= 201402L
+ 
+ #include <bits/c++config.h>
+ #include <condition_variable>
+@@ -51,7 +49,7 @@
+ #ifdef _GLIBCXX_USE_C99_STDINT_TR1
+ #ifdef _GLIBCXX_HAS_GTHREADS
+ 
+-#if __cplusplus > 201402L
++#if __cplusplus >= 201703L
+ #define __cpp_lib_shared_mutex 201505
+   class shared_mutex;
+ #endif
 Index: libstdc++-v3/include/std/string_view
 ===================================================================
 --- a/src/libstdc++-v3/include/std/string_view	(.../tags/gcc_7_2_0_release)
 +++ b/src/libstdc++-v3/include/std/string_view	(.../branches/gcc-7-branch)
+@@ -35,9 +35,7 @@
+ 
+ #pragma GCC system_header
+ 
+-#if __cplusplus <= 201402L
+-# include <bits/c++17_warning.h>
+-#else
++#if __cplusplus >= 201703L
+ 
+ #include <limits>
+ #include <iosfwd>
+@@ -49,6 +47,8 @@
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
++#define __cpp_lib_string_view 201603
++
+   /**
+    *  @class basic_string_view <string_view>
+    *  @brief  A non-owning reference to a string.
 @@ -106,7 +106,7 @@
          _M_str{__str}
        { }
@@ -761,6 +988,30 @@ Index: libstdc++-v3/include/std/string_view
      operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                 basic_string_view<_CharT, _Traits> __y) noexcept
      { return __x.compare(__y) >= 0; }
+Index: libstdc++-v3/include/std/numeric
+===================================================================
+--- a/src/libstdc++-v3/include/std/numeric	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/std/numeric	(.../branches/gcc-7-branch)
+@@ -125,7 +125,11 @@
+ 
+ #if __cplusplus > 201402L
+ 
++#define __cpp_lib_gcd_lcm 201606
++// These were used in drafts of SD-6:
+ #define __cpp_lib_gcd 201606
++#define __cpp_lib_lcm 201606
++
+   /// Greatest common divisor
+   template<typename _Mn, typename _Nn>
+     constexpr common_type_t<_Mn, _Nn>
+@@ -138,7 +142,6 @@
+       return __detail::__gcd(__m, __n);
+     }
+ 
+-#define __cpp_lib_lcm 201606
+   /// Least common multiple
+   template<typename _Mn, typename _Nn>
+     constexpr common_type_t<_Mn, _Nn>
 Index: libstdc++-v3/include/std/type_traits
 ===================================================================
 --- a/src/libstdc++-v3/include/std/type_traits	(.../tags/gcc_7_2_0_release)
@@ -852,6 +1103,17 @@ Index: libstdc++-v3/include/std/chrono
 ===================================================================
 --- a/src/libstdc++-v3/include/std/chrono	(.../tags/gcc_7_2_0_release)
 +++ b/src/libstdc++-v3/include/std/chrono	(.../branches/gcc-7-branch)
+@@ -215,8 +215,8 @@
+         treat_as_floating_point<_Rep>::value;
+ #endif // C++17
+ 
+-#if __cplusplus > 201402L
+-# define __cpp_lib_chrono 201510
++#if __cplusplus >= 201703L
++# define __cpp_lib_chrono 201611
+ 
+     template<typename _ToDur, typename _Rep, typename _Period>
+       constexpr enable_if_t<__is_duration<_ToDur>::value, _ToDur>
 @@ -622,7 +622,8 @@
  	{ }
  
@@ -862,6 +1124,34 @@ Index: libstdc++-v3/include/std/chrono
  	  constexpr time_point(const time_point<clock, _Dur2>& __t)
  	  : __d(__t.time_since_epoch())
  	  { }
+Index: libstdc++-v3/include/std/mutex
+===================================================================
+--- a/src/libstdc++-v3/include/std/mutex	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/std/mutex	(.../branches/gcc-7-branch)
+@@ -556,8 +556,8 @@
+         }
+     }
+ 
+-#if __cplusplus > 201402L
+-#define __cpp_lib_scoped_lock 201707
++#if __cplusplus >= 201703L
++#define __cpp_lib_scoped_lock 201703
+   /** @brief A scoped lock type for multiple lockable objects.
+    *
+    * A scoped_lock controls mutex ownership within a scope, releasing
+@@ -688,6 +688,12 @@
+         __set_once_functor_lock_ptr(0);
+ #endif
+ 
++#ifdef __clang_analyzer__
++      // PR libstdc++/82481
++      __once_callable = nullptr;
++      __once_call = nullptr;
++#endif
++
+       if (__e)
+ 	__throw_system_error(__e);
+     }
 Index: libstdc++-v3/include/std/istream
 ===================================================================
 --- a/src/libstdc++-v3/include/std/istream	(.../tags/gcc_7_2_0_release)
@@ -892,6 +1182,30 @@ Index: libstdc++-v3/include/std/istream
        */
  
        /**
+Index: libstdc++-v3/include/std/variant
+===================================================================
+--- a/src/libstdc++-v3/include/std/variant	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/std/variant	(.../branches/gcc-7-branch)
+@@ -31,9 +31,7 @@
+ 
+ #pragma GCC system_header
+ 
+-#if __cplusplus <= 201402L
+-# include <bits/c++17_warning.h>
+-#else
++#if __cplusplus >= 201703L
+ 
+ #include <type_traits>
+ #include <utility>
+@@ -73,6 +71,8 @@
+ 
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
++#define __cpp_lib_variant 201603
++
+   template<typename... _Types> class tuple;
+   template<typename... _Types> class variant;
+   template <typename> struct hash;
 Index: libstdc++-v3/include/std/sstream
 ===================================================================
 --- a/src/libstdc++-v3/include/std/sstream	(.../tags/gcc_7_2_0_release)
@@ -1352,6 +1666,23 @@ Index: libstdc++-v3/include/experimental/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      find_last_not_of(_CharT __c, size_type __pos) const noexcept
      {
+Index: libstdc++-v3/include/experimental/bits/fs_path.h
+===================================================================
+--- a/src/libstdc++-v3/include/experimental/bits/fs_path.h	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/experimental/bits/fs_path.h	(.../branches/gcc-7-branch)
+@@ -724,10 +724,10 @@
+     pointer   operator->() const { return std::__addressof(**this); }
+ 
+     iterator& operator++();
+-    iterator  operator++(int) { auto __tmp = *this; ++_M_cur; return __tmp; }
++    iterator  operator++(int) { auto __tmp = *this; ++*this; return __tmp; }
+ 
+     iterator& operator--();
+-    iterator  operator--(int) { auto __tmp = *this; --_M_cur; return __tmp; }
++    iterator  operator--(int) { auto __tmp = *this; --*this; return __tmp; }
+ 
+     friend bool operator==(const iterator& __lhs, const iterator& __rhs)
+     { return __lhs._M_equals(__rhs); }
 Index: libstdc++-v3/include/ext/new_allocator.h
 ===================================================================
 --- a/src/libstdc++-v3/include/ext/new_allocator.h	(.../tags/gcc_7_2_0_release)
@@ -1365,6 +1696,48 @@ Index: libstdc++-v3/include/ext/new_allocator.h
        {
  	if (__n > this->max_size())
  	  std::__throw_bad_alloc();
+Index: libstdc++-v3/include/bits/c++17_warning.h
+===================================================================
+--- a/src/libstdc++-v3/include/bits/c++17_warning.h	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/bits/c++17_warning.h	(.../branches/gcc-7-branch)
+@@ -1,37 +0,0 @@
+-// Copyright (C) 2016-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.
+-
+-// Under Section 7 of GPL version 3, you are granted additional
+-// permissions described in the GCC Runtime Library Exception, version
+-// 3.1, as published by the Free Software Foundation.
+-
+-// You should have received a copy of the GNU General Public License and
+-// a copy of the GCC Runtime Library Exception along with this program;
+-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+-// <http://www.gnu.org/licenses/>.
+-
+-/** @file bits/c++17_warning.h
+- *  This is an internal header file, included by other library headers.
+- *  Do not attempt to use it directly. @headername{iosfwd}
+- */
+-
+-#ifndef _CXX17_WARNING_H
+-#define _CXX17_WARNING_H 1
+-
+-#if __cplusplus <= 201402L
+-#error This file requires compiler and library support \
+-for the ISO C++ 2017 standard. This support must be enabled \
+-with the -std=c++17 or -std=gnu++17 compiler options.
+-#endif
+-
+-#endif
 Index: libstdc++-v3/include/bits/hashtable.h
 ===================================================================
 --- a/src/libstdc++-v3/include/bits/hashtable.h	(.../tags/gcc_7_2_0_release)
@@ -2693,7 +3066,18 @@ Index: libstdc++-v3/include/bits/string_view.tcc
 ===================================================================
 --- a/src/libstdc++-v3/include/bits/string_view.tcc	(.../tags/gcc_7_2_0_release)
 +++ b/src/libstdc++-v3/include/bits/string_view.tcc	(.../branches/gcc-7-branch)
-@@ -45,7 +45,7 @@
+@@ -36,9 +36,7 @@
+ 
+ #pragma GCC system_header
+ 
+-#if __cplusplus <= 201402L
+-# include <bits/c++17_warning.h>
+-#else
++#if __cplusplus >= 201703L
+ 
+ namespace std _GLIBCXX_VISIBILITY(default)
+ {
+@@ -45,7 +43,7 @@
  _GLIBCXX_BEGIN_NAMESPACE_VERSION
  
    template<typename _CharT, typename _Traits>
@@ -2702,7 +3086,7 @@ Index: libstdc++-v3/include/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
      {
-@@ -66,7 +66,7 @@
+@@ -66,7 +64,7 @@
      }
  
    template<typename _CharT, typename _Traits>
@@ -2711,7 +3095,7 @@ Index: libstdc++-v3/include/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      find(_CharT __c, size_type __pos) const noexcept
      {
-@@ -82,7 +82,7 @@
+@@ -82,7 +80,7 @@
      }
  
    template<typename _CharT, typename _Traits>
@@ -2720,7 +3104,7 @@ Index: libstdc++-v3/include/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept
      {
-@@ -102,7 +102,7 @@
+@@ -102,7 +100,7 @@
      }
  
    template<typename _CharT, typename _Traits>
@@ -2729,7 +3113,7 @@ Index: libstdc++-v3/include/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      rfind(_CharT __c, size_type __pos) const noexcept
      {
-@@ -119,7 +119,7 @@
+@@ -119,7 +117,7 @@
      }
  
    template<typename _CharT, typename _Traits>
@@ -2738,7 +3122,7 @@ Index: libstdc++-v3/include/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      find_first_of(const _CharT* __str, size_type __pos, size_type __n) const
      {
-@@ -135,7 +135,7 @@
+@@ -135,7 +133,7 @@
      }
  
    template<typename _CharT, typename _Traits>
@@ -2747,7 +3131,7 @@ Index: libstdc++-v3/include/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      find_last_of(const _CharT* __str, size_type __pos, size_type __n) const
      {
-@@ -156,7 +156,7 @@
+@@ -156,7 +154,7 @@
      }
  
    template<typename _CharT, typename _Traits>
@@ -2756,7 +3140,7 @@ Index: libstdc++-v3/include/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      find_first_not_of(const _CharT* __str, size_type __pos, size_type __n) const
      {
-@@ -168,7 +168,7 @@
+@@ -168,7 +166,7 @@
      }
  
    template<typename _CharT, typename _Traits>
@@ -2765,7 +3149,7 @@ Index: libstdc++-v3/include/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      find_first_not_of(_CharT __c, size_type __pos) const noexcept
      {
-@@ -179,7 +179,7 @@
+@@ -179,7 +177,7 @@
      }
  
    template<typename _CharT, typename _Traits>
@@ -2774,7 +3158,7 @@ Index: libstdc++-v3/include/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      find_last_not_of(const _CharT* __str, size_type __pos, size_type __n) const
      {
-@@ -200,7 +200,7 @@
+@@ -200,7 +198,7 @@
      }
  
    template<typename _CharT, typename _Traits>
@@ -2783,6 +3167,48 @@ Index: libstdc++-v3/include/bits/string_view.tcc
      basic_string_view<_CharT, _Traits>::
      find_last_not_of(_CharT __c, size_type __pos) const noexcept
      {
+Index: libstdc++-v3/include/bits/fstream.tcc
+===================================================================
+--- a/src/libstdc++-v3/include/bits/fstream.tcc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/bits/fstream.tcc	(.../branches/gcc-7-branch)
+@@ -699,7 +699,7 @@
+  
+  	   if (__n == 0)
+  	     {
+- 	       _M_set_buffer(0);
++	       // Set _M_reading. Buffer is already in initial 'read' mode.
+  	       _M_reading = true;
+  	     }
+  	   else if (__len == 0)
+Index: libstdc++-v3/include/c_global/cstddef
+===================================================================
+--- a/src/libstdc++-v3/include/c_global/cstddef	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/c_global/cstddef	(.../branches/gcc-7-branch)
+@@ -57,9 +57,11 @@
+ }
+ #endif
+ 
+-#if __cplusplus > 201402L
++#if __cplusplus >= 201703L
+ namespace std
+ {
++#define __cpp_lib_byte 201603
++
+   /// std::byte
+   enum class byte : unsigned char {};
+ 
+Index: libstdc++-v3/include/Makefile.am
+===================================================================
+--- a/src/libstdc++-v3/include/Makefile.am	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/Makefile.am	(.../branches/gcc-7-branch)
+@@ -96,7 +96,6 @@
+ 	${bits_srcdir}/boost_concept_check.h \
+ 	${bits_srcdir}/c++0x_warning.h \
+ 	${bits_srcdir}/c++14_warning.h \
+-	${bits_srcdir}/c++17_warning.h \
+ 	${bits_srcdir}/char_traits.h \
+ 	${bits_srcdir}/codecvt.h \
+ 	${bits_srcdir}/concept_check.h \
 Index: libstdc++-v3/libsupc++/cxxabi.h
 ===================================================================
 --- a/src/libstdc++-v3/libsupc++/cxxabi.h	(.../tags/gcc_7_2_0_release)
@@ -2800,7 +3226,82 @@ 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,317 @@
+@@ -1,3 +1,392 @@
++2017-10-23  Jonathan Wakely  <jwakely at redhat.com>
++
++	Backport from mainline
++	2017-07-18  Jonathan Wakely  <jwakely at redhat.com>
++
++	PR libstdc++/81395
++	* include/bits/fstream.tcc (basic_filebuf::xsgetn): Don't set buffer
++	pointers for write mode after reading.
++	* testsuite/27_io/basic_filebuf/sgetn/char/81395.cc: New.
++
++2017-10-21  Jonathan Wakely  <jwakely at redhat.com>
++
++	* testsuite/experimental/filesystem/path/itr/traversal.cc: Do not
++	increment past-the-end iterators.
++
++2017-10-20  Jonathan Wakely  <jwakely at redhat.com>
++
++	* include/std/chrono (__cpp_lib_chrono): Update macro value to
++	indicate support for P0505R0.
++	* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: Check
++	for updated macro.
++
++	* include/c_global/cstddef: Define __cpp_lib_byte feature-test macro.
++	* testsuite/18_support/byte/requirements.cc: Check macro.
++
++	Backport from mainline
++	2017-10-13  Jonathan Wakely  <jwakely at redhat.com>
++
++	PR libstdc++/82481
++	* include/std/mutex (call_once): Suppress clang-tidy warnings about
++	dangling references.
++
++	Backport from mainline
++	2017-09-12  Jonathan Wakely  <jwakely at redhat.com>
++
++	PR libstdc++/79433
++	* doc/xml/manual/status_cxx2017.xml: Update feature-test macros.
++	* doc/html/*: Regenerate.
++	* include/Makefile.am: Remove <bits/c++17_warning.h>.
++	* include/Makefile.in: Regenerate.
++	* include/bits/c++17_warning.h: Remove.
++	* include/bits/string_view.tcc: Do not include <bits/c++17_warning.h>
++	for pre-C++17 modes.
++	* include/std/any: Likewise.
++	(__cpp_lib_any): Define.
++	* include/std/mutex (__cpp_lib_scoped_lock): Adjust value as per new
++	SD-6 draft.
++	* include/std/numeric (__cpp_lib_gcd_lcm): Define as per new SD-6
++	draft.
++	* include/std/optional: Do not include <bits/c++17_warning.h>.
++	(__cpp_lib_optional): Define.
++	* include/std/shared_mutex: Do not include <bits/c++14_warning.h>.
++	* include/std/string_view: Do not include <bits/c++17_warning.h>.
++	(__cpp_lib_string_view): Define.
++	* include/std/variant: Do not include <bits/c++17_warning.h>.
++	(__cpp_lib_variant): Define.
++	* testsuite/20_util/optional/cons/value_neg.cc: Adjust dg-error line
++	numbers.
++	* testsuite/26_numerics/gcd/1.cc: Test for __cpp_lib_gcd_lcm.
++	* testsuite/26_numerics/gcd/gcd_neg.cc: Adjust dg-error line
++	numbers.
++	* testsuite/26_numerics/lcm/1.cc: Test for __cpp_lib_gcd_lcm.
++	* testsuite/26_numerics/lcm/lcm_neg.cc: Adjust dg-error line
++	numbers.
++	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Adjust
++	expected value of __cpp_lib_scoped_lock.
++
++	Backport from mainline
++	2017-10-19  Jonathan Wakely  <jwakely at redhat.com>
++
++	* include/experimental/bits/fs_path.h (path::iterator++(int))
++	(path::iterator--(int)): Fix for paths with only one component.
++	* testsuite/experimental/filesystem/path/itr/traversal.cc: Test
++	post-increment and post-decrement.
++
 +2017-09-21  Jonathan Wakely  <jwakely at redhat.com>
 +
 +	* testsuite/25_algorithms/clamp/1.cc: Fix order of arguments and
@@ -3259,6 +3760,36 @@ Index: libstdc++-v3/testsuite/24_iterators/range_access_cpp17.cc
 +  static_assert(std::crbegin(il) == reverse_iterator<const int*>(il.end()));
 +  static_assert(std::crend(il) == reverse_iterator<const int*>(il.begin()));
 +}
+Index: libstdc++-v3/testsuite/18_support/byte/requirements.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/18_support/byte/requirements.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/18_support/byte/requirements.cc	(.../branches/gcc-7-branch)
+@@ -20,6 +20,12 @@
+ 
+ #include <cstddef>
+ 
++#ifndef __cpp_lib_byte
++# error "Feature-test macro for byte missing"
++#elif __cpp_lib_byte != 201603
++# error "Feature-test macro for byte has wrong value"
++#endif
++
+ static_assert( sizeof(std::byte) == sizeof(unsigned char) );
+ static_assert( alignof(std::byte) == alignof(unsigned char) );
+ 
+Index: libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc	(.../branches/gcc-7-branch)
+@@ -27,7 +27,7 @@
+ 
+ #ifndef __cpp_lib_scoped_lock
+ # error "Feature-test macro for scoped_lock missing"
+-#elif __cpp_lib_scoped_lock != 201707
++#elif __cpp_lib_scoped_lock != 201703
+ # error "Feature-test macro for scoped_lock has wrong value"
+ #endif
+ 
 Index: libstdc++-v3/testsuite/ext/stdio_filebuf/char/81751.cc
 ===================================================================
 --- a/src/libstdc++-v3/testsuite/ext/stdio_filebuf/char/81751.cc	(.../tags/gcc_7_2_0_release)
@@ -4129,6 +4660,57 @@ Index: libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exception
      {
      }
  
+Index: libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/81395.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/81395.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_filebuf/sgetn/char/81395.cc	(.../branches/gcc-7-branch)
+@@ -0,0 +1,46 @@
++// Copyright (C) 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/>.
++
++// { dg-require-fileio "" }
++
++// PR libstdc++/81395
++
++#include <fstream>
++#include <cstring>	// for std::memset
++#include <cstdio>	// For BUFSIZ
++
++using std::memset;
++
++int main()
++{
++  {
++    std::filebuf fb;
++    fb.open("test.txt", std::ios::out);
++    char data[BUFSIZ];
++    memset(data, 'A', sizeof(data));
++    fb.sputn(data, sizeof(data));
++  }
++
++  std::filebuf fb;
++  fb.open("test.txt", std::ios::in|std::ios::out);
++  char buf[BUFSIZ];
++  memset(buf, 0, sizeof(buf));
++  fb.sgetn(buf, sizeof(buf));
++  // Switch from reading to writing without seeking first:
++  fb.sputn("B", 1);
++  fb.pubsync();
++}
 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)
@@ -5879,6 +6461,106 @@ Index: libstdc++-v3/testsuite/21_strings/basic_string/79162.cc
 +  std::string ProfileFileName;
 +  ProfileFileName = PGOTestProfileFile;
 +}
+Index: libstdc++-v3/testsuite/26_numerics/lcm/1.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/26_numerics/lcm/1.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/26_numerics/lcm/1.cc	(.../branches/gcc-7-branch)
+@@ -20,9 +20,9 @@
+ 
+ #include <numeric>
+ 
+-#ifndef __cpp_lib_lcm
++#ifndef __cpp_lib_gcd_lcm
+ # error "Feature-test macro for lcm missing"
+-#elif __cpp_lib_lcm != 201606
++#elif __cpp_lib_gcd_lcm != 201606
+ # error "Feature-test macro for lcm has wrong value"
+ #endif
+ 
+Index: libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc	(.../branches/gcc-7-branch)
+@@ -31,9 +31,9 @@
+   std::lcm(0.1, 0.1);   // { dg-error "from here" }
+ }
+ 
+-// { dg-error "integers" "" { target *-*-* } 147 }
+-// { dg-error "integers" "" { target *-*-* } 148 }
+-// { dg-error "not bools" "" { target *-*-* } 149 }
+-// { dg-error "not bools" "" { target *-*-* } 150 }
++// { dg-error "integers" "" { target *-*-* } 150 }
++// { dg-error "integers" "" { target *-*-* } 151 }
++// { dg-error "not bools" "" { target *-*-* } 152 }
++// { dg-error "not bools" "" { target *-*-* } 153 }
+ // { dg-prune-output "deleted function" }
+ // { dg-prune-output "invalid operands" }
+Index: libstdc++-v3/testsuite/26_numerics/gcd/1.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/26_numerics/gcd/1.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/26_numerics/gcd/1.cc	(.../branches/gcc-7-branch)
+@@ -20,9 +20,9 @@
+ 
+ #include <numeric>
+ 
+-#ifndef __cpp_lib_gcd
++#ifndef __cpp_lib_gcd_lcm
+ # error "Feature-test macro for gcd missing"
+-#elif __cpp_lib_gcd != 201606
++#elif __cpp_lib_gcd_lcm != 201606
+ # error "Feature-test macro for gcd has wrong value"
+ #endif
+ 
+Index: libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc	(.../branches/gcc-7-branch)
+@@ -31,9 +31,9 @@
+   std::gcd(0.1, 0.1);   // { dg-error "from here" }
+ }
+ 
+-// { dg-error "integers" "" { target *-*-* } 134 }
+-// { dg-error "integers" "" { target *-*-* } 135 }
+-// { dg-error "not bools" "" { target *-*-* } 136 }
+-// { dg-error "not bools" "" { target *-*-* } 137 }
++// { dg-error "integers" "" { target *-*-* } 138 }
++// { dg-error "integers" "" { target *-*-* } 139 }
++// { dg-error "not bools" "" { target *-*-* } 140 }
++// { dg-error "not bools" "" { target *-*-* } 141 }
+ // { dg-prune-output "deleted function" }
+ // { dg-prune-output "invalid operands" }
+Index: libstdc++-v3/testsuite/experimental/filesystem/path/itr/traversal.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/experimental/filesystem/path/itr/traversal.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/experimental/filesystem/path/itr/traversal.cc	(.../branches/gcc-7-branch)
+@@ -79,9 +79,27 @@
+   }
+ }
+ 
++void
++test03()
++{
++  path paths[] = { "single", "multiple/elements" };
++  for (const path& p : paths)
++    for (auto iter = p.begin(); iter != p.end(); ++iter)
++    {
++      auto iter2 = iter;
++      ++iter;
++      iter2++;
++      VERIFY( iter2 == iter );
++      --iter;
++      iter2--;
++      VERIFY( iter2 == iter );
++    }
++}
++
+ int
+ main()
+ {
+   test01();
+   test02();
++  test03();
+ }
 Index: libstdc++-v3/testsuite/experimental/string_view/operations/compare/char/70483.cc
 ===================================================================
 --- a/src/libstdc++-v3/testsuite/experimental/string_view/operations/compare/char/70483.cc	(.../tags/gcc_7_2_0_release)
@@ -6024,6 +6706,24 @@ 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/duration/arithmetic/constexpr_c++17.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/20_util/duration/arithmetic/constexpr_c++17.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/20_util/duration/arithmetic/constexpr_c++17.cc	(.../branches/gcc-7-branch)
+@@ -20,6 +20,13 @@
+ 
+ #include <chrono>
+ #include <testsuite_common_types.h>
++
++#ifndef __cpp_lib_chrono
++# error "Feature-test macro for constexpr <chrono> missing"
++#elif __cpp_lib_chrono != 201611
++# error "Feature-test macro for constexpr <chrono> has wrong value"
++#endif
++
+ constexpr auto test_operators()
+ {
+   std::chrono::nanoseconds d1 { 1 };
 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)
@@ -6166,6 +6866,22 @@ Index: libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc
    }
  
  template<typename R, typename... T>
+Index: libstdc++-v3/testsuite/20_util/optional/cons/value_neg.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/20_util/optional/cons/value_neg.cc	(.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/20_util/optional/cons/value_neg.cc	(.../branches/gcc-7-branch)
+@@ -37,8 +37,8 @@
+     std::optional<std::unique_ptr<int>> oup2 = new int;  // { dg-error "conversion" }
+     struct U { explicit U(std::in_place_t); };
+     std::optional<U> ou(std::in_place); // { dg-error "no matching" }
+-    // { dg-error "no type" "" { target { *-*-* } } 488 }
+-    // { dg-error "no type" "" { target { *-*-* } } 498 }
+-    // { dg-error "no type" "" { target { *-*-* } } 555 }
++    // { dg-error "no type" "" { target { *-*-* } } 490 }
++    // { dg-error "no type" "" { target { *-*-* } } 500 }
++    // { dg-error "no type" "" { target { *-*-* } } 557 }
+   }
+ }
 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)
@@ -6786,7 +7502,7 @@ Index: gcc/DATESTAMP
 +++ b/src/gcc/DATESTAMP	(.../branches/gcc-7-branch)
 @@ -1 +1 @@
 -20170814
-+20171017
++20171025
 Index: gcc/tree.c
 ===================================================================
 --- a/src/gcc/tree.c	(.../tags/gcc_7_2_0_release)
@@ -6955,6 +7671,18 @@ Index: gcc/internal-fn.c
  				       NULL_RTX, NULL, do_error,
  				       PROB_VERY_UNLIKELY);
  	      emit_jump (done_label);
+Index: gcc/builtins.c
+===================================================================
+--- a/src/gcc/builtins.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/builtins.c	(.../branches/gcc-7-branch)
+@@ -1194,6 +1194,7 @@
+ expand_builtin_update_setjmp_buf (rtx buf_addr)
+ {
+   machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL);
++  buf_addr = convert_memory_address (Pmode, buf_addr);
+   rtx stack_save
+     = gen_rtx_MEM (sa_mode,
+ 		   memory_address
 Index: gcc/gcc.c
 ===================================================================
 --- a/src/gcc/gcc.c	(.../tags/gcc_7_2_0_release)
@@ -7036,7 +7764,95 @@ Index: gcc/fold-const.c
    return var;
  }
  
-@@ -6175,6 +6182,7 @@
+@@ -4033,22 +4040,21 @@
+ 		      size_int (nbitsize - lbitsize - lbitpos));
+ 
+   if (! const_p)
+-    /* If not comparing with constant, just rework the comparison
+-       and return.  */
+-    return fold_build2_loc (loc, code, compare_type,
+-			fold_build2_loc (loc, BIT_AND_EXPR, unsigned_type,
+-				     make_bit_field_ref (loc, linner, lhs,
+-							 unsigned_type,
+-							 nbitsize, nbitpos,
+-							 1, lreversep),
+-				     mask),
+-			fold_build2_loc (loc, BIT_AND_EXPR, unsigned_type,
+-				     make_bit_field_ref (loc, rinner, rhs,
+-							 unsigned_type,
+-							 nbitsize, nbitpos,
+-							 1, rreversep),
+-				     mask));
++    {
++      if (nbitpos < 0)
++	return 0;
+ 
++      /* If not comparing with constant, just rework the comparison
++	 and return.  */
++      tree t1 = make_bit_field_ref (loc, linner, lhs, unsigned_type,
++				    nbitsize, nbitpos, 1, lreversep);
++      t1 = fold_build2_loc (loc, BIT_AND_EXPR, unsigned_type, t1, mask);
++      tree t2 = make_bit_field_ref (loc, rinner, rhs, unsigned_type,
++				    nbitsize, nbitpos, 1, rreversep);
++      t2 = fold_build2_loc (loc, BIT_AND_EXPR, unsigned_type, t2, mask);
++      return fold_build2_loc (loc, code, compare_type, t1, t2);
++    }
++
+   /* Otherwise, we are handling the constant case.  See if the constant is too
+      big for the field.  Warn and return a tree for 0 (false) if so.  We do
+      this not only for its own sake, but to avoid having to test for this
+@@ -4078,6 +4084,9 @@
+ 	}
+     }
+ 
++  if (nbitpos < 0)
++    return 0;
++
+   /* Single-bit compares should always be against zero.  */
+   if (lbitsize == 1 && ! integer_zerop (rhs))
+     {
+@@ -5851,7 +5860,10 @@
+ 	 results.  */
+       ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask);
+       lr_mask = const_binop (BIT_IOR_EXPR, lr_mask, rr_mask);
+-      if (lnbitsize == rnbitsize && xll_bitpos == xlr_bitpos)
++      if (lnbitsize == rnbitsize
++	  && xll_bitpos == xlr_bitpos
++	  && lnbitpos >= 0
++	  && rnbitpos >= 0)
+ 	{
+ 	  lhs = make_bit_field_ref (loc, ll_inner, ll_arg,
+ 				    lntype, lnbitsize, lnbitpos,
+@@ -5875,10 +5887,14 @@
+ 	 Note that we still must mask the lhs/rhs expressions.  Furthermore,
+ 	 the mask must be shifted to account for the shift done by
+ 	 make_bit_field_ref.  */
+-      if ((ll_bitsize + ll_bitpos == rl_bitpos
+-	   && lr_bitsize + lr_bitpos == rr_bitpos)
+-	  || (ll_bitpos == rl_bitpos + rl_bitsize
+-	      && lr_bitpos == rr_bitpos + rr_bitsize))
++      if (((ll_bitsize + ll_bitpos == rl_bitpos
++	    && lr_bitsize + lr_bitpos == rr_bitpos)
++	   || (ll_bitpos == rl_bitpos + rl_bitsize
++	       && lr_bitpos == rr_bitpos + rr_bitsize))
++	  && ll_bitpos >= 0
++	  && rl_bitpos >= 0
++	  && lr_bitpos >= 0
++	  && rr_bitpos >= 0)
+ 	{
+ 	  tree type;
+ 
+@@ -5947,6 +5963,9 @@
+ 	}
+     }
+ 
++  if (lnbitpos < 0)
++    return 0;
++
+   /* Construct the expression we will return.  First get the component
+      reference we will make.  Unless the mask is all ones the width of
+      that field, perform the mask operation.  Then compare with the
+@@ -6175,6 +6194,7 @@
        t1 = extract_muldiv (op0, c, code, wide_type, &sub_strict_overflow_p);
        t2 = extract_muldiv (op1, c, code, wide_type, &sub_strict_overflow_p);
        if (t1 != 0 && t2 != 0
@@ -7044,7 +7860,7 @@ Index: gcc/fold-const.c
  	  && (code == MULT_EXPR
  	      /* If not multiplication, we can only do this if both operands
  		 are divisible by c.  */
-@@ -6237,11 +6245,6 @@
+@@ -6237,11 +6257,6 @@
        if (TYPE_UNSIGNED (ctype) && ctype != type)
  	break;
  
@@ -7056,7 +7872,7 @@ Index: gcc/fold-const.c
        /* The last case is if we are a multiply.  In that case, we can
  	 apply the distributive law to commute the multiply and addition
  	 if the multiplication of the constants doesn't overflow
-@@ -7200,15 +7203,10 @@
+@@ -7200,15 +7215,10 @@
  static int
  native_encode_string (const_tree expr, unsigned char *ptr, int len, int off)
  {
@@ -7075,7 +7891,7 @@ Index: gcc/fold-const.c
    if ((off == -1 && total_bytes > len)
        || off >= total_bytes)
      return 0;
-@@ -7502,6 +7500,22 @@
+@@ -7502,6 +7512,22 @@
      }
  }
  
@@ -7098,7 +7914,7 @@ Index: gcc/fold-const.c
  /* Fold a VIEW_CONVERT_EXPR of a constant expression EXPR to type
     TYPE at compile-time.  If we're unable to perform the conversion
     return NULL_TREE.  */
-@@ -8879,7 +8893,7 @@
+@@ -8879,7 +8905,7 @@
        tree op0 = fold_convert_loc (loc, type, TREE_OPERAND (aref0, 1));
        tree op1 = fold_convert_loc (loc, type, TREE_OPERAND (aref1, 1));
        tree esz = fold_convert_loc (loc, type, array_ref_element_size (aref0));
@@ -7107,7 +7923,7 @@ Index: gcc/fold-const.c
        return fold_build2_loc (loc, PLUS_EXPR, type,
  			      base_offset,
  			      fold_build2_loc (loc, MULT_EXPR, type,
-@@ -9638,11 +9652,6 @@
+@@ -9638,11 +9664,6 @@
  		       + (lit0 != 0) + (lit1 != 0)
  		       + (minus_lit0 != 0) + (minus_lit1 != 0))))
  	    {
@@ -7119,7 +7935,7 @@ Index: gcc/fold-const.c
  	      var0 = associate_trees (loc, var0, var1, code, atype);
  	      con0 = associate_trees (loc, con0, con1, code, atype);
  	      lit0 = associate_trees (loc, lit0, lit1, code, atype);
-@@ -9673,9 +9682,8 @@
+@@ -9673,9 +9694,8 @@
  		}
  
  	      /* Don't introduce overflows through reassociation.  */
@@ -7260,7 +8076,56 @@ Index: gcc/ChangeLog
 ===================================================================
 --- a/src/gcc/ChangeLog	(.../tags/gcc_7_2_0_release)
 +++ b/src/gcc/ChangeLog	(.../branches/gcc-7-branch)
-@@ -1,3 +1,643 @@
+@@ -1,3 +1,696 @@
++2017-10-24  Qing Zhao <qing.zhao at oracle.com>
++	    Wilco Dijkstra <wilco.dijkstra at arm.com>
++
++        * builtins.c (expand_builtin_update_setjmp_buf): Add a
++        converstion to Pmode from the buf_addr.
++
++2017-10-20  Richard Biener  <rguenther at suse.de>
++
++	PR tree-optimization/82603
++	* tree-if-conv.c (predicate_mem_writes): Make sure to only
++	remove false predicated stores.
++
++2017-10-20  Richard Biener  <rguenther at suse.de>
++
++	Backport from mainline
++	2017-10-06  Richard Biener  <rguenther at suse.de>
++
++	PR tree-optimization/82436
++	* tree-vect-slp.c (vect_supported_load_permutation_p): More
++	conservatively choose the vectorization factor when checking
++	whether we can perform the required load permutation.
++	(vect_transform_slp_perm_load): Assert when we may not fail.
++
++2017-10-19  Richard Earnshaw  <rearnsha at arm.com>
++
++	PR target/82445
++	* config/arm/arm.c (align_ok_ldrd_strd): New function.
++	(mem_ok_for_ldrd_strd): New parameter align.  Extract the alignment of
++	the mem into it.
++	(gen_operands_ldrd_strd): Validate the alignment of the accesses.
++
++2017-10-18  Segher Boessenkool  <segher at kernel.crashing.org>
++
++	PR rtl-optimization/82602
++	* ira.c (rtx_moveable_p): Return false for volatile asm.
++
++2017-10-18  Vladimir Makarov  <vmakarov at redhat.com>
++
++	PR middle-end/82556
++	* lra-constraints.c (curr_insn_transform): Use non-input operand
++	instead of output one for matched reload.
++
++2017-10-17  Jakub Jelinek  <jakub at redhat.com>
++
++	PR tree-optimization/82549
++	* fold-const.c (optimize_bit_field_compare, fold_truth_andor_1):
++	Formatting fixes.  Instead of calling make_bit_field_ref with negative
++	bitpos return 0.
++
 +2017-10-13  Jakub Jelinek  <jakub at redhat.com>
 +
 +	PR target/82274
@@ -7901,6 +8766,10 @@ Index: gcc/ChangeLog
 +	* config/sh/sh-mem.cc (sh_expand_cmpnstr): Only unroll for
 +	constant count if that count is less than 32.
 +
++2017-08-14  Richard Biener  <rguenther at suse.de>
++
++	* BASE-VER: Set to 7.2.1.
++
  2017-08-14  Release Manager
  
  	* GCC 7.2.0 released.
@@ -8638,6 +9507,56 @@ Index: gcc/testsuite/gcc.target/powerpc/vec-setup-long.c
 +   (on 32-bit systems).  The default endian order is used.  */
 +
 +#include "vec-setup.h"
+Index: gcc/testsuite/gcc.target/arm/peep-strd-1.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/arm/peep-strd-1.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/arm/peep-strd-1.c	(.../branches/gcc-7-branch)
+@@ -6,4 +6,4 @@
+   p[2] = a;
+   p[3] = b;
+ }
+-/* { dg-final { scan-assembler "strd" } } */
++/* { dg-final { scan-assembler "strd\\t" } } */
+Index: gcc/testsuite/gcc.target/arm/peep-strd-2.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/arm/peep-strd-2.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/arm/peep-strd-2.c	(.../branches/gcc-7-branch)
+@@ -0,0 +1,9 @@
++/* { dg-do compile } */
++/* { dg-require-effective-target arm_prefer_ldrd_strd } */
++/* { dg-options "-O2 -mno-unaligned-access" }  */
++void foo(int a, int b, int* p)
++{
++  p[2] = a;
++  p[3] = b;
++}
++/* { dg-final { scan-assembler-not "strd\\t" } } */
+Index: gcc/testsuite/gcc.target/arm/peep-ldrd-1.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/arm/peep-ldrd-1.c	(.../branches/gcc-7-branch)
+@@ -8,4 +8,4 @@
+   *p = a;
+   return a;
+ }
+-/* { dg-final { scan-assembler "ldrd" } } */
++/* { dg-final { scan-assembler "ldrd\\t" } } */
+Index: gcc/testsuite/gcc.target/arm/peep-ldrd-2.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/arm/peep-ldrd-2.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/arm/peep-ldrd-2.c	(.../branches/gcc-7-branch)
+@@ -0,0 +1,11 @@
++/* { dg-do compile } */
++/* { dg-require-effective-target arm_prefer_ldrd_strd } */
++/* { dg-options "-O2 -mno-unaligned-access" }  */
++int foo(int a, int b, int* p, int *q)
++{
++  a = p[2] + p[3];
++  *q = a;
++  *p = a;
++  return a;
++}
++/* { dg-final { scan-assembler-not "ldrd\\t" } } */
 Index: gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c	(.../tags/gcc_7_2_0_release)
@@ -8685,6 +9604,19 @@ Index: gcc/testsuite/gcc.target/aarch64/pr71727-2.c
 +}
 +
 +/* { dg-final { scan-assembler-times "and\tw\[0-9\]+, w\[0-9\]+, 15" 1 } } */
+Index: gcc/testsuite/gcc.target/aarch64/pr80295.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/aarch64/pr80295.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/aarch64/pr80295.c	(.../branches/gcc-7-branch)
+@@ -0,0 +1,8 @@
++/* { dg-do compile } */
++/* { dg-options "-mabi=ilp32" } */
++
++void f (void *b) 
++{ 
++  __builtin_update_setjmp_buf (b); 
++}
++
 Index: gcc/testsuite/gcc.target/i386/pr81921.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.target/i386/pr81921.c	(.../tags/gcc_7_2_0_release)
@@ -8704,6 +9636,30 @@ Index: gcc/testsuite/gcc.target/i386/pr81921.c
 +{
 +  volatile int x = _mm_loadu_si128 (p);
 +}
+Index: gcc/testsuite/gcc.target/i386/pr82556.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/pr82556.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/pr82556.c	(.../branches/gcc-7-branch)
+@@ -0,0 +1,19 @@
++/* { dg-do compile } */
++/* { dg-options "-O2 -fno-strict-aliasing -fwrapv -fexcess-precision=standard" } */
++extern int foo();
++typedef struct {
++  char id;
++  unsigned char fork_flags;
++  short data_length;
++} Header;
++int a;
++void X() {
++  do {
++    char* b;
++    Header c;
++    if (a)
++      c.fork_flags |= 1;
++    __builtin_memcpy(b, &c, __builtin_offsetof(Header, data_length));
++    b += foo();
++  } while (1);
++}
 Index: gcc/testsuite/gcc.target/i386/pr81128.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.target/i386/pr81128.c	(.../tags/gcc_7_2_0_release)
@@ -9077,6 +10033,15 @@ Index: gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90
  !
  subroutine test
    integer, pointer :: p
+Index: gcc/testsuite/gfortran.dg/assumed_size_2.f90
+===================================================================
+--- a/src/gcc/testsuite/gfortran.dg/assumed_size_2.f90	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gfortran.dg/assumed_size_2.f90	(.../branches/gcc-7-branch)
+@@ -0,0 +1,4 @@
++! { dg-do compile }
++subroutine foo(a)
++  dimension  a(*,*) ! { dg-error "Bad specification for assumed size array" }
++end
 Index: gcc/testsuite/gfortran.dg/associate_29.f90
 ===================================================================
 --- a/src/gcc/testsuite/gfortran.dg/associate_29.f90	(.../tags/gcc_7_2_0_release)
@@ -9432,6 +10397,116 @@ Index: gcc/testsuite/gfortran.dg/derived_init_4.f90
 +     if (res%f .ne. -1 ) call abort
 +   end function
 +end program test
+Index: gcc/testsuite/gfortran.dg/typebound_proc_36.f90
+===================================================================
+--- a/src/gcc/testsuite/gfortran.dg/typebound_proc_36.f90	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gfortran.dg/typebound_proc_36.f90	(.../branches/gcc-7-branch)
+@@ -0,0 +1,77 @@
++! { dg-do run }
++!
++! Test the fix for PR82312.f90
++!
++! Posted on Stack Overflow:
++! https://stackoverflow.com/questions/46369744
++! /gfortran-associates-wrong-type-bound-procedure/46388339#46388339
++!
++module minimalisticcase
++    implicit none
++
++    type, public :: DataStructure
++        integer :: i
++    contains
++        procedure, pass :: init => init_data_structure
++        procedure, pass :: a => beginning_of_alphabet
++    end type
++
++    type, public :: DataLogger
++        type(DataStructure), pointer :: data_structure
++        contains
++                procedure, pass :: init => init_data_logger
++                procedure, pass :: do_something => do_something
++    end type
++
++    integer :: ctr = 0
++
++contains
++    subroutine init_data_structure(self)
++        implicit none
++        class(DataStructure), intent(inout) :: self
++        write(*,*) 'init_data_structure'
++        ctr = ctr + 1
++    end subroutine
++
++    subroutine beginning_of_alphabet(self)
++        implicit none
++        class(DataStructure), intent(inout) :: self
++
++        write(*,*) 'beginning_of_alphabet'
++        ctr = ctr + 10
++    end subroutine
++
++    subroutine init_data_logger(self, data_structure)
++        implicit none
++        class(DataLogger), intent(inout) :: self
++        class(DataStructure), target :: data_structure
++        write(*,*) 'init_data_logger'
++        ctr = ctr + 100
++
++        self%data_structure => data_structure ! Invalid change of 'self' vptr
++        call self%do_something()
++    end subroutine
++
++    subroutine do_something(self)
++        implicit none
++        class(DataLogger), intent(inout) :: self
++
++        write(*,*) 'do_something'
++        ctr = ctr + 1000
++
++    end subroutine
++end module
++
++program main
++    use minimalisticcase
++    implicit none
++
++    type(DataStructure) :: data_structure
++    type(DataLogger) :: data_logger
++
++    call data_structure%init()
++    call data_structure%a()
++    call data_logger%init(data_structure)
++
++    if (ctr .ne. 1111) call abort
++end program
+Index: gcc/testsuite/gfortran.dg/execute_command_line_3.f90
+===================================================================
+--- a/src/gcc/testsuite/gfortran.dg/execute_command_line_3.f90	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gfortran.dg/execute_command_line_3.f90	(.../branches/gcc-7-branch)
+@@ -0,0 +1,23 @@
++! { dg-do  run }
++! PR 82233 - there were program aborts for some of these commands.
++! Original test case by Urban Jost.
++program boom
++implicit none
++integer                       :: i,j 
++character(len=256)            :: msg
++character(len=:), allocatable :: command
++   command='notthere'
++   msg='' ! seems to only be defined if exitstatus.ne.0
++   ! ok -- these work
++   call execute_command_line(command , wait=.false., exitstat=i, cmdstat=j, cmdmsg=msg)
++   if (j /= 0 .or. msg /= '') call abort
++   call execute_command_line(command ,               exitstat=i, cmdstat=j, cmdmsg=msg )
++   if (j /= 3 .or. msg /= "Invalid command line" ) call abort
++   msg = ''
++   call execute_command_line(command , wait=.false., exitstat=i,            cmdmsg=msg )
++   if (j /= 3) call abort
++   call execute_command_line(command , wait=.false., exitstat=i                        )
++   if (msg /= '') call abort
++   call execute_command_line(command ,               exitstat=i, cmdstat=j             )
++
++end program boom
 Index: gcc/testsuite/gfortran.dg/associate_27.f90
 ===================================================================
 --- a/src/gcc/testsuite/gfortran.dg/associate_27.f90	(.../tags/gcc_7_2_0_release)
@@ -9679,6 +10754,20 @@ Index: gcc/testsuite/gcc.c-torture/compile/string-large-1.c
 +  vp3 = __builtin_strncpy (a, b, SIZE3);
 +  vp4 = __builtin_strncpy (a, b, SIZE4);
 +}
+Index: gcc/testsuite/gcc.c-torture/compile/pr82549.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.c-torture/compile/pr82549.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.c-torture/compile/pr82549.c	(.../branches/gcc-7-branch)
+@@ -0,0 +1,9 @@
++/* PR tree-optimization/82549 */
++
++int a, b[1];
++
++int
++main ()
++{
++  return !a || b[-2] || b[-2];
++}
 Index: gcc/testsuite/gcc.c-torture/compile/pr82337.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.c-torture/compile/pr82337.c	(.../tags/gcc_7_2_0_release)
@@ -10243,6 +11332,21 @@ Index: gcc/testsuite/gcc.dg/asan/pr81923.c
 +{
 +  return 0;
 +}
+Index: gcc/testsuite/gcc.dg/attr-alloc_size-11.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.dg/attr-alloc_size-11.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.dg/attr-alloc_size-11.c	(.../branches/gcc-7-branch)
+@@ -47,8 +47,8 @@
+ 
+ /* The following tests fail because of missing range information.  The xfail
+    exclusions are PR79356.  */
+-TEST (signed char, SCHAR_MIN + 2, ALLOC_MAX);   /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for signed char" { xfail { ! { aarch64*-*-* arm*-*-* alpha*-*-* ia64-*-* mips*-*-* powerpc*-*-* sparc*-*-* s390*-*-* } } } } */
+-TEST (short, SHRT_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for short" { xfail { ! { aarch64*-*-* arm*-*-* alpha*-*-* ia64-*-* mips*-*-* powerpc*-*-* sparc*-*-* s390x-*-* } } } } */
++TEST (signed char, SCHAR_MIN + 2, ALLOC_MAX);   /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for signed char" { xfail { ! { aarch64*-*-* arm*-*-* alpha*-*-* ia64-*-* mips*-*-* powerpc*-*-* sparc*-*-* s390*-*-* visium-*-* } } } } */
++TEST (short, SHRT_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for short" { xfail { ! { aarch64*-*-* arm*-*-* alpha*-*-* ia64-*-* mips*-*-* powerpc*-*-* sparc*-*-* s390x-*-* visium-*-* } } } } */
+ TEST (int, INT_MIN + 2, ALLOC_MAX);    /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" } */
+ TEST (int, -3, ALLOC_MAX);             /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" } */
+ TEST (int, -2, ALLOC_MAX);             /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" } */
 Index: gcc/testsuite/gcc.dg/pr81621.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.dg/pr81621.c	(.../tags/gcc_7_2_0_release)
@@ -10382,6 +11486,35 @@ Index: gcc/testsuite/gcc.dg/torture/pr82244.c
 +      }
 +  }
 +}
+Index: gcc/testsuite/gcc.dg/torture/pr82603.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.dg/torture/pr82603.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.dg/torture/pr82603.c	(.../branches/gcc-7-branch)
+@@ -0,0 +1,24 @@
++/* { dg-do compile } */
++/* { dg-additional-options "-ftree-loop-vectorize" } */
++
++int
++mr (unsigned int lf, int ms)
++{
++  unsigned int sw = 0;
++  char *cu = (char *)&ms;
++
++  while (ms < 1)
++    {
++      if (lf == 0)
++	ms = 0;
++      else
++	ms = 0;
++      ms += ((lf > 0) && ((lf > sw) ? 1 : ++*cu));
++    }
++
++  if (lf != 0)
++    cu = (char *)&sw;
++  *cu = lf;
++
++  return ms;
++}
 Index: gcc/testsuite/gcc.dg/torture/pr82264.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.dg/torture/pr82264.c	(.../tags/gcc_7_2_0_release)
@@ -10640,6 +11773,46 @@ Index: gcc/testsuite/gcc.dg/vect/pr82108.c
 +}
 +
 +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+Index: gcc/testsuite/gcc.dg/vect/pr82436.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.dg/vect/pr82436.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.dg/vect/pr82436.c	(.../branches/gcc-7-branch)
+@@ -0,0 +1,35 @@
++/* { dg-do compile } */
++/* { dg-additional-options "-Ofast -fno-tree-scev-cprop" } */
++/* { dg-additional-options "-mavx2" { target { x86_64-*-* i?86-*-* } } } */
++
++struct reflection_type
++{
++  int h;
++  int k;
++  int l;
++  double f_exp;
++  double f_sigma;
++  _Complex double f_calc;
++  double f_pred;
++  double i_exp;
++  double i_sigma;
++  double i_pred;
++};
++
++double y, w;
++int foo (struct reflection_type *r, int n, unsigned s)
++{
++  int i;
++  y = 0;
++  w = 0;
++  for (i = 1; i < n; ++i)
++    {
++      struct reflection_type *x = &r[i*s];
++      double fpred = x->f_pred;
++      double fexp = x->f_exp;
++      double tem = (fpred - fexp);
++      y += __builtin_fabs (tem / x->f_sigma);
++      w += __builtin_fabs (tem / fexp);
++    }
++  return i;
++}
 Index: gcc/testsuite/gcc.dg/pr82274-1.c
 ===================================================================
 --- a/src/gcc/testsuite/gcc.dg/pr82274-1.c	(.../tags/gcc_7_2_0_release)
@@ -10665,30 +11838,94 @@ 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,492 @@
+@@ -1,3 +1,556 @@
++2017-10-24  Qing Zhao <qing.zhao at oracle.com>
++	    Wilco Dijkstra <wilco.dijkstra at arm.com>
++
++        PR middle-end/80295
++        * gcc.target/aarch64/pr80295.c: New test.
++
++2017-10-21  Paul Thomas  <pault at gcc.gnu.org>
++
++	Backport from trunk
++	PR fortran/82312
++	* gfortran.dg/typebound_proc_36.f90 : New test.
++
++2017-10-20  Thomas Koenig  <tkoenig at gcc.gnu.org>
++
++	Backport from trunk
++	PR fortran/79795
++	* gfortran.dg/assumed_size_2.f90: New test.
++
++2017-10-20  Richard Biener  <rguenther at suse.de>
++
++	PR tree-optimization/82603
++	* gcc.dg/torture/pr82603.c: New testcase.
++
++2017-10-20  Richard Biener  <rguenther at suse.de>
++
++	Backport from mainline
++	2017-10-06  Richard Biener  <rguenther at suse.de>
++
++	PR tree-optimization/82436
++	* gcc.dg/vect/pr82436.c: New testcase.
++
++2017-10-19  Thomas Koenig  <tkoenig at gcc.gnu.org>
++
++	Backport from trunk
++	PR libfortran/82233
++	* gfortran.dg/execute_command_line_3.f90: New test.
++
++2017-10-19  Richard Earnshaw  <rearnsha at arm.com>
++
++	PR target/82445
++	* gcc.target/arm/peep-ldrd-1.c: Tighten test scan pattern.
++	* gcc.target/arm/peep-strd-1.c: Likewise.
++	* gcc.target/arm/peep-ldrd-2.c: New test.
++	* gcc.target/arm/peep-strd-2.c: New test.
++
++2017-10-18  Vladimir Makarov  <vmakarov at redhat.com>
++
++	PR middle-end/82556
++	* gcc.target/i386/pr82556.c: New.
++
++2017-10-17  Eric Botcazou  <ebotcazou at adacore.com>
++
++	* gcc.dg/attr-alloc_size-11.c: UnXFAIL for visium-*-*.
++
++2017-10-17  Nathan Sidwell  <nathan at acm.org>
++
++	PR c++/82560
++	* g++.dg/cpp0x/pr82560.C: New.
++
++2017-10-17  Jakub Jelinek  <jakub at redhat.com>
++
++	PR tree-optimization/82549
++	* gcc.c-torture/compile/pr82549.c: New test.
++
 +2017-10-16  Paul Thomas  <pault at gcc.gnu.org>
 +
 +	PR fortran/78512
-+	* gfortran.dg/associate_9.f03 : Remove XFAIL.
-+	* gfortran.dg/associate_26.f90 : New test.
++	* gfortran.dg/associate_9.f03: Remove XFAIL.
++	* gfortran.dg/associate_26.f90: New test.
 +
 +	PR fortran/80120
-+	* gfortran.dg/associate_27.f90 : New test.
++	* gfortran.dg/associate_27.f90: New test.
 +
 +	PR fortran/81903
-+	* gfortran.dg/associate_28.f90 : New test.
++	* gfortran.dg/associate_28.f90: New test.
 +
 +	PR fortran/82121
-+	* gfortran.dg/associate_29.f90 : New test.
++	* gfortran.dg/associate_29.f90: New test.
 +
 +	PR fortran/67543
-+	* gfortran.dg/associate_30.f90 : New test.
++	* gfortran.dg/associate_30.f90: New test.
 +
 +2017-10-16  Paul Thomas  <pault at gcc.gnu.org>
 +
 +	Backport from trunk
 +	PR fortran/81048
-+	* gfortran.dg/derived_init_4.f90 : New test.
++	* gfortran.dg/derived_init_4.f90: New test.
 +
 +2017-10-13  Jakub Jelinek  <jakub at redhat.com>
 +
@@ -11158,7 +12395,7 @@ Index: gcc/testsuite/ChangeLog
  2017-08-14  Release Manager
  
  	* GCC 7.2.0 released.
-@@ -150,7 +639,7 @@
+@@ -150,7 +703,7 @@
  	* gfortran.dg/pr81175.f: New testcase.
  
  	2017-06-21  Marc Glisse  <marc.glisse at inria.fr>
@@ -11167,7 +12404,7 @@ Index: gcc/testsuite/ChangeLog
   	* gcc.dg/tree-ssa/addadd.c: Un-XFAIL.
   	* gcc.dg/tree-ssa/addadd-2.c: New file.
  
-@@ -358,7 +847,7 @@
+@@ -358,7 +911,7 @@
  	* c-c++-common/ubsan/sanitize-recover-7.c (dg-options): Add -w.
  
  2017-06-24  Marek Polacek  <polacek at redhat.com>
@@ -11176,6 +12413,32 @@ Index: gcc/testsuite/ChangeLog
  	Backport from mainline
  	2017-05-04  Marek Polacek  <polacek at redhat.com>
  
+@@ -2273,7 +2826,7 @@
+ 
+ 	PR fortran/80156
+ 	PR fortran/79382
+-	* gfortran.dg/dtio_23.f90 : Remove the dg-error and add the
++	* gfortran.dg/dtio_23.f90: Remove the dg-error and add the
+ 	testcase for PR80156. Add a main programme that tests that
+ 	the typebound generic is accessible.
+ 
+@@ -2609,13 +3162,13 @@
+ 2017-03-18  Paul Thomas  <pault at gcc.gnu.org>
+ 
+ 	PR fortran/79676
+-	* gfortran.dg/submodule_28.f08 : New test.
++	* gfortran.dg/submodule_28.f08: New test.
+ 
+ 2017-03-18  Paul Thomas  <pault at gcc.gnu.org>
+ 
+ 	PR fortran/71838
+-	* gfortran.dg/submodule_26.f08 : New test.
+-	* gfortran.dg/submodule_27.f08 : New test.
++	* gfortran.dg/submodule_26.f08: New test.
++	* gfortran.dg/submodule_27.f08: New test.
+ 
+ 2017-03-17  Pat Haugen  <pthaugen at us.ibm.com>
+ 
 Index: gcc/testsuite/g++.dg/opt/pr82159.C
 ===================================================================
 --- a/src/gcc/testsuite/g++.dg/opt/pr82159.C	(.../tags/gcc_7_2_0_release)
@@ -11364,6 +12627,39 @@ Index: gcc/testsuite/g++.dg/cpp0x/pr81325.C
 +  L h(0);
 +  p1->m_fn4(h, 0);
 +}
+Index: gcc/testsuite/g++.dg/cpp0x/pr82560.C
+===================================================================
+--- a/src/gcc/testsuite/g++.dg/cpp0x/pr82560.C	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/g++.dg/cpp0x/pr82560.C	(.../branches/gcc-7-branch)
+@@ -0,0 +1,28 @@
++// { dg-do run { target c++11 } }
++// PR82560, failed to destruct default arg inside new
++
++static int liveness = 0;
++
++struct Foo {
++
++  Foo (int) {
++    liveness++;
++  }
++
++  ~Foo() {
++    liveness--;
++  }
++
++};
++
++struct Bar {
++  Bar (Foo = 0) { }
++  ~Bar() { }
++};
++
++int main()
++{
++  delete new Bar();
++
++  return liveness != 0;;
++}
 Index: gcc/testsuite/g++.dg/torture/pr81884.C
 ===================================================================
 --- a/src/gcc/testsuite/g++.dg/torture/pr81884.C	(.../tags/gcc_7_2_0_release)
@@ -12201,7 +13497,13 @@ 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,98 @@
+@@ -1,3 +1,104 @@
++2017-10-17  Nathan Sidwell  <nathan at acm.org>
++
++	PR c++/82560
++	* call.c (build_over_call): Don't pass tf_no_cleanup to nested
++	calls.
++
 +2017-10-06  Jakub Jelinek  <jakub at redhat.com>
 +
 +	PR c++/82299
@@ -12300,7 +13602,7 @@ Index: gcc/cp/ChangeLog
  2017-08-14  Release Manager
  
  	* GCC 7.2.0 released.
-@@ -4,8 +99,8 @@
+@@ -4,8 +105,8 @@
  
  2017-08-09  Leonid Koppel  <lkoppel at uwaterloo.ca>
  
@@ -12519,7 +13821,39 @@ Index: gcc/cp/call.c
      }
  
    return arg;
-@@ -9128,7 +9138,9 @@
+@@ -7658,8 +7668,11 @@
+     }
+ 
+   /* N3276 magic doesn't apply to nested calls.  */
+-  int decltype_flag = (complain & tf_decltype);
++  tsubst_flags_t decltype_flag = (complain & tf_decltype);
+   complain &= ~tf_decltype;
++  /* No-Cleanup doesn't apply to nested calls either.  */
++  tsubst_flags_t no_cleanup_complain = complain;
++  complain &= ~tf_no_cleanup;
+ 
+   /* Find maximum size of vector to hold converted arguments.  */
+   parmlen = list_length (parm);
+@@ -7841,7 +7854,7 @@
+       if (flags & LOOKUP_NO_CONVERSION)
+ 	conv->user_conv_p = true;
+ 
+-      tsubst_flags_t arg_complain = complain & (~tf_no_cleanup);
++      tsubst_flags_t arg_complain = complain;
+       if (!conversion_warning)
+ 	arg_complain &= ~tf_warning;
+ 
+@@ -8086,7 +8099,8 @@
+       else if (default_ctor_p (fn))
+ 	{
+ 	  if (is_dummy_object (argarray[0]))
+-	    return force_target_expr (DECL_CONTEXT (fn), void_node, complain);
++	    return force_target_expr (DECL_CONTEXT (fn), void_node,
++				      no_cleanup_complain);
+ 	  else
+ 	    return cp_build_indirect_ref (argarray[0], RO_NULL, complain);
+ 	}
+@@ -9128,7 +9142,9 @@
  	return 0;
        else if (t1->kind == ck_user)
  	{
@@ -13278,7 +14612,11 @@ Index: gcc/ada/ChangeLog
 ===================================================================
 --- a/src/gcc/ada/ChangeLog	(.../tags/gcc_7_2_0_release)
 +++ b/src/gcc/ada/ChangeLog	(.../branches/gcc-7-branch)
-@@ -1,3 +1,64 @@
+@@ -1,3 +1,68 @@
++2017-10-21  Eric Botcazou  <ebotcazou at adacore.com>
++
++	* gcc-interface/Makefile.in: Remove bogus settings for VxWorks.
++
 +2017-10-05  Eric Botcazou  <ebotcazou at adacore.com>
 +
 +	PR ada/82393
@@ -13388,6 +14726,54 @@ Index: gcc/ada/gcc-interface/utils.c
      }
  
    /* An unchecked conversion should never raise Constraint_Error.  The code
+Index: gcc/ada/gcc-interface/Makefile.in
+===================================================================
+--- a/src/gcc/ada/gcc-interface/Makefile.in	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/ada/gcc-interface/Makefile.in	(.../branches/gcc-7-branch)
+@@ -904,10 +904,10 @@
+ 
+   ifeq ($(strip $(filter-out x86_64, $(target_cpu))),)
+      X86CPU=x86_64
+-     LIBGNAT_TARGET_PAIRS=s-atocou.adb<s-atocou-builtin.adb
++     LIBGNAT_TARGET_PAIRS=$(X86_64_TARGET_PAIRS)
+   else
+      X86CPU=x86
+-     LIBGNAT_TARGET_PAIRS=s-atocou.adb<s-atocou-x86.adb
++     LIBGNAT_TARGET_PAIRS=$(X86_TARGET_PAIRS)
+   endif
+ 
+   LIBGNAT_TARGET_PAIRS+= \
+@@ -930,10 +930,7 @@
+   g-socthi.ads<g-socthi-vxworks.ads \
+   g-socthi.adb<g-socthi-vxworks.adb \
+   g-stsifd.adb<g-stsifd-sockets.adb \
+-  $(ATOMICS_TARGET_PAIRS) \
+-  $(CERTMATH_TARGET_PAIRS) \
+-  $(CERTMATH_TARGET_PAIRS_SQRT_FPU) \
+-  $(CERTMATH_TARGET_PAIRS_X86TRA)
++  $(ATOMICS_TARGET_PAIRS)
+ 
+   TOOLS_TARGET_PAIRS=\
+   mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
+@@ -1033,8 +1030,7 @@
+     endif
+   endif
+ 
+-  EXTRA_GNATRTL_NONTASKING_OBJS += s-stchop.o \
+-    $(CERTMATH_GNATRTL_OBJS) $(CERTMATH_GNATRTL_X86TRA_OBJS)
++  EXTRA_GNATRTL_NONTASKING_OBJS += s-stchop.o
+   EXTRA_GNATRTL_TASKING_OBJS += i-vxinco.o s-vxwork.o s-vxwext.o
+ 
+   EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
+@@ -1135,7 +1131,7 @@
+     endif
+   endif
+ 
+-  EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o $(CERTMATH_GNATRTL_OBJS) \
++  EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o \
+     s-stchop.o
+   EXTRA_GNATRTL_TASKING_OBJS=i-vxinco.o s-vxwork.o s-vxwext.o
+ 
 Index: gcc/ada/gcc-interface/decl.c
 ===================================================================
 --- a/src/gcc/ada/gcc-interface/decl.c	(.../tags/gcc_7_2_0_release)
@@ -14038,11 +15424,146 @@ Index: gcc/gimple-ssa-strength-reduction.c
  }
  
  namespace {
+Index: gcc/fortran/trans-expr.c
+===================================================================
+--- a/src/gcc/fortran/trans-expr.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/fortran/trans-expr.c	(.../branches/gcc-7-branch)
+@@ -8205,6 +8205,39 @@
+ }
+ 
+ 
++/* Do everything that is needed for a CLASS function expr2.  */
++
++static tree
++trans_class_pointer_fcn (stmtblock_t *block, gfc_se *lse, gfc_se *rse,
++			 gfc_expr *expr1, gfc_expr *expr2)
++{
++  tree expr1_vptr = NULL_TREE;
++  tree tmp;
++
++  gfc_conv_function_expr (rse, expr2);
++  rse->expr = gfc_evaluate_now (rse->expr, &rse->pre);
++
++  if (expr1->ts.type != BT_CLASS)
++      rse->expr = gfc_class_data_get (rse->expr);
++  else
++    {
++      expr1_vptr = trans_class_vptr_len_assignment (block, expr1,
++						    expr2, rse,
++						    NULL, NULL);
++      gfc_add_block_to_block (block, &rse->pre);
++      tmp = gfc_create_var (TREE_TYPE (rse->expr), "ptrtemp");
++      gfc_add_modify (&lse->pre, tmp, rse->expr);
++
++      gfc_add_modify (&lse->pre, expr1_vptr,
++		      fold_convert (TREE_TYPE (expr1_vptr),
++		      gfc_class_vptr_get (tmp)));
++      rse->expr = gfc_class_data_get (tmp);
++    }
++
++  return expr1_vptr;
++}
++
++
+ tree
+ gfc_trans_pointer_assign (gfc_code * code)
+ {
+@@ -8223,6 +8256,7 @@
+   tree desc;
+   tree tmp;
+   tree decl;
++  tree expr1_vptr = NULL_TREE;
+   bool scalar, non_proc_pointer_assign;
+   gfc_ss *ss;
+ 
+@@ -8256,7 +8290,10 @@
+       gfc_conv_expr (&lse, expr1);
+       gfc_init_se (&rse, NULL);
+       rse.want_pointer = 1;
+-      gfc_conv_expr (&rse, expr2);
++      if (expr2->expr_type == EXPR_FUNCTION && expr2->ts.type == BT_CLASS)
++	trans_class_pointer_fcn (&block, &lse, &rse, expr1, expr2);
++      else
++	gfc_conv_expr (&rse, expr2);
+ 
+       if (non_proc_pointer_assign && expr1->ts.type == BT_CLASS)
+ 	{
+@@ -8268,12 +8305,12 @@
+       if (expr1->symtree->n.sym->attr.proc_pointer
+ 	  && expr1->symtree->n.sym->attr.dummy)
+ 	lse.expr = build_fold_indirect_ref_loc (input_location,
+-					    lse.expr);
++						lse.expr);
+ 
+       if (expr2->symtree && expr2->symtree->n.sym->attr.proc_pointer
+ 	  && expr2->symtree->n.sym->attr.dummy)
+ 	rse.expr = build_fold_indirect_ref_loc (input_location,
+-					    rse.expr);
++						rse.expr);
+ 
+       gfc_add_block_to_block (&block, &lse.pre);
+       gfc_add_block_to_block (&block, &rse.pre);
+@@ -8319,7 +8356,6 @@
+     {
+       gfc_ref* remap;
+       bool rank_remap;
+-      tree expr1_vptr = NULL_TREE;
+       tree strlen_lhs;
+       tree strlen_rhs = NULL_TREE;
+ 
+@@ -8354,26 +8390,8 @@
+ 	  rse.byref_noassign = 1;
+ 
+ 	  if (expr2->expr_type == EXPR_FUNCTION && expr2->ts.type == BT_CLASS)
+-	    {
+-	      gfc_conv_function_expr (&rse, expr2);
+-
+-	      if (expr1->ts.type != BT_CLASS)
+-		rse.expr = gfc_class_data_get (rse.expr);
+-	      else
+-		{
+-		  expr1_vptr = trans_class_vptr_len_assignment (&block, expr1,
+-								expr2, &rse,
+-								NULL, NULL);
+-		  gfc_add_block_to_block (&block, &rse.pre);
+-		  tmp = gfc_create_var (TREE_TYPE (rse.expr), "ptrtemp");
+-		  gfc_add_modify (&lse.pre, tmp, rse.expr);
+-
+-		  gfc_add_modify (&lse.pre, expr1_vptr,
+-				  fold_convert (TREE_TYPE (expr1_vptr),
+-						gfc_class_vptr_get (tmp)));
+-		  rse.expr = gfc_class_data_get (tmp);
+-		}
+-	    }
++	    expr1_vptr = trans_class_pointer_fcn (&block, &lse, &rse,
++						  expr1, expr2);
+ 	  else if (expr2->expr_type == EXPR_FUNCTION)
+ 	    {
+ 	      tree bound[GFC_MAX_DIMENSIONS];
 Index: gcc/fortran/ChangeLog
 ===================================================================
 --- a/src/gcc/fortran/ChangeLog	(.../tags/gcc_7_2_0_release)
 +++ b/src/gcc/fortran/ChangeLog	(.../branches/gcc-7-branch)
-@@ -1,3 +1,65 @@
+@@ -1,3 +1,84 @@
++2017-10-21  Paul Thomas  <pault at gcc.gnu.org>
++
++	Backport from trunk
++	PR fortran/82312
++	* resolve.c (gfc_resolve_code): Simplify condition for class
++	pointer assignments becoming regular assignments by asserting
++	that only class valued targets are permitted.
++	* trans-expr.c (trans_class_pointer_fcn): New function using a
++	block of code from gfc_trans_pointer_assignment.
++	(gfc_trans_pointer_assignment): Call the new function. Tidy up
++	a minor whitespace issue.
++
++2017-10-20  Thomas Koenig  <tkoenig at gcc.gnu.org>
++
++	Backport from trunk
++	PR fortran/79795
++	* resolve.c (resovle_symbol): Change gcc_assert to
++	sensible error message.
++
 +2017-10-16  Paul Thomas  <pault at gcc.gnu.org>
 +
 +	PR fortran/52832
@@ -14179,7 +15700,20 @@ Index: gcc/fortran/resolve.c
    gcc_assert (sym->ts.type != BT_UNKNOWN);
  
    /* See if this is a valid association-to-variable.  */
-@@ -11824,6 +11836,7 @@
+@@ -11005,11 +11017,8 @@
+ 
+ 	    /* Assigning a class object always is a regular assign.  */
+ 	    if (code->expr2->ts.type == BT_CLASS
++		&& code->expr1->ts.type == BT_CLASS
+ 		&& !CLASS_DATA (code->expr2)->attr.dimension
+-		&& !(UNLIMITED_POLY (code->expr2)
+-		     && code->expr1->ts.type == BT_DERIVED
+-		     && (code->expr1->ts.u.derived->attr.sequence
+-			 || code->expr1->ts.u.derived->attr.is_bind_c))
+ 		&& !(gfc_expr_attr (code->expr1).proc_pointer
+ 		     && code->expr2->expr_type == EXPR_VARIABLE
+ 		     && code->expr2->symtree->n.sym->attr.flavor
+@@ -11824,6 +11833,7 @@
    if (sym->ts.deferred
        && !(sym->attr.pointer
  	   || sym->attr.allocatable
@@ -14187,7 +15721,32 @@ Index: gcc/fortran/resolve.c
  	   || sym->attr.omp_udr_artificial_var))
      {
        gfc_error ("Entity %qs at %L has a deferred type parameter and "
-@@ -14609,6 +14622,7 @@
+@@ -14231,7 +14241,23 @@
+ 
+   if (as)
+     {
+-      gcc_assert (as->type != AS_IMPLIED_SHAPE);
++      /* If AS_IMPLIED_SHAPE makes it to here, it must be a bad
++	 specification expression.  */
++      if (as->type == AS_IMPLIED_SHAPE)
++	{
++	  int i;
++	  for (i=0; i<as->rank; i++)
++	    {
++	      if (as->lower[i] != NULL && as->upper[i] == NULL)
++		{
++		  gfc_error ("Bad specification for assumed size array at %L",
++			     &as->lower[i]->where);
++		  return;
++		}
++	    }
++	  gcc_unreachable();
++	}
++
+       if (((as->type == AS_ASSUMED_SIZE && !as->cp_was_assumed)
+ 	   || as->type == AS_ASSUMED_SHAPE)
+ 	  && !sym->attr.dummy && !sym->attr.select_type_temporary)
+@@ -14609,6 +14635,7 @@
    if (class_attr.codimension
        && !(class_attr.allocatable || sym->attr.dummy || sym->attr.save
  	   || sym->attr.select_type_temporary
@@ -14195,7 +15754,7 @@ Index: gcc/fortran/resolve.c
  	   || (sym->ns->save_all && !sym->attr.automatic)
  	   || sym->ns->proc_name->attr.flavor == FL_MODULE
  	   || sym->ns->proc_name->attr.is_main_program
-@@ -14793,7 +14807,12 @@
+@@ -14793,7 +14820,12 @@
  
        if ((!a->save && !a->dummy && !a->pointer
  	   && !a->in_common && !a->use_assoc
@@ -14403,6 +15962,13 @@ Index: gcc/fortran/primary.c
        old_loc = gfc_current_locus;
        if (gfc_match_member_sep (sym) == MATCH_YES
  	  && sym->ts.type == BT_UNKNOWN
+Index: gcc/BASE-VER
+===================================================================
+--- a/src/gcc/BASE-VER	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/BASE-VER	(.../branches/gcc-7-branch)
+@@ -1 +1 @@
+-7.2.0
++7.2.1
 Index: gcc/langhooks.h
 ===================================================================
 --- a/src/gcc/langhooks.h	(.../tags/gcc_7_2_0_release)
@@ -14431,7 +15997,7 @@ Index: gcc/tree-if-conv.c
  	continue;
  
        swap = false;
-@@ -2211,96 +2211,106 @@
+@@ -2211,96 +2211,107 @@
        vect_sizes.truncate (0);
        vect_masks.truncate (0);
  
@@ -14471,7 +16037,8 @@ Index: gcc/tree-if-conv.c
 +	{
 +	  if (!gimple_assign_single_p (stmt = gsi_stmt (gsi)))
 +	    ;
-+	  else if (is_false_predicate (cond))
++	  else if (is_false_predicate (cond)
++		   && gimple_vdef (stmt))
 +	    {
 +	      unlink_stmt_vdef (stmt);
 +	      gsi_remove (&gsi, true);
@@ -14641,6 +16208,42 @@ Index: gcc/gimplify.c
      {
        gimplify_stmt (from_p, pre_p);
        gimplify_stmt (to_p, pre_p);
+Index: gcc/lra-constraints.c
+===================================================================
+--- a/src/gcc/lra-constraints.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/lra-constraints.c	(.../branches/gcc-7-branch)
+@@ -4284,7 +4284,13 @@
+ 	}
+       else if (curr_static_id->operand[i].type == OP_IN
+ 	       && (curr_static_id->operand[goal_alt_matched[i][0]].type
+-		   == OP_OUT))
++		   == OP_OUT
++		   || (curr_static_id->operand[goal_alt_matched[i][0]].type
++		       == OP_INOUT
++		       && (operands_match_p
++			   (*curr_id->operand_loc[i],
++			    *curr_id->operand_loc[goal_alt_matched[i][0]],
++			    -1)))))
+ 	{
+ 	  /* generate reloads for input and matched outputs.  */
+ 	  match_inputs[0] = i;
+@@ -4295,9 +4301,14 @@
+ 			[goal_alt_number * n_operands + goal_alt_matched[i][0]]
+ 			.earlyclobber);
+ 	}
+-      else if (curr_static_id->operand[i].type == OP_OUT
++      else if ((curr_static_id->operand[i].type == OP_OUT
++		|| (curr_static_id->operand[i].type == OP_INOUT
++		    && (operands_match_p
++			(*curr_id->operand_loc[i],
++			 *curr_id->operand_loc[goal_alt_matched[i][0]],
++			 -1))))
+ 	       && (curr_static_id->operand[goal_alt_matched[i][0]].type
+-		   == OP_IN))
++		    == OP_IN))
+ 	/* Generate reloads for output and matched inputs.  */
+ 	match_reload (i, goal_alt_matched[i], outputs, goal_alt[i], &before,
+ 		      &after, curr_static_id->operand_alternative
 Index: gcc/calls.c
 ===================================================================
 --- a/src/gcc/calls.c	(.../tags/gcc_7_2_0_release)
@@ -316847,6 +318450,23 @@ Index: gcc/tree-vect-patterns.c
  	  || TYPE_PRECISION (TREE_TYPE (lhs)) == 1)
  	return NULL;
        vectype = get_vectype_for_scalar_type (TREE_TYPE (lhs));
+Index: gcc/ira.c
+===================================================================
+--- a/src/gcc/ira.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/ira.c	(.../branches/gcc-7-branch)
+@@ -4406,6 +4406,12 @@
+ 	 for a reason.  */
+       return false;
+ 
++    case ASM_OPERANDS:
++      /* The same is true for volatile asm: it has unknown side effects, it
++         cannot be moved at will.  */
++      if (MEM_VOLATILE_P (x))
++	return false;
++
+     default:
+       break;
+     }
 Index: gcc/tree-vect-stmts.c
 ===================================================================
 --- a/src/gcc/tree-vect-stmts.c	(.../tags/gcc_7_2_0_release)
@@ -318644,6 +320264,82 @@ Index: gcc/config/rs6000/sysv4.h
  
  #define LINK_START_LINUX_SPEC ""
  
+Index: gcc/config/arm/arm.c
+===================================================================
+--- a/src/gcc/config/arm/arm.c	(.../tags/gcc_7_2_0_release)
++++ b/src/gcc/config/arm/arm.c	(.../branches/gcc-7-branch)
+@@ -15199,12 +15199,23 @@
+   return true;
+ }
+ 
++/* Return true if a 64-bit access with alignment ALIGN and with a
++   constant offset OFFSET from the base pointer is permitted on this
++   architecture.  */
++static bool
++align_ok_ldrd_strd (HOST_WIDE_INT align, HOST_WIDE_INT offset)
++{
++  return (unaligned_access
++	  ? (align >= BITS_PER_WORD && (offset & 3) == 0)
++	  : (align >= 2 * BITS_PER_WORD && (offset & 7) == 0));
++}
++
+ /* Helper for gen_operands_ldrd_strd.  Returns true iff the memory
+    operand MEM's address contains an immediate offset from the base
+-   register and has no side effects, in which case it sets BASE and
+-   OFFSET accordingly.  */
++   register and has no side effects, in which case it sets BASE,
++   OFFSET and ALIGN accordingly.  */
+ static bool
+-mem_ok_for_ldrd_strd (rtx mem, rtx *base, rtx *offset)
++mem_ok_for_ldrd_strd (rtx mem, rtx *base, rtx *offset, HOST_WIDE_INT *align)
+ {
+   rtx addr;
+ 
+@@ -15223,6 +15234,7 @@
+   gcc_assert (MEM_P (mem));
+ 
+   *offset = const0_rtx;
++  *align = MEM_ALIGN (mem);
+ 
+   addr = XEXP (mem, 0);
+ 
+@@ -15263,7 +15275,7 @@
+                         bool const_store, bool commute)
+ {
+   int nops = 2;
+-  HOST_WIDE_INT offsets[2], offset;
++  HOST_WIDE_INT offsets[2], offset, align[2];
+   rtx base = NULL_RTX;
+   rtx cur_base, cur_offset, tmp;
+   int i, gap;
+@@ -15275,7 +15287,8 @@
+      registers, and the corresponding memory offsets.  */
+   for (i = 0; i < nops; i++)
+     {
+-      if (!mem_ok_for_ldrd_strd (operands[nops+i], &cur_base, &cur_offset))
++      if (!mem_ok_for_ldrd_strd (operands[nops+i], &cur_base, &cur_offset,
++				 &align[i]))
+         return false;
+ 
+       if (i == 0)
+@@ -15389,6 +15402,7 @@
+       /* Swap the instructions such that lower memory is accessed first.  */
+       std::swap (operands[0], operands[1]);
+       std::swap (operands[2], operands[3]);
++      std::swap (align[0], align[1]);
+       if (const_store)
+         std::swap (operands[4], operands[5]);
+     }
+@@ -15402,6 +15416,9 @@
+   if (gap != 4)
+     return false;
+ 
++  if (!align_ok_ldrd_strd (align[0], offset))
++    return false;
++
+   /* Make sure we generate legal instructions.  */
+   if (operands_ok_ldrd_strd (operands[0], operands[1], base, offset,
+                              false, load))
 Index: gcc/tree-vect-slp.c
 ===================================================================
 --- a/src/gcc/tree-vect-slp.c	(.../tags/gcc_7_2_0_release)
@@ -318756,7 +320452,33 @@ Index: gcc/tree-vect-slp.c
    /* Create SLP_TREE nodes for the definition node/s.  */
    FOR_EACH_VEC_ELT (oprnds_info, i, oprnd_info)
      {
-@@ -1874,9 +1947,11 @@
+@@ -1494,14 +1567,20 @@
+       return true;
+     }
+ 
+-  /* For loop vectorization verify we can generate the permutation.  */
++  /* For loop vectorization verify we can generate the permutation.  Be
++     conservative about the vectorization factor, there are permutations
++     that will use three vector inputs only starting from a specific factor
++     and the vectorization factor is not yet final.
++     ???  The SLP instance unrolling factor might not be the maximum one.  */
+   unsigned n_perms;
++  unsigned test_vf
++    = least_common_multiple (SLP_INSTANCE_UNROLLING_FACTOR (slp_instn),
++			     LOOP_VINFO_VECT_FACTOR
++			       (STMT_VINFO_LOOP_VINFO (vinfo_for_stmt (stmt))));
+   FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node)
+     if (node->load_permutation.exists ()
+-	&& !vect_transform_slp_perm_load
+-	      (node, vNULL, NULL,
+-	       SLP_INSTANCE_UNROLLING_FACTOR (slp_instn), slp_instn, true,
+-	       &n_perms))
++	&& !vect_transform_slp_perm_load (node, vNULL, NULL, test_vf,
++					  slp_instn, true, &n_perms))
+       return false;
+ 
+   return true;
+@@ -1874,9 +1953,11 @@
    /* Build the tree for the SLP instance.  */
    bool *matches = XALLOCAVEC (bool, group_size);
    unsigned npermutes = 0;
@@ -318768,6 +320490,22 @@ Index: gcc/tree-vect-slp.c
    if (node != NULL)
      {
        /* Calculate the unrolling factor based on the smallest type.  */
+@@ -3485,6 +3566,7 @@
+ 		  dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
+ 				    stmt, 0);
+ 		}
++	      gcc_assert (analyze_only);
+ 	      return false;
+ 	    }
+ 
+@@ -3508,6 +3590,7 @@
+ 			dump_printf (MSG_MISSED_OPTIMIZATION, "%d ", mask[i]);
+ 		      dump_printf (MSG_MISSED_OPTIMIZATION, "}\n");
+ 		    }
++		  gcc_assert (analyze_only);
+ 		  return false;
+ 		}
+ 
 Index: gcc/langhooks-def.h
 ===================================================================
 --- a/src/gcc/langhooks-def.h	(.../tags/gcc_7_2_0_release)
@@ -319586,11 +321324,40 @@ Index: libgo/sysinfo.c
  #if defined(HAVE_LINUX_RTNETLINK_H)
  #include <linux/rtnetlink.h>
  #endif
+Index: libgfortran/intrinsics/execute_command_line.c
+===================================================================
+--- a/src/libgfortran/intrinsics/execute_command_line.c	(.../tags/gcc_7_2_0_release)
++++ b/src/libgfortran/intrinsics/execute_command_line.c	(.../branches/gcc-7-branch)
+@@ -125,15 +125,9 @@
+   free (cmd);
+ 
+   /* Now copy back to the Fortran string if needed.  */
+-  if (cmdstat && *cmdstat > EXEC_NOERROR)
+-    {
+-      if (cmdmsg)
+-	fstrcpy (cmdmsg, cmdmsg_len, cmdmsg_values[*cmdstat],
++  if (cmdstat && *cmdstat > EXEC_NOERROR && cmdmsg)
++    fstrcpy (cmdmsg, cmdmsg_len, cmdmsg_values[*cmdstat],
+ 		strlen (cmdmsg_values[*cmdstat]));
+-      else
+-	runtime_error ("Failure in EXECUTE_COMMAND_LINE: %s",
+-		       cmdmsg_values[*cmdstat]);
+-    }
+ }
+ 
+ 
 Index: libgfortran/ChangeLog
 ===================================================================
 --- a/src/libgfortran/ChangeLog	(.../tags/gcc_7_2_0_release)
 +++ b/src/libgfortran/ChangeLog	(.../branches/gcc-7-branch)
-@@ -1,3 +1,15 @@
+@@ -1,3 +1,22 @@
++2017-10-19  Thomas Koenig  <tkoenig at gcc.gnu.org>
++
++	Backport from trunk
++	PR libfortran/82233
++	* intrinsics/execute_command_line.c (execute_command_line):
++	No call to runtime_error if cmdstat is present.
++
 +2017-09-19  Jerry DeLisle  <jvdelisle at gcc.gnu.org>
 +
 +	Backport from trunk

-- 
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