[gcc-7] 285/354: * Update to SVN 20170906 (r251753) from the gcc-7-branch.
Ximin Luo
infinity0 at debian.org
Thu Nov 23 15:51:18 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 c678e76932631a2ff49d3ad8b173c5fed3b81073
Author: doko <doko at 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca>
Date: Wed Sep 6 08:44:32 2017 +0000
* Update to SVN 20170906 (r251753) from the gcc-7-branch.
git-svn-id: svn+ssh://svn.debian.org/svn/gcccvs/branches/sid/gcc-7@9657 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca
---
debian/changelog | 9 +
debian/patches/svn-updates.diff | 1557 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 1557 insertions(+), 9 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 6509ea0..9c1738c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+gcc-7 (7.2.0-4) UNRELEASED; urgency=medium
+
+ * Update to SVN 20170906 (r251753) from the gcc-7-branch.
+ - Fix PR c++/82039, PR libstdc++/81912, PR libstdc++/81891,
+ PR libstdc++/81599, PR libstdc++/81338, PR tree-optimization/81503,
+ PR ada/79542, PR ada/62235, PR fortran/81770.
+
+ -- Matthias Klose <doko at debian.org> Wed, 06 Sep 2017 10:38:05 +0200
+
gcc-7 (7.2.0-3) unstable; urgency=high
* Update to SVN 20170901 (r251583) from the gcc-7-branch.
diff --git a/debian/patches/svn-updates.diff b/debian/patches/svn-updates.diff
index e6e78f1..a42984b 100644
--- a/debian/patches/svn-updates.diff
+++ b/debian/patches/svn-updates.diff
@@ -1,10 +1,10 @@
-# DP: updates from the 7 branch upto 20170901 (r251583).
+# DP: updates from the 7 branch upto 20170906 (r251753).
last_update()
{
cat > ${dir}LAST_UPDATED <EOF
-Fri Sep 1 13:21:58 CEST 2017
-Fri Sep 1 11:21:58 UTC 2017 (revision 251583)
+Wed Sep 6 10:35:25 CEST 2017
+Wed Sep 6 08:35:25 UTC 2017 (revision 251753)
EOF
}
@@ -12,6 +12,49 @@ LANG=C svn diff svn://gcc.gnu.org/svn/gcc/tags/gcc_7_2_0_release svn://gcc.gnu.o
| sed -r 's,^--- (\S+)\t(\S+)(.*)$,--- a/src/\1\t\2,;s,^\+\+\+ (\S+)\t(\S+)(.*)$,+++ b/src/\1\t\2,' \
| awk '/^Index:.*\.(class|texi)/ {skip=1; next} /^Index:/ { skip=0 } skip==0'
+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 @@
+ template <typename _From, typename _To>
+ inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
+
+-#ifdef __has_builtin
+-# if !__has_builtin(__has_unique_object_representations)
+-// Try not to break non-GNU compilers that don't support the built-in:
+-# define _GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP 1
++#if __GNUC__ >= 7
++# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
++#elif defined(__is_identifier)
++// For non-GNU compilers:
++# if ! __is_identifier(__has_unique_object_representations)
++# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
+ # endif
+ #endif
+
+-#ifndef _GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP
++#ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
+ # define __cpp_lib_has_unique_object_representations 201606
+ /// has_unique_object_representations
+ template<typename _Tp>
+@@ -3060,13 +3062,13 @@
+ )>
+ { };
+ #endif
+-#undef _GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP
++#undef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
+
+ #if __GNUC__ >= 7
+ # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
+-#elif defined __has_builtin
++#elif defined(__is_identifier)
+ // For non-GNU compilers:
+-# if __has_builtin(__is_aggregate)
++# if ! __is_identifier(__is_aggregate)
+ # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
+ # endif
+ #endif
Index: libstdc++-v3/include/std/istream
===================================================================
--- a/src/libstdc++-v3/include/std/istream (.../tags/gcc_7_2_0_release)
@@ -42,6 +85,85 @@ Index: libstdc++-v3/include/std/istream
*/
/**
+Index: libstdc++-v3/include/std/sstream
+===================================================================
+--- a/src/libstdc++-v3/include/std/sstream (.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/std/sstream (.../branches/gcc-7-branch)
+@@ -302,12 +302,14 @@
+ __xfer_bufptrs(const basic_stringbuf& __from, basic_stringbuf* __to)
+ : _M_to{__to}, _M_goff{-1, -1, -1}, _M_poff{-1, -1, -1}
+ {
+- const _CharT* __str = __from._M_string.data();
++ const _CharT* const __str = __from._M_string.data();
++ const _CharT* __end = nullptr;
+ if (__from.eback())
+ {
+- _M_goff[0] = __from.eback() - __str;
+- _M_goff[1] = __from.gptr() - __str;
+- _M_goff[2] = __from.egptr() - __str;
++ _M_goff[0] = __from.eback() - __str;
++ _M_goff[1] = __from.gptr() - __str;
++ _M_goff[2] = __from.egptr() - __str;
++ __end = __from.egptr();
+ }
+ if (__from.pbase())
+ {
+@@ -314,7 +316,18 @@
+ _M_poff[0] = __from.pbase() - __str;
+ _M_poff[1] = __from.pptr() - __from.pbase();
+ _M_poff[2] = __from.epptr() - __str;
++ if (__from.pptr() > __end)
++ __end = __from.pptr();
+ }
++
++ // Set _M_string length to the greater of the get and put areas.
++ if (__end)
++ {
++ // The const_cast avoids changing this constructor's signature,
++ // because it is exported from the dynamic library.
++ auto& __mut_from = const_cast<basic_stringbuf&>(__from);
++ __mut_from._M_string._M_length(__end - __str);
++ }
+ }
+
+ ~__xfer_bufptrs()
+Index: libstdc++-v3/include/ext/new_allocator.h
+===================================================================
+--- a/src/libstdc++-v3/include/ext/new_allocator.h (.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/ext/new_allocator.h (.../branches/gcc-7-branch)
+@@ -96,7 +96,7 @@
+ // NB: __n is permitted to be 0. The C++ standard says nothing
+ // about what the return value is when __n == 0.
+ pointer
+- allocate(size_type __n, const void* = 0)
++ allocate(size_type __n, const void* = static_cast<const void*>(0))
+ {
+ if (__n > this->max_size())
+ std::__throw_bad_alloc();
+Index: libstdc++-v3/include/bits/hashtable.h
+===================================================================
+--- a/src/libstdc++-v3/include/bits/hashtable.h (.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/bits/hashtable.h (.../branches/gcc-7-branch)
+@@ -973,17 +973,8 @@
+ _M_bucket_count = __bkt_count;
+ }
+
+- __try
+- {
+- for (; __f != __l; ++__f)
+- this->insert(*__f);
+- }
+- __catch(...)
+- {
+- clear();
+- _M_deallocate_buckets();
+- __throw_exception_again;
+- }
++ for (; __f != __l; ++__f)
++ this->insert(*__f);
+ }
+
+ template<typename _Key, typename _Value,
Index: libstdc++-v3/include/bits/basic_ios.h
===================================================================
--- a/src/libstdc++-v3/include/bits/basic_ios.h (.../tags/gcc_7_2_0_release)
@@ -57,6 +179,49 @@ Index: libstdc++-v3/include/bits/basic_ios.h
// exceptions().
void
_M_setstate(iostate __state)
+Index: libstdc++-v3/include/bits/stl_stack.h
+===================================================================
+--- a/src/libstdc++-v3/include/bits/stl_stack.h (.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/bits/stl_stack.h (.../branches/gcc-7-branch)
+@@ -86,7 +86,7 @@
+ *
+ * The second template parameter defines the type of the underlying
+ * sequence/container. It defaults to std::deque, but it can be
+- * any type that supports @c back, @c push_back, and @c pop_front,
++ * any type that supports @c back, @c push_back, and @c pop_back,
+ * such as std::list, std::vector, or an appropriate user-defined
+ * type.
+ *
+Index: libstdc++-v3/include/bits/stl_iterator_base_types.h
+===================================================================
+--- a/src/libstdc++-v3/include/bits/stl_iterator_base_types.h (.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/bits/stl_iterator_base_types.h (.../branches/gcc-7-branch)
+@@ -200,7 +200,8 @@
+ * sugar for internal library use only.
+ */
+ template<typename _Iter>
+- inline typename iterator_traits<_Iter>::iterator_category
++ inline _GLIBCXX_CONSTEXPR
++ typename iterator_traits<_Iter>::iterator_category
+ __iterator_category(const _Iter&)
+ { return typename iterator_traits<_Iter>::iterator_category(); }
+
+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)
+@@ -2918,7 +2918,10 @@
+ int
+ compare(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2) const;
+- };
++
++ // Allow basic_stringbuf::__xfer_bufptrs to call _M_length:
++ template<typename, typename, typename> friend class basic_stringbuf;
++ };
+ _GLIBCXX_END_NAMESPACE_CXX11
+ #else // !_GLIBCXX_USE_CXX11_ABI
+ // Reference-counted COW string implentation
Index: libstdc++-v3/include/bits/istream.tcc
===================================================================
--- a/src/libstdc++-v3/include/bits/istream.tcc (.../tags/gcc_7_2_0_release)
@@ -118,11 +283,103 @@ Index: libstdc++-v3/include/bits/istream.tcc
if (__in.good() && __err == ios_base::goodbit)
_M_ok = true;
+Index: libstdc++-v3/include/bits/sstream.tcc
+===================================================================
+--- a/src/libstdc++-v3/include/bits/sstream.tcc (.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/include/bits/sstream.tcc (.../branches/gcc-7-branch)
+@@ -88,6 +88,25 @@
+ return traits_type::not_eof(__c);
+
+ const __size_type __capacity = _M_string.capacity();
++
++#if _GLIBCXX_USE_CXX11_ABI
++ if ((this->epptr() - this->pbase()) < __capacity)
++ {
++ // There is additional capacity in _M_string that can be used.
++ char_type* __base = const_cast<char_type*>(_M_string.data());
++ _M_pbump(__base, __base + __capacity, this->pptr() - this->pbase());
++ if (_M_mode & ios_base::in)
++ {
++ const __size_type __nget = this->gptr() - this->eback();
++ const __size_type __eget = this->egptr() - this->eback();
++ this->setg(__base, __base + __nget, __base + __eget + 1);
++ }
++ *this->pptr() = traits_type::to_char_type(__c);
++ this->pbump(1);
++ return __c;
++ }
++#endif
++
+ const __size_type __max_size = _M_string.max_size();
+ const bool __testput = this->pptr() < this->epptr();
+ if (__builtin_expect(!__testput && __capacity == __max_size, false))
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,33 @@
+@@ -1,3 +1,95 @@
++2017-09-04 Jonathan Wakely <jwakely at redhat.com>
++
++ Backport from mainline
++ 2017-08-31 Jonathan Wakely <jwakely at redhat.com>
++
++ PR c++/82039
++ * include/ext/new_allocator.h (__gnu_cxx::new_allocator::allocate):
++ Adjust null pointer constant to avoid warning.
++
++ Backport from mainline
++ 2017-08-21 Jonathan Wakely <jwakely at redhat.com>
++
++ PR libstdc++/81912
++ * include/bits/stl_iterator_base_types.h (__iterator_category): Add
++ constexpr for C++11 and later.
++ * testsuite/24_iterators/container_access.cc: Add target selector.
++ * testsuite/24_iterators/range_access.cc: Fix clause number in
++ comment.
++ * testsuite/24_iterators/range_access_cpp14.cc: Likewise.
++ * testsuite/24_iterators/range_access_cpp17.cc: New.
++
++ Backport from mainline
++ 2017-08-09 Jonathan Wakely <jwakely at redhat.com>
++
++ * include/std/type_traits (_GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP):
++ Replace with _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP and use
++ __is_identifier to set it.
++
++ Backport from mainline
++ 2017-08-09 Katsuhiko Nishimra <ktns.87 at gmail.com>
++
++ * include/std/type_traits (_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE): Use
++ __is_identifier instead of __has_builtin.
++
++ Backport from mainline
++ 2017-08-18 Jonathan Wakely <jwakely at redhat.com>
++
++ PR libstdc++/81891
++ * include/bits/hashtable.h (_Hashtable(_InputIterator, _InputIterator,
++ size_type, const _H1&, const _H2&, const _Hash&, const _Equal&,
++ const _ExtractKey&, const allocator_type&)): Let destructor do clean
++ up if an exception is thrown.
++ * testsuite/23_containers/unordered_map/cons/81891.cc: New.
++
++ Backport from mainline
++ 2017-07-31 Marek Polacek <polacek at redhat.com>
++
++ PR libstdc++/81599
++ * include/bits/stl_stack.h: Fix typo.
++
++ Backport from mainline
++ 2017-07-10 Jonathan Wakely <jwakely at redhat.com>
++
++ PR libstdc++/81338
++ * include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI] (basic_string):
++ Declare basic_stringbuf to be a friend.
++ * include/bits/sstream.tcc (basic_stringbuf::overflow)
++ [_GLIBCXX_USE_CXX11_ABI]: Use unused capacity before reallocating.
++ * include/std/sstream (basic_stringbuf::__xfer_bufptrs): Update string
++ length to buffer length.
++ * testsuite/27_io/basic_stringstream/assign/81338.cc: New.
++
+2017-08-20 John David Anglin <danglin at gcc.gnu.org>
+
+ PR testsuite/81056
@@ -156,6 +413,112 @@ Index: libstdc++-v3/ChangeLog
2017-08-14 Release Manager
* GCC 7.2.0 released.
+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)
++++ b/src/libstdc++-v3/testsuite/24_iterators/container_access.cc (.../branches/gcc-7-branch)
+@@ -1,4 +1,4 @@
+-// { dg-do run }
++// { dg-do run { target c++1z } }
+ // { dg-options "-std=gnu++17" }
+
+ // Copyright (C) 2015-2017 Free Software Foundation, Inc.
+@@ -62,7 +62,6 @@
+ static_assert(s == 3);
+ constexpr auto e = std::empty(il3);
+ static_assert(!e);
+-
+ }
+
+ void
+Index: libstdc++-v3/testsuite/24_iterators/range_access.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/24_iterators/range_access.cc (.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/24_iterators/range_access.cc (.../branches/gcc-7-branch)
+@@ -17,7 +17,7 @@
+ // with this library; see the file COPYING3. If not see
+ // <http://www.gnu.org/licenses/>.
+
+-// 24.6.5, range access [iterator.range]
++// C++ 2011 24.6.5, range access [iterator.range]
+
+ #include <iterator>
+
+Index: libstdc++-v3/testsuite/24_iterators/range_access_cpp14.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/24_iterators/range_access_cpp14.cc (.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/24_iterators/range_access_cpp14.cc (.../branches/gcc-7-branch)
+@@ -17,7 +17,7 @@
+ // with this library; see the file COPYING3. If not see
+ // <http://www.gnu.org/licenses/>.
+
+-// 24.6.5, range access [iterator.range]
++// C++ 2014 24.7, range access [iterator.range]
+
+ #include <iterator>
+ #include <vector>
+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" }
++
++// 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/>.
++
++// C++ 2017 27.7, range access [iterator.range]
++
++#include <iterator>
++
++void
++test01()
++{
++ using std::reverse_iterator;
++ static int i[1];
++ static_assert(std::cbegin(i) == i);
++ static_assert(std::cend(i) == i+1);
++ static_assert(std::rbegin(i) == reverse_iterator<int*>(i+1));
++ static_assert(std::rend(i) == reverse_iterator<int*>(i));
++ static_assert(std::crbegin(i) == reverse_iterator<int*>(i+1));
++ static_assert(std::crend(i) == reverse_iterator<int*>(i));
++}
++
++void
++test02()
++{
++ static int i[] = { 1, 2 };
++ static_assert(std::distance(std::begin(i), std::end(i)) == 2);
++ static_assert(std::distance(std::cbegin(i), std::cend(i)) == 2);
++}
++
++void
++test03()
++{
++ using std::reverse_iterator;
++ static 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()));
++ static_assert(std::rend(il) == reverse_iterator<const int*>(il.begin()));
++ 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/ext/stdio_filebuf/char/81751.cc
===================================================================
--- a/src/libstdc++-v3/testsuite/ext/stdio_filebuf/char/81751.cc (.../tags/gcc_7_2_0_release)
@@ -258,6 +621,124 @@ Index: libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
+{
+ test01();
+}
+Index: libstdc++-v3/testsuite/23_containers/unordered_map/cons/81891.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/23_containers/unordered_map/cons/81891.cc (.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/23_containers/unordered_map/cons/81891.cc (.../branches/gcc-7-branch)
+@@ -0,0 +1,68 @@
++// 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-do run { target c++11 } }
++
++#include <unordered_map>
++#include <testsuite_hooks.h>
++#include <testsuite_allocator.h>
++
++struct fails_on_copy {
++ fails_on_copy() = default;
++ fails_on_copy(const fails_on_copy&) { throw 0; };
++};
++
++using value_type = std::pair<int, fails_on_copy>;
++
++void
++test01()
++{
++ value_type p;
++ try
++ {
++ std::unordered_map<int, fails_on_copy> umap(&p, &p + 1);
++ }
++ catch(...)
++ { }
++}
++
++void
++test02()
++{
++ using Alloc = __gnu_test::tracker_allocator<value_type>;
++ using std::hash;
++ using std::equal_to;
++
++ value_type p;
++ try
++ {
++ std::unordered_map<int, fails_on_copy, hash<int>, equal_to<int>, Alloc>
++ umap(&p, &p + 1);
++ }
++ catch(...)
++ { }
++
++ using counter = __gnu_test::tracker_allocator_counter;
++ VERIFY(counter::get_allocation_count() == counter::get_deallocation_count());
++}
++
++int
++main()
++{
++ test01();
++ test02();
++}
+Index: libstdc++-v3/testsuite/27_io/basic_stringstream/assign/81338.cc
+===================================================================
+--- a/src/libstdc++-v3/testsuite/27_io/basic_stringstream/assign/81338.cc (.../tags/gcc_7_2_0_release)
++++ b/src/libstdc++-v3/testsuite/27_io/basic_stringstream/assign/81338.cc (.../branches/gcc-7-branch)
+@@ -0,0 +1,40 @@
++// 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-do run { target c++11 } }
++
++#include <sstream>
++#include <testsuite_hooks.h>
++
++void
++test01()
++{
++ std::stringstream ss;
++ for (int i = 0; i < 100; ++i)
++ {
++ ss << 'a';
++ VERIFY( static_cast<bool>(ss) );
++ VERIFY( ss.str() == "a" );
++ ss = std::stringstream();
++ }
++}
++
++int
++main()
++{
++ test01();
++}
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)
@@ -426,7 +907,7 @@ Index: gcc/DATESTAMP
+++ b/src/gcc/DATESTAMP (.../branches/gcc-7-branch)
@@ -1 +1 @@
-20170814
-+20170901
++20170906
Index: gcc/tree.c
===================================================================
--- a/src/gcc/tree.c (.../tags/gcc_7_2_0_release)
@@ -679,7 +1160,32 @@ Index: gcc/ChangeLog
===================================================================
--- a/src/gcc/ChangeLog (.../tags/gcc_7_2_0_release)
+++ b/src/gcc/ChangeLog (.../branches/gcc-7-branch)
-@@ -1,3 +1,229 @@
+@@ -1,3 +1,254 @@
++2017-09-05 Bill Schmidt <wschmidt at linux.vnet.ibm.com>
++
++ Backport from mainline
++ 2017-08-29 Bill Schmidt <wschmidt at linux.vnet.ibm.com>
++ Jakub Jelinek <jakub at redhat.com>
++ Richard Biener <rguenther at suse.de>
++
++ PR tree-optimization/81503
++ * gimple-ssa-strength-reduction.c (replace_mult_candidate): Ensure
++ folded constant fits in the target type; reorder tests for clarity.
++
++2017-09-05 Pierre-Marie de Rodat <derodat at adacore.com>
++
++ Backport from trunk
++ PR ada/79542
++ * dwarf2out.c (modified_type_die): For C typedef types that have
++ an ultimate origin, process the ultimate origin instead of the
++ input type.
++ (gen_typedef_die): Assert that input DECLs have no ultimate
++ origin.
++ (gen_type_die_with_usage): For typedef variants that have an
++ ultimate origin, just call gen_decl_die on the original DECL.
++ (process_scope_var): Avoid creating DIEs for local typedefs and
++ concrete static variables.
++
+2017-08-31 Bill Schmidt <wschmidt at linux.vnet.ibm.com>
+
+ Backport from mainline
@@ -1467,6 +1973,157 @@ Index: gcc/testsuite/gcc.target/i386/pr81921.c
+{
+ volatile int x = _mm_loadu_si128 (p);
+}
+Index: gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-nov.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-nov.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-nov.c (.../branches/gcc-7-branch)
+@@ -25,7 +25,7 @@
+ static __attribute__((always_inline)) int
+ foo1 (int *p1, ...)
+ {
+- return foo2 (10, p1, __va_arg_pack ());
++ return foo2 (10, p1, __builtin_va_arg_pack ());
+ }
+
+ int prebuf[100];
+Index: gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-lbv.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-lbv.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-lbv.c (.../branches/gcc-7-branch)
+@@ -28,7 +28,7 @@
+ static __attribute__((always_inline)) int
+ foo1 (int *p1, ...)
+ {
+- return foo2 (10, p1, __va_arg_pack ());
++ return foo2 (10, p1, __builtin_va_arg_pack ());
+ }
+
+ int prebuf[100];
+Index: gcc/testsuite/gcc.target/i386/mpx/mpx-os-support.h
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/mpx/mpx-os-support.h (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/mpx/mpx-os-support.h (.../branches/gcc-7-branch)
+@@ -0,0 +1,16 @@
++/* Check if the OS supports executing MPX instructions. */
++
++#define XCR_XFEATURE_ENABLED_MASK 0x0
++
++#define XSTATE_BNDREGS 0x8
++
++static int
++mpx_os_support (void)
++{
++ unsigned int eax, edx;
++ unsigned int ecx = XCR_XFEATURE_ENABLED_MASK;
++
++ __asm__ ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (ecx));
++
++ return (eax & XSTATE_BNDREGS) != 0;
++}
+Index: gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-ubv.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-ubv.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-ubv.c (.../branches/gcc-7-branch)
+@@ -28,7 +28,7 @@
+ static __attribute__((always_inline)) int
+ foo1 (int *p1, ...)
+ {
+- return foo2 (10, p1, __va_arg_pack ());
++ return foo2 (10, p1, __builtin_va_arg_pack ());
+ }
+
+ int prebuf[100];
+Index: gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-nov.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-nov.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-nov.c (.../branches/gcc-7-branch)
+@@ -27,7 +27,7 @@
+ static __attribute__((always_inline)) int
+ foo1 (int *p1, ...)
+ {
+- return foo2 (10, p1, __va_arg_pack ());
++ return foo2 (10, p1, __builtin_va_arg_pack ());
+ }
+
+ int prebuf[100];
+Index: gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-lbv.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-lbv.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-lbv.c (.../branches/gcc-7-branch)
+@@ -30,7 +30,7 @@
+ static __attribute__((always_inline)) int
+ foo1 (int *p1, ...)
+ {
+- return foo2 (10, p1, __va_arg_pack ());
++ return foo2 (10, p1, __builtin_va_arg_pack ());
+ }
+
+ int prebuf[100];
+Index: gcc/testsuite/gcc.target/i386/mpx/mpx-check.h
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/mpx/mpx-check.h (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/mpx/mpx-check.h (.../branches/gcc-7-branch)
+@@ -1,8 +1,8 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <assert.h>
+-
+ #include "cpuid.h"
++#include "mpx-os-support.h"
+
+ static int
+ __attribute__ ((noinline))
+@@ -16,14 +16,13 @@
+
+ #define DEBUG
+
+-#define XSTATE_BNDREGS (1 << 3)
++static int
++check_osxsave (void)
++{
++ unsigned int eax, ebx, ecx, edx;
+
+-/* This should be an intrinsic, but isn't. */
+-static int xgetbv (unsigned x)
+-{
+- unsigned eax, edx;
+- asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (x));
+- return eax;
++ __cpuid (1, eax, ebx, ecx, edx);
++ return (ecx & bit_OSXSAVE) != 0;
+ }
+
+ int
+@@ -31,13 +30,11 @@
+ {
+ unsigned int eax, ebx, ecx, edx;
+
+- if (__get_cpuid_max (0, NULL) < 7)
+- return 0;
++ if (!__get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx))
++ return NORUNRES;
+
+- __cpuid_count (7, 0, eax, ebx, ecx, edx);
+-
+ /* Run MPX test only if host has MPX support. */
+- if ((ebx & bit_MPX) && (xgetbv (0) & XSTATE_BNDREGS))
++ if (check_osxsave () && (ebx & bit_MPX) && mpx_os_support ())
+ mpx_test (argc, argv);
+ else
+ {
+Index: gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-ubv.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-ubv.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-2-ubv.c (.../branches/gcc-7-branch)
+@@ -30,7 +30,7 @@
+ static __attribute__((always_inline)) int
+ foo1 (int *p1, ...)
+ {
+- return foo2 (10, p1, __va_arg_pack ());
++ return foo2 (10, p1, __builtin_va_arg_pack ());
+ }
+
+ int prebuf[100];
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- a/src/gcc/testsuite/lib/target-supports.exp (.../tags/gcc_7_2_0_release)
@@ -1495,6 +2152,19 @@ Index: gcc/testsuite/gfortran.dg/dtio_12.f90
+ if (trim (msg) .ne. "77") call abort
close(10)
end
+Index: gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90
+===================================================================
+--- a/src/gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90 (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90 (.../branches/gcc-7-branch)
+@@ -3,7 +3,7 @@
+ !
+ ! PR fortran/55476
+ !
+-! Contribued by Janus Weil
++! Contributed by Janus Weil
+ !
+ subroutine test
+ integer, pointer :: p
Index: gcc/testsuite/gfortran.dg/array_temporaries_4.f90
===================================================================
--- a/src/gcc/testsuite/gfortran.dg/array_temporaries_4.f90 (.../tags/gcc_7_2_0_release)
@@ -1620,6 +2290,59 @@ Index: gcc/testsuite/gfortran.dg/pr81723.f
+
+ RETURN
+ END
+Index: gcc/testsuite/gfortran.dg/warn_target_lifetime_4.f90
+===================================================================
+--- a/src/gcc/testsuite/gfortran.dg/warn_target_lifetime_4.f90 (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gfortran.dg/warn_target_lifetime_4.f90 (.../branches/gcc-7-branch)
+@@ -0,0 +1,28 @@
++! { dg-do compile }
++! { dg-options "-Wtarget-lifetime" }
++!
++! PR fortran/81770: [5/6/7 Regression] Bogus warning: Pointer in pointer assignment might outlive the pointer target
++!
++! Contributed by Janus Weil <janus at gcc.gnu.org>
++
++module m
++
++ type t
++ integer, allocatable :: l
++ end type
++
++contains
++
++ subroutine sub(c_in, list)
++ type(t), target, intent(in) :: c_in
++ integer, pointer, intent(out) :: list
++
++ type(t), pointer :: container
++
++ container => c_in
++
++ list => container%l
++
++ end subroutine
++
++end
+Index: gcc/testsuite/gcc.c-torture/execute/pr81503.c
+===================================================================
+--- a/src/gcc/testsuite/gcc.c-torture/execute/pr81503.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gcc.c-torture/execute/pr81503.c (.../branches/gcc-7-branch)
+@@ -0,0 +1,15 @@
++unsigned short a = 41461;
++unsigned short b = 3419;
++int c = 0;
++
++void foo() {
++ if (a + b * ~(0 != 5))
++ c = -~(b * ~(0 != 5)) + 2147483647;
++}
++
++int main() {
++ foo();
++ if (c != 2147476810)
++ return -1;
++ return 0;
++}
Index: gcc/testsuite/gcc.c-torture/compile/string-large-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.c-torture/compile/string-large-1.c (.../tags/gcc_7_2_0_release)
@@ -1744,6 +2467,208 @@ 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/gnat.dg/incomplete5_pkg.adb
+===================================================================
+--- a/src/gcc/testsuite/gnat.dg/incomplete5_pkg.adb (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gnat.dg/incomplete5_pkg.adb (.../branches/gcc-7-branch)
+@@ -0,0 +1,13 @@
++package body Incomplete5_Pkg is
++
++ function Get_Handle (Object: Base_Object) return Access_Type is
++ begin
++ return Object.Handle;
++ end;
++
++ function From_Handle (Handle: Access_Type) return Base_Object is
++ begin
++ return (Handle=>Handle);
++ end;
++
++end Incomplete5_Pkg;
+Index: gcc/testsuite/gnat.dg/incomplete5_pkg.ads
+===================================================================
+--- a/src/gcc/testsuite/gnat.dg/incomplete5_pkg.ads (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gnat.dg/incomplete5_pkg.ads (.../branches/gcc-7-branch)
+@@ -0,0 +1,15 @@
++generic
++ type Record_Type;
++package Incomplete5_Pkg is
++
++ type Access_Type is access Record_Type;
++
++ type Base_Object is tagged record
++ Handle: Access_Type;
++ end record;
++
++ function Get_Handle(Object: Base_Object) return Access_Type;
++
++ function From_Handle(Handle: Access_Type) return Base_Object;
++
++end Incomplete5_Pkg;
+Index: gcc/testsuite/gnat.dg/array29.adb
+===================================================================
+--- a/src/gcc/testsuite/gnat.dg/array29.adb (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gnat.dg/array29.adb (.../branches/gcc-7-branch)
+@@ -0,0 +1,26 @@
++-- { dg-do compile }
++-- { dg-options "-O" }
++
++package body Array29 is
++
++ procedure Copy (Src : in Matrix; Dst : out Matrix) is
++ begin
++ for I in Src'Range (1) loop
++ for J in Src'Range (2) loop
++ Dst (I, J) := Src (I, J);
++ end loop;
++ end loop;
++ end;
++
++ procedure Proc is
++ N : constant := 2;
++ FM1 : constant Matrix (1 .. N, 1 .. N) := ((1.0, 2.0), (3.0, 4.0));
++ FM2 : constant Matrix (1 .. N, 1 .. N) := ((1.0, 2.0), (3.0, 4.0));
++ A : constant array (1 .. 2) of Matrix (1 .. N, 1 .. N)
++ := (Matrix (FM1), Matrix (FM2));
++ Final : Matrix (1 .. N, 1 .. N);
++ begin
++ Copy (Src => A (1), Dst => Final);
++ end;
++
++end Array29;
+Index: gcc/testsuite/gnat.dg/array29.ads
+===================================================================
+--- a/src/gcc/testsuite/gnat.dg/array29.ads (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gnat.dg/array29.ads (.../branches/gcc-7-branch)
+@@ -0,0 +1,7 @@
++package Array29 is
++
++ type Matrix is array (Integer range <>, Integer range <>) of Long_Float;
++
++ procedure Proc;
++
++end Array29;
+Index: gcc/testsuite/gnat.dg/debug13.adb
+===================================================================
+--- a/src/gcc/testsuite/gnat.dg/debug13.adb (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gnat.dg/debug13.adb (.../branches/gcc-7-branch)
+@@ -0,0 +1,38 @@
++-- { dg-options "-cargs -O2 -g -margs" }
++
++package body Debug13 is
++
++ procedure Compile (P : Natural)
++ is
++ Max_Pos : constant Natural := P;
++ type Position_Set is array (1 .. Max_Pos) of Boolean;
++
++ Empty : constant Position_Set := (others => False);
++
++ type Position_Set_Array is array (1 .. Max_Pos) of Position_Set;
++
++ Follow : Position_Set_Array := (others => Empty);
++
++ function Get_Follows return Position_Set;
++
++ procedure Make_DFA;
++
++ function Get_Follows return Position_Set is
++ Result : Position_Set := Empty;
++ begin
++ Result := Result or Follow (1);
++
++ return Result;
++ end Get_Follows;
++
++ procedure Make_DFA is
++ Next : constant Position_Set := Get_Follows;
++ begin
++ null;
++ end Make_DFA;
++
++ begin
++ Make_DFA;
++ end Compile;
++
++end Debug13;
+Index: gcc/testsuite/gnat.dg/debug13.ads
+===================================================================
+--- a/src/gcc/testsuite/gnat.dg/debug13.ads (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gnat.dg/debug13.ads (.../branches/gcc-7-branch)
+@@ -0,0 +1,5 @@
++package Debug13 is
++
++ procedure Compile (P : Natural);
++
++end Debug13;
+Index: gcc/testsuite/gnat.dg/incomplete5.adb
+===================================================================
+--- a/src/gcc/testsuite/gnat.dg/incomplete5.adb (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gnat.dg/incomplete5.adb (.../branches/gcc-7-branch)
+@@ -0,0 +1,10 @@
++-- { dg-do compile }
++
++package body Incomplete5 is
++
++ function Get (O: Base_Object) return Integer is
++ begin
++ return Get_Handle(O).I;
++ end;
++
++end Incomplete5;
+Index: gcc/testsuite/gnat.dg/incomplete5.ads
+===================================================================
+--- a/src/gcc/testsuite/gnat.dg/incomplete5.ads (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gnat.dg/incomplete5.ads (.../branches/gcc-7-branch)
+@@ -0,0 +1,25 @@
++with Incomplete5_Pkg;
++
++package Incomplete5 is
++
++ type Rec1 is private;
++
++ type Rec2 is private;
++
++ package My_G is new Incomplete5_Pkg (Rec1);
++
++ use My_G;
++
++ function Get (O: Base_Object) return Integer;
++
++private
++
++ type Rec1 is record
++ I : Integer;
++ end record;
++
++ type Rec2 is record
++ A : Access_Type;
++ end record;
++
++end Incomplete5;
+Index: gcc/testsuite/gnat.dg/specs/uc2.ads
+===================================================================
+--- a/src/gcc/testsuite/gnat.dg/specs/uc2.ads (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/testsuite/gnat.dg/specs/uc2.ads (.../branches/gcc-7-branch)
+@@ -0,0 +1,18 @@
++-- { dg-do compile }
++-- { dg-options "-O" }
++
++with Ada.Unchecked_Conversion;
++
++package UC2 is
++
++ subtype Word_Type is Integer range 0 .. 0;
++ type Arr is array (1 .. Word_Type'Size) of Boolean;
++ pragma Pack(Arr);
++
++ function Conv is
++ new Ada.Unchecked_Conversion (Source => Arr, Target => Word_Type);
++
++ A : Arr;
++ W : Word_Type := Conv(A);
++
++end UC2;
Index: gcc/testsuite/gcc.dg/torture/pr81181.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/torture/pr81181.c (.../tags/gcc_7_2_0_release)
@@ -1793,7 +2718,58 @@ 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,139 @@
+@@ -1,3 +1,190 @@
++2017-09-05 Bill Schmidt <wschmidt at linux.vnet.ibm.com>
++
++ Backport from mainline
++ 2017-08-29 Bill Schmidt <wschmidt at linux.vnet.ibm.com>
++ Jakub Jelinek <jakub at redhat.com>
++ Richard Biener <rguenther at suse.de>
++
++ PR tree-optimization/81503
++ * gcc.c-torture/execute/pr81503.c: New file.
++
++2017-09-05 Pierre-Marie de Rodat <derodat at adacore.com>
++
++ Backport from trunk
++ PR ada/79542
++ * gnat.dg/debug13.ads, gnat.dg/debug13.adb: New testcase.
++
++2017-09-05 Eric Botcazou <ebotcazou at adacore.com>
++
++ * gnat.dg/incomplete5.ad[sb]: New test.
++ * gnat.dg/incomplete5_pkg.ad[sb]: New helper.
++
++2017-09-05 Eric Botcazou <ebotcazou at adacore.com>
++
++ * gnat.dg/specs/uc2.ads: New test.
++
++2017-09-05 Eric Botcazou <ebotcazou at adacore.com>
++
++ * testsuite/gnat.dg/array29.ad[sb]: New test.
++
++2017-09-04 Uros Bizjak <ubizjak at gmail.com>
++
++ * gcc.target/i386/mpx/mpx-os-support.h: New file.
++ * gcc.target/i386/mpx/mpx-check.h: Include mpx-os-support.h.
++ (check_osxsave): New function.
++ (main): Use __get_cpuid_count and return NORUNRES on failure.
++ Use check_osxsave.
++ * gcc.target/i386/mpx/va-arg-pack-1-lbv.c (foo1): Use
++ __builtin_va_arg_pack instead of __va_arg_pack.
++ * gcc.target/i386/mpx/va-arg-pack-1-nov.c (foo1): Ditto.
++ * gcc.target/i386/mpx/va-arg-pack-1-ubv.c (foo1): Ditto.
++ * gcc.target/i386/mpx/va-arg-pack-2-lbv.c (foo1): Ditto.
++ * gcc.target/i386/mpx/va-arg-pack-2-nov.c (foo1): Ditto.
++ * gcc.target/i386/mpx/va-arg-pack-2-ubv.c (foo1): Ditto.
++
++2017-09-02 Janus Weil <janus at gcc.gnu.org>
++
++ Backport from trunk
++ PR fortran/81770
++ * gfortran.dg/warn_target_lifetime_3.f90: Fix a typo.
++ * gfortran.dg/warn_target_lifetime_4.f90: New testcase.
++
+2017-08-29 Michael Meissner <meissner at linux.vnet.ibm.com>
+
+ Back port from trunk
@@ -2296,7 +3272,209 @@ Index: gcc/dwarf2out.c
===================================================================
--- a/src/gcc/dwarf2out.c (.../tags/gcc_7_2_0_release)
+++ b/src/gcc/dwarf2out.c (.../branches/gcc-7-branch)
-@@ -26058,7 +26058,8 @@
+@@ -12514,6 +12514,15 @@
+
+ if (qualified_type == dtype)
+ {
++ tree origin = decl_ultimate_origin (name);
++
++ /* Typedef variants that have an abstract origin don't get their own
++ type DIE (see gen_typedef_die), so fall back on the ultimate
++ abstract origin instead. */
++ if (origin != NULL)
++ return modified_type_die (TREE_TYPE (origin), cv_quals, reverse,
++ context_die);
++
+ /* For a named type, use the typedef. */
+ gen_type_die (qualified_type, context_die);
+ return lookup_type_die (qualified_type);
+@@ -24346,7 +24355,7 @@
+ gen_typedef_die (tree decl, dw_die_ref context_die)
+ {
+ dw_die_ref type_die;
+- tree origin;
++ tree type;
+
+ if (TREE_ASM_WRITTEN (decl))
+ {
+@@ -24355,76 +24364,72 @@
+ return;
+ }
+
++ /* As we avoid creating DIEs for local typedefs (see decl_ultimate_origin
++ checks in process_scope_var and modified_type_die), this should be called
++ only for original types. */
++ gcc_assert (decl_ultimate_origin (decl) == NULL);
++
+ TREE_ASM_WRITTEN (decl) = 1;
+ type_die = new_die (DW_TAG_typedef, context_die, decl);
+- origin = decl_ultimate_origin (decl);
+- if (origin != NULL)
+- add_abstract_origin_attribute (type_die, origin);
++
++ add_name_and_src_coords_attributes (type_die, decl);
++ if (DECL_ORIGINAL_TYPE (decl))
++ {
++ type = DECL_ORIGINAL_TYPE (decl);
++ if (type == error_mark_node)
++ return;
++
++ gcc_assert (type != TREE_TYPE (decl));
++ equate_type_number_to_die (TREE_TYPE (decl), type_die);
++ }
+ else
+ {
+- tree type = TREE_TYPE (decl);
+-
++ type = TREE_TYPE (decl);
+ if (type == error_mark_node)
+ return;
+
+- add_name_and_src_coords_attributes (type_die, decl);
+- if (DECL_ORIGINAL_TYPE (decl))
++ if (is_naming_typedef_decl (TYPE_NAME (type)))
+ {
+- type = DECL_ORIGINAL_TYPE (decl);
++ /* Here, we are in the case of decl being a typedef naming
++ an anonymous type, e.g:
++ typedef struct {...} foo;
++ In that case TREE_TYPE (decl) is not a typedef variant
++ type and TYPE_NAME of the anonymous type is set to the
++ TYPE_DECL of the typedef. This construct is emitted by
++ the C++ FE.
+
+- if (type == error_mark_node)
+- return;
++ TYPE is the anonymous struct named by the typedef
++ DECL. As we need the DW_AT_type attribute of the
++ DW_TAG_typedef to point to the DIE of TYPE, let's
++ generate that DIE right away. add_type_attribute
++ called below will then pick (via lookup_type_die) that
++ anonymous struct DIE. */
++ if (!TREE_ASM_WRITTEN (type))
++ gen_tagged_type_die (type, context_die, DINFO_USAGE_DIR_USE);
+
+- gcc_assert (type != TREE_TYPE (decl));
+- equate_type_number_to_die (TREE_TYPE (decl), type_die);
++ /* This is a GNU Extension. We are adding a
++ DW_AT_linkage_name attribute to the DIE of the
++ anonymous struct TYPE. The value of that attribute
++ is the name of the typedef decl naming the anonymous
++ struct. This greatly eases the work of consumers of
++ this debug info. */
++ add_linkage_name_raw (lookup_type_die (type), decl);
+ }
+- else
+- {
+- if (is_naming_typedef_decl (TYPE_NAME (type)))
+- {
+- /* Here, we are in the case of decl being a typedef naming
+- an anonymous type, e.g:
+- typedef struct {...} foo;
+- In that case TREE_TYPE (decl) is not a typedef variant
+- type and TYPE_NAME of the anonymous type is set to the
+- TYPE_DECL of the typedef. This construct is emitted by
+- the C++ FE.
++ }
+
+- TYPE is the anonymous struct named by the typedef
+- DECL. As we need the DW_AT_type attribute of the
+- DW_TAG_typedef to point to the DIE of TYPE, let's
+- generate that DIE right away. add_type_attribute
+- called below will then pick (via lookup_type_die) that
+- anonymous struct DIE. */
+- if (!TREE_ASM_WRITTEN (type))
+- gen_tagged_type_die (type, context_die, DINFO_USAGE_DIR_USE);
++ add_type_attribute (type_die, type, decl_quals (decl), false,
++ context_die);
+
+- /* This is a GNU Extension. We are adding a
+- DW_AT_linkage_name attribute to the DIE of the
+- anonymous struct TYPE. The value of that attribute
+- is the name of the typedef decl naming the anonymous
+- struct. This greatly eases the work of consumers of
+- this debug info. */
+- add_linkage_name_raw (lookup_type_die (type), decl);
+- }
+- }
++ if (is_naming_typedef_decl (decl))
++ /* We want that all subsequent calls to lookup_type_die with
++ TYPE in argument yield the DW_TAG_typedef we have just
++ created. */
++ equate_type_number_to_die (type, type_die);
+
+- add_type_attribute (type_die, type, decl_quals (decl), false,
+- context_die);
++ add_alignment_attribute (type_die, TREE_TYPE (decl));
+
+- if (is_naming_typedef_decl (decl))
+- /* We want that all subsequent calls to lookup_type_die with
+- TYPE in argument yield the DW_TAG_typedef we have just
+- created. */
+- equate_type_number_to_die (type, type_die);
++ add_accessibility_attribute (type_die, decl);
+
+- type = TREE_TYPE (decl);
+-
+- add_alignment_attribute (type_die, type);
+-
+- add_accessibility_attribute (type_die, decl);
+- }
+-
+ if (DECL_ABSTRACT_P (decl))
+ equate_decl_number_to_die (decl, type_die);
+
+@@ -24535,8 +24540,16 @@
+ if (TREE_ASM_WRITTEN (type))
+ return;
+
++ tree name = TYPE_NAME (type);
++ tree origin = decl_ultimate_origin (name);
++ if (origin != NULL)
++ {
++ gen_decl_die (origin, NULL, NULL, context_die);
++ return;
++ }
++
+ /* Prevent broken recursion; we can't hand off to the same type. */
+- gcc_assert (DECL_ORIGINAL_TYPE (TYPE_NAME (type)) != type);
++ gcc_assert (DECL_ORIGINAL_TYPE (name) != type);
+
+ /* Give typedefs the right scope. */
+ context_die = scope_die_for (type, context_die);
+@@ -24543,7 +24556,7 @@
+
+ TREE_ASM_WRITTEN (type) = 1;
+
+- gen_decl_die (TYPE_NAME (type), NULL, NULL, context_die);
++ gen_decl_die (name, NULL, NULL, context_die);
+ return;
+ }
+
+@@ -24862,6 +24875,22 @@
+ else
+ die = NULL;
+
++ /* Avoid creating DIEs for local typedefs and concrete static variables that
++ will only be pruned later. */
++ if ((origin || decl_ultimate_origin (decl))
++ && (TREE_CODE (decl_or_origin) == TYPE_DECL
++ || (VAR_P (decl_or_origin) && TREE_STATIC (decl_or_origin))))
++ {
++ origin = decl_ultimate_origin (decl_or_origin);
++ if (decl && VAR_P (decl) && die != NULL)
++ {
++ die = lookup_decl_die (origin);
++ if (die != NULL)
++ equate_decl_number_to_die (decl, die);
++ }
++ return;
++ }
++
+ if (die != NULL && die->die_parent == NULL)
+ add_child_die (context_die, die);
+ else if (TREE_CODE (decl_or_origin) == IMPORTED_DECL)
+@@ -26058,7 +26087,8 @@
j = 0;
FOR_EACH_VEC_ELT (*tmpl_value_parm_die_table, i, e)
{
@@ -2306,10 +3484,350 @@ Index: gcc/dwarf2out.c
{
dw_loc_descr_ref loc = NULL;
if (! early_dwarf
+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,26 @@
++2017-09-05 Eric Botcazou <ebotcazou at adacore.com>
++
++ PR ada/62235
++ * gcc-interface/decl.c (gnat_to_gnu_entity): Skip regular processing
++ for Itypes that are E_Record_Subtype with a cloned subtype.
++ <E_Record_Subtype>: Use the DECL of the cloned type directly, if any.
++
++2017-09-05 Eric Botcazou <ebotcazou at adacore.com>
++
++ * gcc-interface/utils.c (unchecked_convert): When the result type is a
++ non-biased integral type with size 0, set the result to 0 directly.
++
++2017-09-05 Eric Botcazou <ebotcazou at adacore.com>
++
++ * gcc-interface/trans.c (Call_to_gnu): If this is a function call and
++ there is no target, do not create a temporary for the return value for
++ an allocator either.
++
++2017-09-05 Eric Botcazou <ebotcazou at adacore.com>
++
++ * gcc-interface/trans.c (pos_to_constructor): Skip conversions to an
++ unconstrained array type.
++
+ 2017-08-14 Release Manager
+
+ * GCC 7.2.0 released.
+Index: gcc/ada/gcc-interface/utils.c
+===================================================================
+--- a/src/gcc/ada/gcc-interface/utils.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/ada/gcc-interface/utils.c (.../branches/gcc-7-branch)
+@@ -5230,20 +5230,26 @@
+ ? TYPE_RM_SIZE (etype)
+ : TYPE_SIZE (etype)) == 0)))
+ {
+- tree base_type
+- = gnat_type_for_size (TREE_INT_CST_LOW (TYPE_SIZE (type)),
+- type_unsigned_for_rm (type));
+- tree shift_expr
+- = convert (base_type,
+- size_binop (MINUS_EXPR,
+- TYPE_SIZE (type), TYPE_RM_SIZE (type)));
+- expr
+- = convert (type,
+- build_binary_op (RSHIFT_EXPR, base_type,
+- build_binary_op (LSHIFT_EXPR, base_type,
+- convert (base_type, expr),
+- shift_expr),
+- shift_expr));
++ if (integer_zerop (TYPE_RM_SIZE (type)))
++ expr = build_int_cst (type, 0);
++ else
++ {
++ tree base_type
++ = gnat_type_for_size (TREE_INT_CST_LOW (TYPE_SIZE (type)),
++ type_unsigned_for_rm (type));
++ tree shift_expr
++ = convert (base_type,
++ size_binop (MINUS_EXPR,
++ TYPE_SIZE (type), TYPE_RM_SIZE (type)));
++ expr
++ = convert (type,
++ build_binary_op (RSHIFT_EXPR, base_type,
++ build_binary_op (LSHIFT_EXPR, base_type,
++ convert (base_type,
++ expr),
++ shift_expr),
++ shift_expr));
++ }
+ }
+
+ /* An unchecked conversion should never raise Constraint_Error. The code
+Index: gcc/ada/gcc-interface/decl.c
+===================================================================
+--- a/src/gcc/ada/gcc-interface/decl.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/ada/gcc-interface/decl.c (.../branches/gcc-7-branch)
+@@ -309,11 +309,14 @@
+
+ /* Since a use of an Itype is a definition, process it as such if it is in
+ the main unit, except for E_Access_Subtype because it's actually a use
+- of its base type, see below. */
++ of its base type, and for E_Record_Subtype with cloned subtype because
++ it's actually a use of the cloned subtype, see below. */
+ if (!definition
+ && is_type
+ && Is_Itype (gnat_entity)
+- && Ekind (gnat_entity) != E_Access_Subtype
++ && !(kind == E_Access_Subtype
++ || (kind == E_Record_Subtype
++ && Present (Cloned_Subtype (gnat_entity))))
+ && !present_gnu_tree (gnat_entity)
+ && In_Extended_Main_Code_Unit (gnat_entity))
+ {
+@@ -3391,7 +3394,7 @@
+ {
+ gnu_decl = gnat_to_gnu_entity (Cloned_Subtype (gnat_entity),
+ NULL_TREE, false);
+- maybe_present = true;
++ saved = true;
+ break;
+ }
+
+Index: gcc/ada/gcc-interface/trans.c
+===================================================================
+--- a/src/gcc/ada/gcc-interface/trans.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/ada/gcc-interface/trans.c (.../branches/gcc-7-branch)
+@@ -4326,11 +4326,11 @@
+ parameters.
+
+ 2. There is no target and the call is made for neither an object nor a
+- renaming declaration, nor a return statement, and the return type has
+- variable size, because in this case the gimplifier cannot create the
+- temporary, or more generally is simply an aggregate type, because the
+- gimplifier would create the temporary in the outermost scope instead
+- of locally.
++ renaming declaration, nor a return statement, nor an allocator, and
++ the return type has variable size because in this case the gimplifier
++ cannot create the temporary, or more generally is simply an aggregate
++ type, because the gimplifier would then create the temporary in the
++ outermost scope instead of locally.
+
+ 3. There is a target and it is a slice or an array with fixed size,
+ and the return type has variable size, because the gimplifier
+@@ -4349,6 +4349,8 @@
+ && Nkind (Parent (gnat_node)) != N_Object_Declaration
+ && Nkind (Parent (gnat_node)) != N_Object_Renaming_Declaration
+ && Nkind (Parent (gnat_node)) != N_Simple_Return_Statement
++ && !(Nkind (Parent (gnat_node)) == N_Qualified_Expression
++ && Nkind (Parent (Parent (gnat_node))) == N_Allocator)
+ && AGGREGATE_TYPE_P (gnu_result_type)
+ && !TYPE_IS_FAT_POINTER_P (gnu_result_type))
+ || (gnu_target
+@@ -9702,7 +9704,14 @@
+ gnat_component_type);
+ else
+ {
+- gnu_expr = gnat_to_gnu (gnat_expr);
++ /* If the expression is a conversion to an unconstrained array type,
++ skip it to avoid spilling to memory. */
++ if (Nkind (gnat_expr) == N_Type_Conversion
++ && Is_Array_Type (Etype (gnat_expr))
++ && !Is_Constrained (Etype (gnat_expr)))
++ gnu_expr = gnat_to_gnu (Expression (gnat_expr));
++ else
++ gnu_expr = gnat_to_gnu (gnat_expr);
+
+ /* Before assigning the element to the array, make sure it is
+ in range. */
Index: gcc/gimple-ssa-strength-reduction.c
===================================================================
--- a/src/gcc/gimple-ssa-strength-reduction.c (.../tags/gcc_7_2_0_release)
+++ b/src/gcc/gimple-ssa-strength-reduction.c (.../branches/gcc-7-branch)
+@@ -2044,105 +2044,105 @@
+ tree target_type = TREE_TYPE (gimple_assign_lhs (c->cand_stmt));
+ enum tree_code cand_code = gimple_assign_rhs_code (c->cand_stmt);
+
+- /* It is highly unlikely, but possible, that the resulting
+- bump doesn't fit in a HWI. Abandon the replacement
+- in this case. This does not affect siblings or dependents
+- of C. Restriction to signed HWI is conservative for unsigned
+- types but allows for safe negation without twisted logic. */
+- if (wi::fits_shwi_p (bump)
+- && bump.to_shwi () != HOST_WIDE_INT_MIN
+- /* It is not useful to replace casts, copies, negates, or adds of
+- an SSA name and a constant. */
+- && cand_code != SSA_NAME
+- && !CONVERT_EXPR_CODE_P (cand_code)
+- && cand_code != PLUS_EXPR
+- && cand_code != POINTER_PLUS_EXPR
+- && cand_code != MINUS_EXPR
+- && cand_code != NEGATE_EXPR)
++ /* It is not useful to replace casts, copies, negates, or adds of
++ an SSA name and a constant. */
++ if (cand_code == SSA_NAME
++ || CONVERT_EXPR_CODE_P (cand_code)
++ || cand_code == PLUS_EXPR
++ || cand_code == POINTER_PLUS_EXPR
++ || cand_code == MINUS_EXPR
++ || cand_code == NEGATE_EXPR)
++ return;
++
++ enum tree_code code = PLUS_EXPR;
++ tree bump_tree;
++ gimple *stmt_to_print = NULL;
++
++ /* If the basis name and the candidate's LHS have incompatible
++ types, introduce a cast. */
++ if (!useless_type_conversion_p (target_type, TREE_TYPE (basis_name)))
++ basis_name = introduce_cast_before_cand (c, target_type, basis_name);
++ if (wi::neg_p (bump))
+ {
+- enum tree_code code = PLUS_EXPR;
+- tree bump_tree;
+- gimple *stmt_to_print = NULL;
++ code = MINUS_EXPR;
++ bump = -bump;
++ }
+
+- /* If the basis name and the candidate's LHS have incompatible
+- types, introduce a cast. */
+- if (!useless_type_conversion_p (target_type, TREE_TYPE (basis_name)))
+- basis_name = introduce_cast_before_cand (c, target_type, basis_name);
+- if (wi::neg_p (bump))
++ /* It is possible that the resulting bump doesn't fit in target_type.
++ Abandon the replacement in this case. This does not affect
++ siblings or dependents of C. */
++ if (bump != wi::ext (bump, TYPE_PRECISION (target_type),
++ TYPE_SIGN (target_type)))
++ return;
++
++ bump_tree = wide_int_to_tree (target_type, bump);
++
++ if (dump_file && (dump_flags & TDF_DETAILS))
++ {
++ fputs ("Replacing: ", dump_file);
++ print_gimple_stmt (dump_file, c->cand_stmt, 0, 0);
++ }
++
++ if (bump == 0)
++ {
++ tree lhs = gimple_assign_lhs (c->cand_stmt);
++ gassign *copy_stmt = gimple_build_assign (lhs, basis_name);
++ gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
++ slsr_cand_t cc = c;
++ gimple_set_location (copy_stmt, gimple_location (c->cand_stmt));
++ gsi_replace (&gsi, copy_stmt, false);
++ c->cand_stmt = copy_stmt;
++ while (cc->next_interp)
+ {
+- code = MINUS_EXPR;
+- bump = -bump;
++ cc = lookup_cand (cc->next_interp);
++ cc->cand_stmt = copy_stmt;
+ }
+-
+- bump_tree = wide_int_to_tree (target_type, bump);
+-
+ if (dump_file && (dump_flags & TDF_DETAILS))
++ stmt_to_print = copy_stmt;
++ }
++ else
++ {
++ tree rhs1, rhs2;
++ if (cand_code != NEGATE_EXPR) {
++ rhs1 = gimple_assign_rhs1 (c->cand_stmt);
++ rhs2 = gimple_assign_rhs2 (c->cand_stmt);
++ }
++ if (cand_code != NEGATE_EXPR
++ && ((operand_equal_p (rhs1, basis_name, 0)
++ && operand_equal_p (rhs2, bump_tree, 0))
++ || (operand_equal_p (rhs1, bump_tree, 0)
++ && operand_equal_p (rhs2, basis_name, 0))))
+ {
+- fputs ("Replacing: ", dump_file);
+- print_gimple_stmt (dump_file, c->cand_stmt, 0, 0);
++ if (dump_file && (dump_flags & TDF_DETAILS))
++ {
++ fputs ("(duplicate, not actually replacing)", dump_file);
++ stmt_to_print = c->cand_stmt;
++ }
+ }
+-
+- if (bump == 0)
++ else
+ {
+- tree lhs = gimple_assign_lhs (c->cand_stmt);
+- gassign *copy_stmt = gimple_build_assign (lhs, basis_name);
+ gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
+ slsr_cand_t cc = c;
+- gimple_set_location (copy_stmt, gimple_location (c->cand_stmt));
+- gsi_replace (&gsi, copy_stmt, false);
+- c->cand_stmt = copy_stmt;
++ gimple_assign_set_rhs_with_ops (&gsi, code,
++ basis_name, bump_tree);
++ update_stmt (gsi_stmt (gsi));
++ c->cand_stmt = gsi_stmt (gsi);
+ while (cc->next_interp)
+ {
+ cc = lookup_cand (cc->next_interp);
+- cc->cand_stmt = copy_stmt;
++ cc->cand_stmt = gsi_stmt (gsi);
+ }
+ if (dump_file && (dump_flags & TDF_DETAILS))
+- stmt_to_print = copy_stmt;
++ stmt_to_print = gsi_stmt (gsi);
+ }
+- else
+- {
+- tree rhs1, rhs2;
+- if (cand_code != NEGATE_EXPR) {
+- rhs1 = gimple_assign_rhs1 (c->cand_stmt);
+- rhs2 = gimple_assign_rhs2 (c->cand_stmt);
+- }
+- if (cand_code != NEGATE_EXPR
+- && ((operand_equal_p (rhs1, basis_name, 0)
+- && operand_equal_p (rhs2, bump_tree, 0))
+- || (operand_equal_p (rhs1, bump_tree, 0)
+- && operand_equal_p (rhs2, basis_name, 0))))
+- {
+- if (dump_file && (dump_flags & TDF_DETAILS))
+- {
+- fputs ("(duplicate, not actually replacing)", dump_file);
+- stmt_to_print = c->cand_stmt;
+- }
+- }
+- else
+- {
+- gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
+- slsr_cand_t cc = c;
+- gimple_assign_set_rhs_with_ops (&gsi, code,
+- basis_name, bump_tree);
+- update_stmt (gsi_stmt (gsi));
+- c->cand_stmt = gsi_stmt (gsi);
+- while (cc->next_interp)
+- {
+- cc = lookup_cand (cc->next_interp);
+- cc->cand_stmt = gsi_stmt (gsi);
+- }
+- if (dump_file && (dump_flags & TDF_DETAILS))
+- stmt_to_print = gsi_stmt (gsi);
+- }
+- }
+-
+- if (dump_file && (dump_flags & TDF_DETAILS))
+- {
+- fputs ("With: ", dump_file);
+- print_gimple_stmt (dump_file, stmt_to_print, 0, 0);
+- fputs ("\n", dump_file);
+- }
+ }
++
++ if (dump_file && (dump_flags & TDF_DETAILS))
++ {
++ fputs ("With: ", dump_file);
++ print_gimple_stmt (dump_file, stmt_to_print, 0, 0);
++ fputs ("\n", dump_file);
++ }
+ }
+
+ /* Replace candidate C with an add or subtract. Note that we only
@@ -2193,8 +2193,6 @@
widest_int increment, edge e, location_t loc,
bool known_stride)
@@ -2382,7 +3900,14 @@ 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,17 @@
+@@ -1,3 +1,24 @@
++2017-09-02 Janus Weil <janus at gcc.gnu.org>
++
++ Backport from trunk
++ PR fortran/81770
++ * expr.c (gfc_check_pointer_assign): Improve the check whether pointer
++ may outlive pointer target.
++
+2017-08-22 Jerry DeLisle <jvdelisle at gcc.gnu.org>
+
+ Backport from trunk
@@ -2416,6 +3941,20 @@ Index: gcc/fortran/trans-stmt.c
gfc_mark_ss_chain_used (ss, 1);
/* Convert the arguments, checking for dependencies. */
+Index: gcc/fortran/expr.c
+===================================================================
+--- a/src/gcc/fortran/expr.c (.../tags/gcc_7_2_0_release)
++++ b/src/gcc/fortran/expr.c (.../branches/gcc-7-branch)
+@@ -3806,7 +3806,8 @@
+ if (warn_target_lifetime
+ && rvalue->expr_type == EXPR_VARIABLE
+ && !rvalue->symtree->n.sym->attr.save
+- && !attr.pointer && !rvalue->symtree->n.sym->attr.host_assoc
++ && !rvalue->symtree->n.sym->attr.pointer && !attr.pointer
++ && !rvalue->symtree->n.sym->attr.host_assoc
+ && !rvalue->symtree->n.sym->attr.in_common
+ && !rvalue->symtree->n.sym->attr.use_assoc
+ && !rvalue->symtree->n.sym->attr.dummy)
Index: gcc/fortran/trans-io.c
===================================================================
--- a/src/gcc/fortran/trans-io.c (.../tags/gcc_7_2_0_release)
--
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