diff -u gcc-6-6.2.0/debian/changelog gcc-6-6.2.0/debian/changelog --- gcc-6-6.2.0/debian/changelog +++ gcc-6-6.2.0/debian/changelog @@ -1,9 +1,45 @@ -gcc-6 (6.2.0-3ubuntu21) yakkety; urgency=medium +gcc-6 (6.2.0-5ubuntu21) yakkety; urgency=medium * Build using the Linaro branch on armhf and arm64. -- Matthias Klose Wed, 14 Sep 2016 13:53:11 +0200 +gcc-6 (6.2.0-5ubuntu11) yakkety; urgency=medium + + * Merge with Debian; remaining changes: + - Build from upstream sources. + + -- Matthias Klose Wed, 28 Sep 2016 15:58:48 +0200 + +gcc-6 (6.2.0-5) unstable; urgency=medium + + * Update to SVN 20160927 (r240553, 6.2.1) from the gcc-6-branch. + - Fix PR sanitizer/77396, PR libstdc++/77645, PR libstdc++/77645, + PR target/77326 (AVR), PR target/77349 (PPC), PR middle-end/77594, + PR sanitizer/68260, PR fortran/77516, PR target/69255 (x86), + PR c++/77553, PR c++/77539, PR fortran/77500, PR c/77450, + PR middle-end/77436, PR tree-optimization/77514, PR middle-end/77544, + PR tree-optimization/77514, PR middle-end/77605, PR middle-end/77679, + PR tree-optimization/77621, PR target/77621 (x86), PR c++/71979. + * Fix gij installation on hppa. Closes: #838111. + * Fix PR rtl-optimization/71709, taken from the trunk. LP: #1628207. + * Apply workaround for PR libstdc++/77686. Addresses: #838438. + + -- Matthias Klose Wed, 28 Sep 2016 15:53:28 +0200 + +gcc-6 (6.2.0-4) unstable; urgency=medium + + * Update to SVN 20160914 (r240133, 6.2.1) from the gcc-6-branch. + - Fix PR rtl-optimization/77452, PR c++/77427. + * gcj: Depend on the ecj1 standalone binary. + * Configure native builds using --with-program-prefix. + * Fix ICE in gdc symbol mangling (Iain Buclaw). LP: #1620681. + * Backport from libffi trunk (Stefan Bühler): + - Always check for PaX MPROTECT on linux, make EMUTRAMP experimental. + - dlmmap_locked always needs locking as it always modifies execsize. + + -- Matthias Klose Thu, 15 Sep 2016 19:22:35 +0200 + gcc-6 (6.2.0-3ubuntu15) yakkety; urgency=medium * Update to SVN 20160914 (r240133, 6.2.1) from the gcc-6-branch. diff -u gcc-6-6.2.0/debian/patches/svn-updates.diff gcc-6-6.2.0/debian/patches/svn-updates.diff --- gcc-6-6.2.0/debian/patches/svn-updates.diff +++ gcc-6-6.2.0/debian/patches/svn-updates.diff @@ -1,10 +1,10 @@ -# DP: updates from the 6 branch upto 20160914 (r240133). +# DP: updates from the 6 branch upto 20160922 (r240553). last_update() { cat > ${dir}LAST_UPDATED check_initialization_order || +- !CanPoisonMemory()) ++ !CanPoisonMemory() || ++ !dynamic_init_globals) + return; + bool strict_init_order = flags()->strict_init_order; +- CHECK(dynamic_init_globals); + CHECK(module_name); + CHECK(asan_inited); + BlockingMutexLock lock(&mu_for_globals); +@@ -274,7 +274,8 @@ + // TU are poisoned. It simply unpoisons all dynamically initialized globals. + void __asan_after_dynamic_init() { + if (!flags()->check_initialization_order || +- !CanPoisonMemory()) ++ !CanPoisonMemory() || ++ !dynamic_init_globals) + return; + CHECK(asan_inited); + BlockingMutexLock lock(&mu_for_globals); +Index: libsanitizer/ChangeLog +=================================================================== +--- a/src/libsanitizer/ChangeLog (.../tags/gcc_6_2_0_release) ++++ b/src/libsanitizer/ChangeLog (.../branches/gcc-6-branch) +@@ -1,3 +1,11 @@ ++2016-09-16 Jakub Jelinek ++ ++ Backported from mainline ++ 2016-09-05 Jakub Jelinek ++ ++ PR sanitizer/77396 ++ * asan/asan_globals.cc: Cherry-pick upstream r280657. ++ + 2016-08-22 Release Manager + + * GCC 6.2.0 released. +Index: libstdc++-v3/configure +=================================================================== +--- a/src/libstdc++-v3/configure (.../tags/gcc_6_2_0_release) ++++ b/src/libstdc++-v3/configure (.../branches/gcc-6-branch) +@@ -15538,10 +15538,12 @@ + ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +- # Set atomicity_dir to builtins if all but the long long test above passes. +- if test "$glibcxx_cv_atomic_bool" = yes \ ++ # Set atomicity_dir to builtins if all but the long long test above passes, ++ # or if the builtins were already chosen (e.g. by configure.host). ++ if { test "$glibcxx_cv_atomic_bool" = yes \ + && test "$glibcxx_cv_atomic_short" = yes \ +- && test "$glibcxx_cv_atomic_int" = yes; then ++ && test "$glibcxx_cv_atomic_int" = yes; } \ ++ || test "$atomicity_dir" = "cpu/generic/atomicity_builtins"; then + + $as_echo "#define _GLIBCXX_ATOMIC_BUILTINS 1" >>confdefs.h + +@@ -15573,7 +15575,7 @@ + # unnecessary for this test. + + cat > conftest.$ac_ext << EOF +-#line 15576 "configure" ++#line 15578 "configure" + int main() + { + _Decimal32 d1; +@@ -15615,7 +15617,7 @@ + # unnecessary for this test. + + cat > conftest.$ac_ext << EOF +-#line 15618 "configure" ++#line 15620 "configure" + template + struct same + { typedef T2 type; }; +@@ -15649,7 +15651,7 @@ + rm -f conftest* + + cat > conftest.$ac_ext << EOF +-#line 15652 "configure" ++#line 15654 "configure" + template + struct same + { typedef T2 type; }; +Index: libstdc++-v3/python/libstdcxx/v6/xmethods.py +=================================================================== +--- a/src/libstdc++-v3/python/libstdcxx/v6/xmethods.py (.../tags/gcc_6_2_0_release) ++++ b/src/libstdc++-v3/python/libstdcxx/v6/xmethods.py (.../branches/gcc-6-branch) +@@ -165,7 +165,7 @@ + class DequeWorkerBase(gdb.xmethod.XMethodWorker): + def __init__(self, val_type): + self._val_type = val_type +- self._bufsize = (512 / val_type.sizeof) or 1 ++ self._bufsize = 512 // val_type.sizeof or 1 + + def size(self, obj): + first_node = obj['_M_impl']['_M_start']['_M_node'] +@@ -174,10 +174,10 @@ + first = obj['_M_impl']['_M_finish']['_M_first'] + return (last_node - first_node) * self._bufsize + (cur - first) + +- def index(self, obj, index): ++ def index(self, obj, idx): + first_node = obj['_M_impl']['_M_start']['_M_node'] +- index_node = first_node + index / self._bufsize +- return index_node[0][index % self._bufsize] ++ index_node = first_node + int(idx) // self._bufsize ++ return index_node[0][idx % self._bufsize] + + class DequeEmptyWorker(DequeWorkerBase): + def get_arg_types(self): +@@ -328,6 +328,15 @@ + def get_arg_types(self): + return None + ++ def get_value_from_node(self, node): ++ node = node.dereference() ++ if node.type.fields()[1].name == '_M_data': ++ # C++03 implementation, node contains the value as a member ++ return node['_M_data'] ++ # C++11 implementation, node stores value in __aligned_membuf ++ addr = node['_M_storage'].address ++ return addr.cast(self._val_type.pointer()).dereference() ++ + class ListEmptyWorker(ListWorkerBase): + def get_result_type(self, obj): + return get_bool_type() +@@ -358,7 +367,7 @@ + + def __call__(self, obj): + node = obj['_M_impl']['_M_node']['_M_next'].cast(self._node_type) +- return node['_M_data'] ++ return self.get_value_from_node(node) + + class ListBackWorker(ListWorkerBase): + def get_result_type(self, obj): +@@ -366,7 +375,7 @@ + + def __call__(self, obj): + prev_node = obj['_M_impl']['_M_node']['_M_prev'].cast(self._node_type) +- return prev_node['_M_data'] ++ return self.get_value_from_node(prev_node) + + class ListMethodsMatcher(gdb.xmethod.XMethodMatcher): + def __init__(self): +@@ -410,7 +419,7 @@ + if self._val_type.code == gdb.TYPE_CODE_BOOL: + start = obj['_M_impl']['_M_start']['_M_p'] + bit_size = start.dereference().type.sizeof * 8 +- valp = start + index / bit_size ++ valp = start + index // bit_size + offset = index % bit_size + return (valp.dereference() & (1 << offset)) > 0 + else: Index: libstdc++-v3/scripts/testsuite_flags.in =================================================================== --- a/src/libstdc++-v3/scripts/testsuite_flags.in (.../tags/gcc_6_2_0_release) @@ -66,6 +226,21 @@ CXXFLAGS_config="@SECTION_FLAGS@ @EXTRA_CXX_FLAGS@" echo ${CXXFLAGS_default} ${CXXFLAGS_config} ;; +Index: libstdc++-v3/configure.host +=================================================================== +--- a/src/libstdc++-v3/configure.host (.../tags/gcc_6_2_0_release) ++++ b/src/libstdc++-v3/configure.host (.../branches/gcc-6-branch) +@@ -300,6 +300,10 @@ + os_include_dir="os/qnx/qnx6.1" + c_model=c + ;; ++ rtems*) ++ # Use libatomic if necessary and avoid libstdc++ specific atomicity support ++ atomicity_dir="cpu/generic/atomicity_builtins" ++ ;; + solaris2) + # This too-vague configuration does not provide enough information + # to select a ctype include, and thus os_include_dir is a crap shoot. Index: libstdc++-v3/doc/xml/api.xml =================================================================== --- a/src/libstdc++-v3/doc/xml/api.xml (.../tags/gcc_6_2_0_release) @@ -212,11 +387,38 @@ The rendered HTML, as above, is also available for download on the gcc.gnu.org site in a directory located at <URL:ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/>. +Index: libstdc++-v3/include/debug/safe_iterator.h +=================================================================== +--- a/src/libstdc++-v3/include/debug/safe_iterator.h (.../tags/gcc_6_2_0_release) ++++ b/src/libstdc++-v3/include/debug/safe_iterator.h (.../branches/gcc-6-branch) +@@ -296,7 +296,7 @@ + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); +- __gnu_cxx::__scoped_lock(this->_M_get_mutex()); ++ __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + ++base(); + return *this; + } Index: libstdc++-v3/include/std/type_traits =================================================================== --- a/src/libstdc++-v3/include/std/type_traits (.../tags/gcc_6_2_0_release) +++ b/src/libstdc++-v3/include/std/type_traits (.../branches/gcc-6-branch) -@@ -994,6 +994,9 @@ +@@ -154,6 +154,13 @@ + : public integral_constant + { }; + ++ struct __nonesuch { ++ __nonesuch() = delete; ++ ~__nonesuch() = delete; ++ __nonesuch(__nonesuch const&) = delete; ++ void operator=(__nonesuch const&) = delete; ++ }; ++ + #if __cplusplus > 201402L + + #define __cpp_lib_logical_traits 201510 +@@ -994,6 +1001,9 @@ is_function<_From>>>::value> struct __is_base_to_derived_ref; @@ -226,7 +428,7 @@ // Detect whether we have a downcast situation during // reference binding. template -@@ -1004,7 +1007,8 @@ +@@ -1004,7 +1014,8 @@ typedef typename remove_cv::type>::type __dst_t; typedef __and_<__not_>, @@ -236,6 +438,362 @@ static constexpr bool value = type::value; }; +Index: libstdc++-v3/include/bits/stl_pair.h +=================================================================== +--- a/src/libstdc++-v3/include/bits/stl_pair.h (.../tags/gcc_6_2_0_release) ++++ b/src/libstdc++-v3/include/bits/stl_pair.h (.../branches/gcc-6-branch) +@@ -88,53 +88,96 @@ + // Concept utility functions, reused in conditionally-explicit + // constructors. + // See PR 70437, don't look at is_constructible or +- // is_convertible if the decayed types are the same to ++ // is_convertible if the types are the same to + // avoid querying those properties for incomplete types. +- template +- constexpr bool _ConstructiblePair() +- { +- return __and_<__or_::type, +- typename decay<_U1>::type>, +- is_constructible<_T1, const _U1&>>, +- __or_::type, +- typename decay<_U2>::type>, +- is_constructible<_T2, const _U2&>>>::value; +- } ++ template ++ struct _PCC ++ { ++ template ++ static constexpr bool _ConstructiblePair() ++ { ++ return __and_, ++ is_constructible<_T2, const _U2&>>::value; ++ } + +- template +- constexpr bool _ImplicitlyConvertiblePair() +- { +- return __and_<__or_::type, +- typename decay<_U1>::type>, +- is_convertible>, +- __or_::type, +- typename decay<_U2>::type>, +- is_convertible>>::value; +- } ++ template ++ static constexpr bool _ImplicitlyConvertiblePair() ++ { ++ return __and_, ++ is_convertible>::value; ++ } + +- template +- constexpr bool _MoveConstructiblePair() +- { +- return __and_<__or_::type, +- typename decay<_U1>::type>, +- is_constructible<_T1, _U1&&>>, +- __or_::type, +- typename decay<_U2>::type>, +- is_constructible<_T2, _U2&&>>>::value; +- } ++ template ++ static constexpr bool _MoveConstructiblePair() ++ { ++ return __and_, ++ is_constructible<_T2, _U2&&>>::value; ++ } + +- template +- constexpr bool _ImplicitlyMoveConvertiblePair() +- { +- return __and_<__or_::type, +- typename decay<_U1>::type>, +- is_convertible<_U1&&, _T1>>, +- __or_::type, +- typename decay<_U2>::type>, +- is_convertible<_U2&&, _T2>>>::value; +- } ++ template ++ static constexpr bool _ImplicitlyMoveConvertiblePair() ++ { ++ return __and_, ++ is_convertible<_U2&&, _T2>>::value; ++ } + ++ template ++ static constexpr bool _CopyMovePair() ++ { ++ using __do_converts = __and_, ++ is_convertible<_U2&&, _T2>>; ++ using __converts = typename conditional<__implicit, ++ __do_converts, ++ __not_<__do_converts>>::type; ++ return __and_, ++ is_constructible<_T2, _U2&&>, ++ __converts ++ >::value; ++ } + ++ template ++ static constexpr bool _MoveCopyPair() ++ { ++ using __do_converts = __and_, ++ is_convertible>; ++ using __converts = typename conditional<__implicit, ++ __do_converts, ++ __not_<__do_converts>>::type; ++ return __and_, ++ is_constructible<_T2, const _U2&&>, ++ __converts ++ >::value; ++ } ++ }; ++ ++ template ++ struct _PCC ++ { ++ template ++ static constexpr bool _ConstructiblePair() ++ { ++ return false; ++ } ++ ++ template ++ static constexpr bool _ImplicitlyConvertiblePair() ++ { ++ return false; ++ } ++ ++ template ++ static constexpr bool _MoveConstructiblePair() ++ { ++ return false; ++ } ++ ++ template ++ static constexpr bool _ImplicitlyMoveConvertiblePair() ++ { ++ return false; ++ } ++ }; ++ + #endif + + /** +@@ -186,16 +229,23 @@ + pair(const _T1& __a, const _T2& __b) + : first(__a), second(__b) { } + #else ++ // Shortcut for constraining the templates that don't take pairs. ++ using _PCCP = _PCC; ++ + template() +- && _ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(), ++ enable_if<_PCCP::template ++ _ConstructiblePair<_U1, _U2>() ++ && _PCCP::template ++ _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(const _T1& __a, const _T2& __b) + : first(__a), second(__b) { } + + template() +- && !_ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(), ++ enable_if<_PCCP::template ++ _ConstructiblePair<_U1, _U2>() ++ && !_PCCP::template ++ _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(const _T1& __a, const _T2& __b) + : first(__a), second(__b) { } +@@ -207,16 +257,26 @@ + pair(const pair<_U1, _U2>& __p) + : first(__p.first), second(__p.second) { } + #else ++ // Shortcut for constraining the templates that take pairs. ++ template ++ using _PCCFP = _PCC::value ++ || !is_same<_T2, _U2>::value, ++ _T1, _T2>; ++ + template() +- && _ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(), +- bool>::type=true> ++ enable_if<_PCCFP<_U1, _U2>::template ++ _ConstructiblePair<_U1, _U2>() ++ && _PCCFP<_U1, _U2>::template ++ _ImplicitlyConvertiblePair<_U1, _U2>(), ++ bool>::type=true> + constexpr pair(const pair<_U1, _U2>& __p) + : first(__p.first), second(__p.second) { } + + template() +- && !_ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(), ++ enable_if<_PCCFP<_U1, _U2>::template ++ _ConstructiblePair<_U1, _U2>() ++ && !_PCCFP<_U1, _U2>::template ++ _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(const pair<_U1, _U2>& __p) + : first(__p.first), second(__p.second) { } +@@ -226,57 +286,47 @@ + + // DR 811. + template() +- && _MoveConstructiblePair<_T1, _T2, _U1, _T2>() +- && _ImplicitlyConvertiblePair<_T2, _T2, _T2, _T2>() +- && _ImplicitlyMoveConvertiblePair<_T1, _T2, +- _U1, _T2>(), ++ enable_if<_PCCP::template ++ _MoveCopyPair(), + bool>::type=true> + constexpr pair(_U1&& __x, const _T2& __y) + : first(std::forward<_U1>(__x)), second(__y) { } + + template() +- && _MoveConstructiblePair<_T1, _T2, _U1, _T2>() +- && (!_ImplicitlyConvertiblePair<_T2, _T2, _T2, _T2>() +- || !_ImplicitlyMoveConvertiblePair<_T1, _T2, +- _U1, _T2>()), ++ enable_if<_PCCP::template ++ _MoveCopyPair(), + bool>::type=false> + explicit constexpr pair(_U1&& __x, const _T2& __y) + : first(std::forward<_U1>(__x)), second(__y) { } + + template() +- && _MoveConstructiblePair<_T1, _T2, _T1, _U2>() +- && _ImplicitlyConvertiblePair<_T1, _T1, _T1, _T1>() +- && _ImplicitlyMoveConvertiblePair<_T1, _T2, +- _T1, _U2>(), ++ enable_if<_PCCP::template ++ _CopyMovePair(), + bool>::type=true> + constexpr pair(const _T1& __x, _U2&& __y) + : first(__x), second(std::forward<_U2>(__y)) { } + + template() +- && _MoveConstructiblePair<_T1, _T2, _T1, _U2>() +- && (!_ImplicitlyConvertiblePair<_T1, _T1, _T1, _T1>() +- || !_ImplicitlyMoveConvertiblePair<_T1, _T2, +- _T1, _U2>()), ++ enable_if<_PCCP::template ++ _CopyMovePair(), + bool>::type=false> + explicit pair(const _T1& __x, _U2&& __y) + : first(__x), second(std::forward<_U2>(__y)) { } + + template() +- && _ImplicitlyMoveConvertiblePair<_T1, _T2, +- _U1, _U2>(), ++ enable_if<_PCCP::template ++ _MoveConstructiblePair<_U1, _U2>() ++ && _PCCP::template ++ _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(_U1&& __x, _U2&& __y) + : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } + + template() +- && !_ImplicitlyMoveConvertiblePair<_T1, _T2, +- _U1, _U2>(), ++ enable_if<_PCCP::template ++ _MoveConstructiblePair<_U1, _U2>() ++ && !_PCCP::template ++ _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(_U1&& __x, _U2&& __y) + : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } +@@ -283,9 +333,10 @@ + + + template() +- && _ImplicitlyMoveConvertiblePair<_T1, _T2, +- _U1, _U2>(), ++ enable_if<_PCCFP<_U1, _U2>::template ++ _MoveConstructiblePair<_U1, _U2>() ++ && _PCCFP<_U1, _U2>::template ++ _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(pair<_U1, _U2>&& __p) + : first(std::forward<_U1>(__p.first)), +@@ -292,9 +343,10 @@ + second(std::forward<_U2>(__p.second)) { } + + template() +- && !_ImplicitlyMoveConvertiblePair<_T1, _T2, +- _U1, _U2>(), ++ enable_if<_PCCFP<_U1, _U2>::template ++ _MoveConstructiblePair<_U1, _U2>() ++ && !_PCCFP<_U1, _U2>::template ++ _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(pair<_U1, _U2>&& __p) + : first(std::forward<_U1>(__p.first)), +@@ -304,7 +356,10 @@ + pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); + + pair& +- operator=(const pair& __p) ++ operator=(typename conditional< ++ __and_, ++ is_copy_assignable<_T2>>::value, ++ const pair&, const __nonesuch&>::type __p) + { + first = __p.first; + second = __p.second; +@@ -312,7 +367,16 @@ + } + + pair& +- operator=(pair&& __p) ++ operator=(typename conditional< ++ __not_<__and_, ++ is_copy_assignable<_T2>>>::value, ++ const pair&, const __nonesuch&>::type __p) = delete; ++ ++ pair& ++ operator=(typename conditional< ++ __and_, ++ is_move_assignable<_T2>>::value, ++ pair&&, __nonesuch&&>::type __p) + noexcept(__and_, + is_nothrow_move_assignable<_T2>>::value) + { +@@ -322,7 +386,9 @@ + } + + template +- pair& ++ typename enable_if<__and_, ++ is_assignable<_T2&, const _U2&>>::value, ++ pair&>::type + operator=(const pair<_U1, _U2>& __p) + { + first = __p.first; +@@ -331,7 +397,9 @@ + } + + template +- pair& ++ typename enable_if<__and_, ++ is_assignable<_T2&, _U2&&>>::value, ++ pair&>::type + operator=(pair<_U1, _U2>&& __p) + { + first = std::forward<_U1>(__p.first); Index: libstdc++-v3/include/bits/stl_iterator.h =================================================================== --- a/src/libstdc++-v3/include/bits/stl_iterator.h (.../tags/gcc_6_2_0_release) @@ -346,7 +904,66 @@ =================================================================== --- a/src/libstdc++-v3/ChangeLog (.../tags/gcc_6_2_0_release) +++ b/src/libstdc++-v3/ChangeLog (.../branches/gcc-6-branch) -@@ -1,3 +1,47 @@ +@@ -1,3 +1,106 @@ ++2016-09-27 Jonathan Wakely ++ ++ * include/debug/safe_iterator.h (_Safe_iterator::operator++()): Fix ++ lifetime of lock. ++ ++2015-09-27 Sebastian Huber ++ ++ Backport from mainline ++ 2015-09-23 Sebastian Huber ++ ++ * config/cpu/m68k/atomicity.h: Adjust comment. ++ * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Honor ++ explicit atomicity_dir setup via configure.host. ++ * configure.host (rtems-*): Set atomicity_dir. ++ * configure: Regenerate. ++ ++2016-09-26 Ville Voutilainen ++ ++ Backport from mainline ++ 2016-09-21 Ville Voutilainen ++ ++ Implement LWG 2729 for pair. ++ * include/bits/stl_pair.h (_PCC): New. ++ (_ConstructiblePair, _ImplicitlyConvertiblePair): ++ Turn into static member functions of _PCC. ++ (_MoveConstructiblePair, _ImplicitlyMoveConvertiblePair): Likewise. ++ (_PCCP): New. ++ (pair(const _T1&, const _T2&)): Adjust. ++ (_PCCFP): New. ++ (pair(const pair<_U1, _U2>&)): Adjust. ++ (pair(_U1&&, const _T2&)): Likewise. ++ (pair(const _T1&, _U2&&)): Likewise. ++ (pair(_U1&&, _U2&&)): Likewise. ++ (pair(pair<_U1, _U2>&&)): Likewise. ++ (operator=(const pair&)): Make conditionally deleted. ++ (operator=(pair&&)): Make conditionally suppressed. ++ (operator=(const pair<_U1, _U2>&)): Constrain. ++ (operator=(pair<_U1, _U2>&&): Likewise. ++ * include/std/type_traits (__nonesuch): New. ++ * testsuite/20_util/pair/traits.cc: New. ++ ++2016-09-20 Jonathan Wakely ++ ++ * python/libstdcxx/v6/xmethods.py (DequeWorkerBase.__init__) ++ (DequeWorkerBase.index, VectorWorkerBase.get): Use // for division. ++ ++2016-09-19 Jonathan Wakely ++ ++ PR libstdc++/77645 ++ * python/libstdcxx/v6/xmethods.py (DequeWorkerBase.__init__) ++ (DequeWorkerBase.index, VectorWorkerBase.get): Cast results of ++ division to int to work with Python 3. ++ ++ PR libstdc++/77645 ++ * python/libstdcxx/v6/xmethods.py (DequeWorkerBase.index): Rename ++ argument. ++ (ListWorkerBase.get_value_from_node): Define new method. ++ (ListFrontWorker.__call__, ListBackWorker.__call__): Use it. ++ +2016-08-31 Ville Voutilainen + + PR libstdc++/77395 @@ -476,6 +1093,88 @@ + std::map m1, m2; + m2 = std::move(m1); +} +Index: libstdc++-v3/testsuite/20_util/pair/traits.cc +=================================================================== +--- a/src/libstdc++-v3/testsuite/20_util/pair/traits.cc (.../tags/gcc_6_2_0_release) ++++ b/src/libstdc++-v3/testsuite/20_util/pair/traits.cc (.../branches/gcc-6-branch) +@@ -0,0 +1,77 @@ ++// { dg-do compile } ++// { dg-options "-std=gnu++11" } ++ ++// Copyright (C) 2016 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 ++// . ++ ++#include ++ ++#include ++#include ++ ++using namespace std; ++ ++struct Poison ++{ ++ Poison(Poison&&) = delete; ++}; ++ ++struct ThrowingCopy ++{ ++ ThrowingCopy(const ThrowingCopy&) {} ++ ThrowingCopy& operator=(const ThrowingCopy&) {} ++}; ++ ++int main() ++{ ++ static_assert(!is_copy_constructible::value, ""); ++ static_assert(!is_move_constructible::value, ""); ++ static_assert(!is_copy_assignable::value, ""); ++ static_assert(!is_move_assignable::value, ""); ++ static_assert(!is_copy_constructible>::value, ++ ""); ++ static_assert(!is_move_constructible>::value, ++ ""); ++ static_assert(!is_copy_assignable>::value, ""); ++ static_assert(!is_move_assignable>::value, ""); ++ static_assert(!is_constructible&, ++ std::pair&>::value, ""); ++ static_assert(!is_assignable&, ++ std::pair&>::value, ""); ++ static_assert(!is_constructible&, ++ std::pair>::value, ""); ++ static_assert(!is_assignable&, ++ std::pair>::value, ""); ++ static_assert(!is_copy_constructible>>::value, ++ ""); ++ static_assert(is_move_constructible>>::value, ++ ""); ++ static_assert(!is_nothrow_move_constructible>>::value, ++ ""); ++ static_assert(!is_copy_assignable>>::value, ++ ""); ++ static_assert(is_move_assignable>>::value, ++ ""); ++ static_assert(!is_nothrow_move_assignable>>::value, ++ ""); ++} Index: libstdc++-v3/testsuite/20_util/tuple/77395.cc =================================================================== --- a/src/libstdc++-v3/testsuite/20_util/tuple/77395.cc (.../tags/gcc_6_2_0_release) @@ -537,7 +1236,7 @@ // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1924 } -+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1928 } ++// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1935 } Index: libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc =================================================================== --- a/src/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc (.../tags/gcc_6_2_0_release) @@ -548,8 +1247,8 @@ -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1820 } -// { dg-error "declaration of" "" { target *-*-* } 1777 } -+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1824 } -+// { dg-error "declaration of" "" { target *-*-* } 1781 } ++// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1831 } ++// { dg-error "declaration of" "" { target *-*-* } 1788 } Index: libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc =================================================================== --- a/src/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc (.../tags/gcc_6_2_0_release) @@ -559,7 +1258,7 @@ // . -// { dg-error "static assertion failed" "" { target *-*-* } 2259 } -+// { dg-error "static assertion failed" "" { target *-*-* } 2263 } ++// { dg-error "static assertion failed" "" { target *-*-* } 2270 } #include @@ -638,6 +1337,40 @@ + derived&& d2(std::move(b)); + static_assert(std::is_constructible::value, ""); +} +Index: libstdc++-v3/config/cpu/m68k/atomicity.h +=================================================================== +--- a/src/libstdc++-v3/config/cpu/m68k/atomicity.h (.../tags/gcc_6_2_0_release) ++++ b/src/libstdc++-v3/config/cpu/m68k/atomicity.h (.../branches/gcc-6-branch) +@@ -48,6 +48,9 @@ + } + + #elif defined(__rtems__) ++ // This code is only provided for reference. RTEMS uses now the atomic ++ // builtins and libatomic. See configure.host. ++ // + // TAS/JBNE is unsafe on systems with strict priority-based scheduling. + // Disable interrupts, which we can do only from supervisor mode. + _Atomic_word +Index: libstdc++-v3/acinclude.m4 +=================================================================== +--- a/src/libstdc++-v3/acinclude.m4 (.../tags/gcc_6_2_0_release) ++++ b/src/libstdc++-v3/acinclude.m4 (.../branches/gcc-6-branch) +@@ -3489,10 +3489,12 @@ + CXXFLAGS="$old_CXXFLAGS" + AC_LANG_RESTORE + +- # Set atomicity_dir to builtins if all but the long long test above passes. +- if test "$glibcxx_cv_atomic_bool" = yes \ ++ # Set atomicity_dir to builtins if all but the long long test above passes, ++ # or if the builtins were already chosen (e.g. by configure.host). ++ if { test "$glibcxx_cv_atomic_bool" = yes \ + && test "$glibcxx_cv_atomic_short" = yes \ +- && test "$glibcxx_cv_atomic_int" = yes; then ++ && test "$glibcxx_cv_atomic_int" = yes; } \ ++ || test "$atomicity_dir" = "cpu/generic/atomicity_builtins"; then + AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1, + [Define if the compiler supports C++11 atomics.]) + atomicity_dir=cpu/generic/atomicity_builtins Index: ChangeLog =================================================================== --- a/src/ChangeLog (.../tags/gcc_6_2_0_release) @@ -764,7 +1497,16 @@ =================================================================== --- a/src/gcc/c-family/ChangeLog (.../tags/gcc_6_2_0_release) +++ b/src/gcc/c-family/ChangeLog (.../branches/gcc-6-branch) -@@ -1,3 +1,12 @@ +@@ -1,3 +1,21 @@ ++2016-09-27 Richard Biener ++ ++ Backport from mainline ++ 2016-09-06 Richard Biener ++ ++ PR c/77450 ++ * c-common.c (c_common_mark_addressable_vec): Handle ++ COMPOUND_LITERAL_EXPR. ++ +2016-09-13 Tom de Vries + + backport from trunk: @@ -781,7 +1523,18 @@ =================================================================== --- a/src/gcc/c-family/c-common.c (.../tags/gcc_6_2_0_release) +++ b/src/gcc/c-family/c-common.c (.../branches/gcc-6-branch) -@@ -12011,7 +12011,7 @@ +@@ -10679,7 +10679,9 @@ + { + while (handled_component_p (t)) + t = TREE_OPERAND (t, 0); +- if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL) ++ if (!VAR_P (t) ++ && TREE_CODE (t) != PARM_DECL ++ && TREE_CODE (t) != COMPOUND_LITERAL_EXPR) + return; + TREE_ADDRESSABLE (t) = 1; + } +@@ -12011,7 +12013,7 @@ { if (x == error_mark_node) return; @@ -790,18 +1543,124 @@ { if (TYPE_NAME (TREE_TYPE (x)) == 0) TYPE_NAME (TREE_TYPE (x)) = x; +Index: gcc/java/class.c +=================================================================== +--- a/src/gcc/java/class.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/java/class.c (.../branches/gcc-6-branch) +@@ -2365,6 +2365,7 @@ + base_decl = build_decl (input_location, + FIELD_DECL, NULL_TREE, super_class); + DECL_IGNORED_P (base_decl) = 1; ++ DECL_CONTEXT (base_decl) = this_class; + DECL_CHAIN (base_decl) = TYPE_FIELDS (this_class); + TYPE_FIELDS (this_class) = base_decl; + DECL_SIZE (base_decl) = TYPE_SIZE (super_class); +Index: gcc/java/mangle.c +=================================================================== +--- a/src/gcc/java/mangle.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/java/mangle.c (.../branches/gcc-6-branch) +@@ -74,15 +74,23 @@ + void + java_mangle_decl (tree decl) + { +- /* A copy of the check from the beginning of lhd_set_decl_assembler_name. +- Only FUNCTION_DECLs and VAR_DECLs for variables with static storage +- duration need a real DECL_ASSEMBLER_NAME. */ ++ /* A copy of the check from the beginning of lhd_set_decl_assembler_name. */ ++ ++ /* set_decl_assembler_name may be called on TYPE_DECL to record ODR ++ name for C++ types. By default types have no ODR names. */ ++ if (TREE_CODE (decl) == TYPE_DECL) ++ return; ++ ++ /* The language-independent code should never use the ++ DECL_ASSEMBLER_NAME for lots of DECLs. Only FUNCTION_DECLs and ++ VAR_DECLs for variables with static storage duration need a real ++ DECL_ASSEMBLER_NAME. */ + gcc_assert (TREE_CODE (decl) == FUNCTION_DECL + || (TREE_CODE (decl) == VAR_DECL + && (TREE_STATIC (decl) + || DECL_EXTERNAL (decl) + || TREE_PUBLIC (decl)))); +- ++ + /* Mangling only applies to class members. */ + if (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl))) + { +Index: gcc/java/ChangeLog +=================================================================== +--- a/src/gcc/java/ChangeLog (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/java/ChangeLog (.../branches/gcc-6-branch) +@@ -1,3 +1,8 @@ ++2016-09-22 Richard Biener ++ ++ * class.c (push_super_field): Set DECL_CONTEXT. ++ * mangle.c (java_mangle_decl): Re-sync with lhd_set_decl_assembler_name. ++ + 2016-08-22 Release Manager + + * GCC 6.2.0 released. Index: gcc/DATESTAMP =================================================================== --- a/src/gcc/DATESTAMP (.../tags/gcc_6_2_0_release) +++ b/src/gcc/DATESTAMP (.../branches/gcc-6-branch) @@ -1 +1 @@ -20160822 -+20160914 ++20160927 +Index: gcc/configure +=================================================================== +--- a/src/gcc/configure (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/configure (.../branches/gcc-6-branch) +@@ -26743,7 +26743,7 @@ + elif test x$gcc_cv_as != x; then + $as_echo ' .dwsect 0xA0000 + Lframe..0: +- .vbyte 4,Lframe..0: ++ .vbyte 4,Lframe..0 + ' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 +Index: gcc/internal-fn.c +=================================================================== +--- a/src/gcc/internal-fn.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/internal-fn.c (.../branches/gcc-6-branch) +@@ -1789,7 +1789,10 @@ + { + case MINUS_EXPR: + if (integer_zerop (arg0) && !unsr_p) +- expand_neg_overflow (loc, lhs, arg1, false); ++ { ++ expand_neg_overflow (loc, lhs, arg1, false); ++ return; ++ } + /* FALLTHRU */ + case PLUS_EXPR: + expand_addsub_overflow (loc, code, lhs, arg0, arg1, Index: gcc/fold-const.c =================================================================== --- a/src/gcc/fold-const.c (.../tags/gcc_6_2_0_release) +++ b/src/gcc/fold-const.c (.../branches/gcc-6-branch) -@@ -14093,7 +14093,6 @@ +@@ -837,15 +837,16 @@ + var = negate_expr (var); + } + } ++ else if (TREE_CONSTANT (in)) ++ *conp = in; + else if (TREE_CODE (in) == BIT_NOT_EXPR + && code == PLUS_EXPR) + { +- /* -X - 1 is folded to ~X, undo that here. */ ++ /* -X - 1 is folded to ~X, undo that here. Do _not_ do this ++ when IN is constant. */ + *minus_litp = build_one_cst (TREE_TYPE (in)); + var = negate_expr (TREE_OPERAND (in, 0)); + } +- else if (TREE_CONSTANT (in)) +- *conp = in; + else + var = in; + +@@ -14093,7 +14094,6 @@ if (!VECTOR_TYPE_P (type)) { /* Have vector comparison with scalar boolean result. */ @@ -809,7 +1668,7 @@ gcc_assert ((code == EQ_EXPR || code == NE_EXPR) && VECTOR_CST_NELTS (op0) == VECTOR_CST_NELTS (op1)); for (unsigned i = 0; i < VECTOR_CST_NELTS (op0); i++) -@@ -14101,11 +14100,12 @@ +@@ -14101,11 +14101,12 @@ tree elem0 = VECTOR_CST_ELT (op0, i); tree elem1 = VECTOR_CST_ELT (op1, i); tree tmp = fold_relational_const (code, type, elem0, elem1); @@ -826,11 +1685,221 @@ } unsigned count = VECTOR_CST_NELTS (op0); tree *elts = XALLOCAVEC (tree, count); +Index: gcc/omp-low.c +=================================================================== +--- a/src/gcc/omp-low.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/omp-low.c (.../branches/gcc-6-branch) +@@ -4300,7 +4300,9 @@ + { + tree c = find_omp_clause (gimple_omp_for_clauses (ctx->stmt), + OMP_CLAUSE_SAFELEN); +- if (c && TREE_CODE (OMP_CLAUSE_SAFELEN_EXPR (c)) != INTEGER_CST) ++ if (c ++ && (TREE_CODE (OMP_CLAUSE_SAFELEN_EXPR (c)) != INTEGER_CST ++ || tree_int_cst_sgn (OMP_CLAUSE_SAFELEN_EXPR (c)) != 1)) + max_vf = 1; + else if (c && compare_tree_int (OMP_CLAUSE_SAFELEN_EXPR (c), + max_vf) == -1) +Index: gcc/tree-chrec.c +=================================================================== +--- a/src/gcc/tree-chrec.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/tree-chrec.c (.../branches/gcc-6-branch) +@@ -484,7 +484,6 @@ + { + bool overflow; + unsigned int i; +- tree res; + + /* Handle the most frequent cases. */ + if (k == 0) +@@ -492,18 +491,20 @@ + if (k == 1) + return fold_convert (type, n); + ++ widest_int num = wi::to_widest (n); ++ + /* Check that k <= n. */ +- if (wi::ltu_p (n, k)) ++ if (wi::ltu_p (num, k)) + return NULL_TREE; + + /* Denominator = 2. */ +- wide_int denom = wi::two (TYPE_PRECISION (TREE_TYPE (n))); ++ widest_int denom = 2; + + /* Index = Numerator-1. */ +- wide_int idx = wi::sub (n, 1); ++ widest_int idx = num - 1; + + /* Numerator = Numerator*Index = n*(n-1). */ +- wide_int num = wi::smul (n, idx, &overflow); ++ num = wi::smul (num, idx, &overflow); + if (overflow) + return NULL_TREE; + +@@ -522,9 +523,10 @@ + } + + /* Result = Numerator / Denominator. */ +- wide_int di_res = wi::udiv_trunc (num, denom); +- res = wide_int_to_tree (type, di_res); +- return int_fits_type_p (res, type) ? res : NULL_TREE; ++ num = wi::udiv_trunc (num, denom); ++ if (! wi::fits_to_tree_p (num, type)) ++ return NULL_TREE; ++ return wide_int_to_tree (type, num); + } + + /* Helper function. Use the Newton's interpolating formula for Index: gcc/ChangeLog =================================================================== --- a/src/gcc/ChangeLog (.../tags/gcc_6_2_0_release) +++ b/src/gcc/ChangeLog (.../branches/gcc-6-branch) -@@ -1,3 +1,235 @@ +@@ -1,3 +1,380 @@ ++2016-09-27 David Edelsohn ++ ++ Backport from mainline ++ 2016-09-27 David Edelsohn ++ ++ * config/rs6000/rs6000.c (rs6000_output_symbol): Don't modify ++ VAR_DECL string. ++ ++ 2016-09-24 David Edelsohn ++ ++ * configure.ac (gcc_cv_as_aix_dwloc): Fix typo in assembly fragment. ++ * configure: Regenerate. ++ ++2016-09-27 Richard Biener ++ ++ Backport from mainline ++ 2016-09-01 Richard Biener ++ ++ PR middle-end/77436 ++ * tree-chrec.c (tree_fold_binomial): Use widest_int, properly ++ check whether the result fits the desired result type. ++ ++ 2016-09-19 Richard Biener ++ ++ PR tree-optimization/77514 ++ * tree-ssa-pre.c (create_expression_by_pieces): Optimize ++ search for folded stmt. ++ ++ 2016-09-15 Richard Biener ++ ++ PR tree-optimization/77514 ++ * tree-ssa-pre.c (create_expression_by_pieces): Handle garbage ++ only forced_stmts sequence. ++ ++ 2016-09-15 Richard Biener ++ ++ PR middle-end/77544 ++ * fold-const.c (split_tree): Do not split constant ~X. ++ ++ 2016-09-19 Richard Biener ++ ++ PR middle-end/77605 ++ * tree-data-ref.c (analyze_subscript_affine_affine): Use the ++ proper niter to bound the loops. ++ ++ 2016-09-22 Richard Biener ++ ++ PR middle-end/77679 ++ * gimple-fold.c (fold_array_ctor_reference): Turn asserts into ++ fold fails. ++ ++2016-09-25 Uros Bizjak ++ ++ Backport from mainline ++ 2016-09-21 Richard Biener ++ Jakub Jelinek ++ ++ PR tree-optimization/77621 ++ * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Split ++ group at non-vectorizable stmts. ++ ++ Backport from mainline ++ 2016-09-20 Uros Bizjak ++ ++ PR target/77621 ++ * config/i386/i386.c (ix86_preferred_simd_mode) : ++ Don't return word_mode for !TARGET_VECTORIZE_DOUBLE. ++ (ix86_add_stmt_cost): Penalize DFmode vector operations ++ for !TARGET_VECTORIZE_DOUBLE. ++ ++2016-09-22 Senthil Kumar Selvaraj ++ ++ Backport from 2016-09-22 trunk r240388. ++ ++ * config/avr/avr.c (avr_rtx_costs_1): Handle DImode MULT. ++ (avr_address_cost): Replace 61 with MAX_LD_OFFSET(mode). ++ ++2016-09-21 Segher Boessenkool ++ ++ * doc/rtl.texi (JUMP_LABEL): Document RETURN and SIMPLE_RETURN values. ++ ++2016-09-21 Georg-Johann Lay ++ ++ Backport from 2016-09-21 trunk r240306. ++ ++ PR target/77326 ++ * config/avr/avr.c (avr_notice_update_cc) [CC_NONE]: If insn ++ touches some regs mentioned in cc_status, do CC_STATUS_INIT. ++ ++2016-09-20 Thomas Preud'homme ++ ++ Backport from mainline ++ 2016-07-14 Thomas Preud'homme ++ ++ * lra-constraints.c (match_reload): Pass information about other ++ output operands. Create new unique register value if matching input ++ operand shares same register value as output operand being considered. ++ (curr_insn_transform): Record output operands already processed. ++ ++2016-09-16 Jonathan Wakely ++ ++ * doc/extend.texi (Integer Overflow Builtins): Fix type of out ++ parameters for functions taking long long arguments. ++ ++2016-09-16 David Edelsohn ++ ++ Backported from mainline ++ 2016-08-26 David Edelsohn ++ ++ PR target/77349 ++ * config/rs6000/xcoff.h (DWARF_OFFSET_SIZE): Define as PTR_SIZE. ++ ++2016-09-16 Jakub Jelinek ++ Eric Botcazou ++ ++ PR middle-end/77594 ++ * internal-fn.c (expand_arith_overflow) : Don't fall ++ through into expand_addsub_overflow after expand_neg_overflow. ++ ++2016-09-16 Jakub Jelinek ++ ++ Backported from mainline ++ 2016-09-14 Jakub Jelinek ++ ++ PR sanitizer/68260 ++ * tsan.c: Include target.h. ++ (enum tsan_atomic_action): Add bool_clear and bool_test_and_set. ++ (BOOL_CLEAR, BOOL_TEST_AND_SET): Define. ++ (tsan_atomic_table): Add BUILT_IN_ATOMIC_CLEAR and ++ BUILT_IN_ATOMIC_TEST_AND_SET entries. ++ (instrument_builtin_call): Handle bool_clear and bool_test_and_set. ++ ++ 2016-09-08 Jakub Jelinek ++ ++ PR fortran/77516 ++ * omp-low.c (lower_rec_simd_input_clauses): Use max_vf for non-positive ++ OMP_CLAUSE_SAFELEN_EXPR. ++ ++ 2016-09-06 Jakub Jelinek ++ ++ PR target/69255 ++ * config/i386/i386.c (ix86_expand_builtin): For builtin with ++ unsupported or unknown ISA, use expand_call. ++ +2016-09-06 Uros Bizjak + + Backport from mainline @@ -1063,10 +2132,11 @@ + PR middle-end/71700 + * expr.c (store_constructor): Mask sign-extended bits when widening + sub-word constructor element at the start of a word. ++ 2016-08-22 Release Manager * GCC 6.2.0 released. -@@ -205,9 +442,9 @@ +@@ -205,9 +586,9 @@ 2016-08-09 Martin Jambor @@ -1111,6 +2181,47 @@ + d8 += 16; + } +} +Index: gcc/testsuite/gcc.target/avr/torture/pr77326.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/avr/torture/pr77326.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.target/avr/torture/pr77326.c (.../branches/gcc-6-branch) +@@ -0,0 +1,26 @@ ++/* { dg-do run } */ ++/* { dg-options "-Wl,--defsym,test1=0" } */ ++ ++extern void test1 (void) __attribute__((weak)); ++ ++__attribute__((noinline,noclone)) ++static void va_pseudo (int flag, ...) ++{ ++ __asm ("nop":); ++} ++ ++__attribute__((noinline,noclone)) ++static void func (void) ++{ ++ va_pseudo (0, 0, 0, 0); ++ ++ if (test1) ++ __builtin_abort (); ++} ++ ++int main (void) ++{ ++ func(); ++ __builtin_exit (0); ++ return 0; ++} +Index: gcc/testsuite/gcc.target/i386/vect-double-2.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/i386/vect-double-2.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.target/i386/vect-double-2.c (.../branches/gcc-6-branch) +@@ -31,4 +31,4 @@ + } + } + +-/* { dg-final { scan-tree-dump-not "vectorized 1 loops" "vect" } } */ ++/* { dg-final { scan-tree-dump-times "Vectorized loops: 1" 1 "vect" } } */ Index: gcc/testsuite/gcc.target/i386/pr71077.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr71077.c (.../tags/gcc_6_2_0_release) @@ -1186,6 +2297,28 @@ + if (!__builtin_isnan (x[0])) + abort (); +} +Index: gcc/testsuite/gcc.target/i386/pr69255-1.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/i386/pr69255-1.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr69255-1.c (.../branches/gcc-6-branch) +@@ -0,0 +1,17 @@ ++/* PR target/69255 */ ++/* { dg-do compile } */ ++/* { dg-options "-msse4 -mno-avx" } */ ++ ++#pragma GCC target "avx512vl" ++#pragma GCC target "no-avx512vl" ++__attribute__ ((__vector_size__ (32))) long long a; ++__attribute__ ((__vector_size__ (16))) int b; ++ ++void ++foo (const long long *p) ++{ ++ a = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ ++} ++ ++/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ ++/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ Index: gcc/testsuite/gcc.target/i386/pr77452.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr77452.c (.../tags/gcc_6_2_0_release) @@ -1204,6 +2337,50 @@ + >> ((-~((V)(U){1, 1, v[0]})[0]) & 0xf); + return v; +} +Index: gcc/testsuite/gcc.target/i386/pr69255-2.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/i386/pr69255-2.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr69255-2.c (.../branches/gcc-6-branch) +@@ -0,0 +1,17 @@ ++/* PR target/69255 */ ++/* { dg-do compile } */ ++/* { dg-options "-msse4 -mno-avx" } */ ++ ++#pragma GCC target "avx512vl" ++#pragma GCC target "" ++__attribute__ ((__vector_size__ (32))) long long a; ++__attribute__ ((__vector_size__ (16))) int b; ++ ++void ++foo (const long long *p) ++{ ++ __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ ++} ++ ++/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ ++/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ +Index: gcc/testsuite/gcc.target/i386/pr69255-3.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/i386/pr69255-3.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr69255-3.c (.../branches/gcc-6-branch) +@@ -0,0 +1,17 @@ ++/* PR target/69255 */ ++/* { dg-do compile } */ ++/* { dg-options "-msse4 -mno-avx" } */ ++ ++#pragma GCC target "avx512vl" ++#pragma GCC target "" ++__attribute__ ((__vector_size__ (32))) long long a; ++__attribute__ ((__vector_size__ (16))) int b; ++ ++void ++foo (const long long *p, __attribute__ ((__vector_size__ (32))) long long *q) ++{ ++ *q = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ ++} ++ ++/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ ++/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ Index: gcc/testsuite/gcc.target/i386/pr77403.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr77403.c (.../tags/gcc_6_2_0_release) @@ -1224,6 +2401,39 @@ +{ + v ^= (V){1}; +} +Index: gcc/testsuite/gcc.target/i386/pr77621.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/i386/pr77621.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr77621.c (.../branches/gcc-6-branch) +@@ -0,0 +1,12 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O3 -mtune=atom -msse2 -mno-avx -fdump-tree-vect-stats" } */ ++ ++void ++foo (double *x, int *y) ++{ ++ int i; ++ for (i = 0; i < 8; i++) ++ x[i] -= y[i] * x[i + 1]; ++} ++ ++/* { dg-final { scan-tree-dump-not "Vectorized loops: 1" "vect" } } */ +Index: gcc/testsuite/gcc.target/i386/pr77594.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/i386/pr77594.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr77594.c (.../branches/gcc-6-branch) +@@ -0,0 +1,11 @@ ++/* PR middle-end/77594 */ ++/* { dg-do compile } */ ++/* { dg-options "-O0" } */ ++ ++int ++foo (int a, int *b) ++{ ++ return __builtin_sub_overflow (0, a, b); ++} ++ ++/* { dg-final { scan-assembler-times "\tjn?o\t" 1 } } */ Index: gcc/testsuite/gcc.target/i386/pr77377.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr77377.c (.../tags/gcc_6_2_0_release) @@ -1279,6 +2489,23 @@ + x(:) = x(n:1:-1) +!$omp end parallel +end +Index: gcc/testsuite/gfortran.dg/gomp/pr77516.f90 +=================================================================== +--- a/src/gcc/testsuite/gfortran.dg/gomp/pr77516.f90 (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gfortran.dg/gomp/pr77516.f90 (.../branches/gcc-6-branch) +@@ -0,0 +1,12 @@ ++! PR fortran/77516 ++! { dg-do compile } ++ ++program pr77516 ++ integer :: i, x ++ x = 0 ++!$omp simd safelen(0) reduction(+:x) ++ do i = 1, 8 ++ x = x + 1 ++ end do ++ print *, x ++end Index: gcc/testsuite/gfortran.dg/gomp/pr77374.f08 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/gomp/pr77374.f08 (.../tags/gcc_6_2_0_release) @@ -1305,6 +2532,20 @@ +!$omp atomic + baz (i) = 1 ! { dg-error "unexpected" } +end subroutine +Index: gcc/testsuite/gfortran.dg/gomp/pr77500.f90 +=================================================================== +--- a/src/gcc/testsuite/gfortran.dg/gomp/pr77500.f90 (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gfortran.dg/gomp/pr77500.f90 (.../branches/gcc-6-branch) +@@ -0,0 +1,9 @@ ++! PR fortran/77500 ++! { dg-do compile } ++ ++program pr77500 ++ real :: x ++!$omp atomic write ++ x = f() ++!$omp end atomic ++end Index: gcc/testsuite/gfortran.dg/gomp/pr69281.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/gomp/pr69281.f90 (.../tags/gcc_6_2_0_release) @@ -1460,6 +2701,66 @@ + __builtin_abort (); + return 0; +} +Index: gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x +=================================================================== +--- a/src/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x (.../branches/gcc-6-branch) +@@ -19,7 +19,6 @@ + regsub dump1/ $dump1 dump2/ dump2 + set dumptail "gcc.c-torture/unsorted/[file tail $dump1]" + regsub {\.\d+((t|r|i)\.[^.]+)$} $dumptail {.*\1} dumptail +- #puts "$option $dump1" + set tmp [ diff "$dump1" "$dump2" ] + if { $tmp == 0 } { + untested "$dumptail, $option comparison" +@@ -28,7 +27,6 @@ + } else { + fail "$dumptail, $option comparison" + } +- #exec diff $dump1 $dump2 + } + } + file delete -force dump1 +@@ -35,7 +33,5 @@ + file delete -force dump2 + } + +-catch {dump_compare $src $options} result +-puts $result +-verbose result ++dump_compare $src $options + return 1 +Index: gcc/testsuite/gcc.dg/pr77450.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/pr77450.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.dg/pr77450.c (.../branches/gcc-6-branch) +@@ -0,0 +1,10 @@ ++/* { dg-do compile } */ ++/* { dg-options "-std=gnu90" } */ ++ ++typedef int V __attribute__((vector_size(4))); ++ ++void ++foo(void) ++{ ++ (V){ 0 }[0] = 0; ++} +Index: gcc/testsuite/gcc.dg/pr77621.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/pr77621.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.dg/pr77621.c (.../branches/gcc-6-branch) +@@ -0,0 +1,11 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O3" } */ ++/* { dg-additional-options "-mtune=atom -msse2" { target i?86-*-* x86_64-*-* } } */ ++ ++void ++foo (double *x, int *y) ++{ ++ int i; ++ for (i = 0; i < 8; i++) ++ x[i] -= y[i] * x[i + 1]; ++} Index: gcc/testsuite/gcc.dg/pr76783.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/pr76783.c (.../tags/gcc_6_2_0_release) @@ -1586,6 +2887,33 @@ + __builtin_ms_va_end (ap); + return sum; +} +Index: gcc/testsuite/gcc.dg/torture/pr77478.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/torture/pr77478.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.dg/torture/pr77478.c (.../branches/gcc-6-branch) +@@ -0,0 +1,22 @@ ++/* { dg-do run } */ ++/* { dg-additional-options "-ffast-math" } */ ++ ++static const float A[10] = {1}; ++ ++float ++foo(float *f, int n) ++{ ++ int i, j; ++ float a = 0, b = 0; ++ for (i = n/2; i < n; i++) ++ a += f[i]*.1f; ++ for (i = n/2, j = 0; i < n; i++, j++) ++ b += f[i]*A[j]+a*A[j]; ++ return b; ++} ++ ++int main() ++{ ++ float a[21] = {0}; ++ return foo(a+1, 20) + foo(a, 20); ++} Index: gcc/testsuite/gcc.dg/torture/pr72851.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/torture/pr72851.c (.../tags/gcc_6_2_0_release) @@ -1621,6 +2949,68 @@ + for (i = 0; i < 16; i++) + K[i] = shuffle(CDn, PC2_shuffle, sizeof(PC2_shuffle)); +} +Index: gcc/testsuite/gcc.dg/torture/pr77514.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/torture/pr77514.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.dg/torture/pr77514.c (.../branches/gcc-6-branch) +@@ -0,0 +1,21 @@ ++/* { dg-do compile } */ ++ ++void ++m1 (char l0, char e8, int hw) ++{ ++ char *rs = &l0; ++ ++yu: ++ l0 = 1; ++ while (l0 != 0) ++ { ++ l0 = -l0; ++ l0 += (*rs ^ (l0 &= 1)); ++ } ++ for (;;) ++ { ++ if (hw != 0) ++ goto yu; ++ rs = &e8; ++ } ++} +Index: gcc/testsuite/gcc.dg/torture/pr77605.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/torture/pr77605.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.dg/torture/pr77605.c (.../branches/gcc-6-branch) +@@ -0,0 +1,15 @@ ++/* { dg-do run } */ ++ ++int a, b, c[2][8]; ++ ++int main () ++{ ++ for (a = 0; a < 8; a++) ++ for (b = 0; b < 2; b++) ++ c[b][a] = c[b][b + 6] ^ 1; ++ ++ if (c[0][7] != 0) ++ __builtin_abort (); ++ ++ return 0; ++} +Index: gcc/testsuite/gcc.dg/torture/pr77436.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/torture/pr77436.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/gcc.dg/torture/pr77436.c (.../branches/gcc-6-branch) +@@ -0,0 +1,11 @@ ++/* { dg-do run } */ ++ ++int main() ++{ ++ unsigned short sum = 0; ++ for (short x = -(__SHRT_MAX__ -1); x <= (__SHRT_MAX__ -1); x++) ++ sum += x; ++ if (sum != 0) ++ __builtin_abort (); ++ return 0; ++} Index: gcc/testsuite/gcc.dg/tree-ssa/update-unroll-1.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/tree-ssa/update-unroll-1.c (.../tags/gcc_6_2_0_release) @@ -1838,7 +3228,133 @@ =================================================================== --- a/src/gcc/testsuite/ChangeLog (.../tags/gcc_6_2_0_release) +++ b/src/gcc/testsuite/ChangeLog (.../branches/gcc-6-branch) -@@ -1,3 +1,173 @@ +@@ -1,3 +1,299 @@ ++2016-09-27 Richard Biener ++ ++ PR tree-optimization/77478 ++ * gcc.dg/torture/pr77478.c: New testcase. ++ ++2016-09-27 Richard Biener ++ ++ Backport from mainline ++ 2016-09-01 Richard Biener ++ ++ PR middle-end/77436 ++ * gcc.dg/torture/pr77436.c: New testcase. ++ ++ 2016-09-06 Richard Biener ++ ++ PR c/77450 ++ * gcc.dg/pr77450.c: New testcase. ++ ++ 2016-09-15 Richard Biener ++ ++ PR tree-optimization/77514 ++ * gcc.dg/torture/pr77514.c: New testcase. ++ ++ 2016-09-15 Richard Biener ++ ++ PR middle-end/77544 ++ * c-c++-common/torture/pr77544.c: New testcase. ++ ++ 2016-09-19 Richard Biener ++ ++ PR middle-end/77605 ++ * gcc.dg/torture/pr77605.c: New testcase. ++ ++2016-09-25 Uros Bizjak ++ ++ Backport from mainline ++ 2016-09-21 Richard Biener ++ Jakub Jelinek ++ ++ PR tree-optimization/77621 ++ * gcc.dg/pr77621.c: New testcase. ++ ++ Backport from mainline ++ 2016-09-20 Uros Bizjak ++ ++ PR target/77621 ++ * gcc.target/i386/pr77621.c: New test. ++ * gcc.target/i386/vect-double-2.c: Update scan-tree-dump-times ++ pattern, loop should vectorize with -mtune=atom. ++ ++2016-09-25 Bernd Edlinger ++ ++ backport from mainline ++ 2016-09-23 Bernd Edlinger ++ Tom de Vries ++ ++ PR testsuite/77411 ++ * c-c++-common/ubsan/object-size-9.c: Call __builtin_exit in C++. ++ ++2016-09-22 Paolo Carlini ++ ++ PR c++/71979 ++ * g++.dg/cpp0x/pr71979.C: New. ++ ++2016-09-21 Uros Bizjak ++ ++ * gcc.c-torture/unsorted/dump-noaddr.x: Remove debug statements. ++ ++2016-09-21 Georg-Johann Lay ++ ++ Backport from 2016-09-21 trunk r240306. ++ ++ PR target/77326 ++ * gcc.target/avr/torture/pr77326.c: New test. ++ ++2016-09-16 Jakub Jelinek ++ Eric Botcazou ++ ++ PR middle-end/77594 ++ * gcc.target/i386/pr77594.c: New test. ++ ++2016-09-16 Jakub Jelinek ++ ++ Backported from mainline ++ 2016-09-14 Jakub Jelinek ++ ++ PR sanitizer/68260 ++ * c-c++-common/tsan/pr68260.c: New test. ++ ++ 2016-09-13 Jakub Jelinek ++ ++ PR c++/77553 ++ * g++.dg/cpp1y/constexpr-77553.C: New test. ++ ++ 2016-09-08 Jakub Jelinek ++ ++ PR fortran/77500 ++ * gfortran.dg/gomp/pr77500.f90: New test. ++ ++ PR fortran/77516 ++ * gfortran.dg/gomp/pr77516.f90: New test. ++ ++ 2016-09-06 Jakub Jelinek ++ ++ PR target/69255 ++ * gcc.target/i386/pr69255-1.c: New test. ++ * gcc.target/i386/pr69255-2.c: New test. ++ * gcc.target/i386/pr69255-3.c: New test. ++ ++ 2016-09-05 Jakub Jelinek ++ ++ PR sanitizer/77396 ++ * g++.dg/asan/pr77396-2.C: New test. ++ ++ 2016-09-02 Jakub Jelinek ++ ++ PR sanitizer/77396 ++ * g++.dg/asan/pr77396.C: New test. ++ ++2016-09-14 Nathan Sidwell ++ ++ PR c++/77539 ++ * g++.dg/cpp0x/constexpr-recursion3.C: New. ++ * g++.dg/ubsan/pr63956.C: Adjust error location. ++ * g++.dg/cpp1y/pr77539.C: New. ++ +2016-09-13 Tom de Vries + + backport from trunk: @@ -2012,7 +3528,7 @@ 2016-08-22 Release Manager * GCC 6.2.0 released. -@@ -150,8 +320,8 @@ +@@ -150,8 +446,8 @@ 2016-08-09 Martin Jambor @@ -2023,7 +3539,7 @@ 2016-08-09 Richard Biener -@@ -276,8 +446,8 @@ +@@ -276,8 +572,8 @@ 2016-07-20 Martin Jambor @@ -2034,7 +3550,7 @@ 2016-07-19 Jakub Jelinek -@@ -418,7 +588,7 @@ +@@ -418,7 +714,7 @@ 2016-07-06 Yuri Rumyantsev PR tree-optimization/71518 @@ -2107,6 +3623,67 @@ + } c; +} type5; +type5 var; +Index: gcc/testsuite/g++.dg/ubsan/pr63956.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/ubsan/pr63956.C (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/g++.dg/ubsan/pr63956.C (.../branches/gcc-6-branch) +@@ -92,7 +92,7 @@ + fn6 (const int &a, int b) + { + if (b != 2) +- b = a; ++ b = a; // { dg-error "is not a constant expression" } + return b; + } + +@@ -106,7 +106,7 @@ + + constexpr int n1 = 7; + constexpr int n2 = fn7 (&n1, 5); +-constexpr int n3 = fn7 ((const int *) 0, 8); // { dg-error "is not a constant expression" } ++constexpr int n3 = fn7 ((const int *) 0, 8); + + constexpr int + fn8 (int i) +Index: gcc/testsuite/g++.dg/cpp0x/constexpr-recursion3.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion3.C (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion3.C (.../branches/gcc-6-branch) +@@ -0,0 +1,14 @@ ++// { dg-do compile { target c++11 } } ++ ++constexpr int Foo (int i) ++{ ++ return (i ? Foo (i - 1): 0) + i; ++} ++ ++static int a = Foo (0); ++static int b = Foo (1); ++static int d = Foo (3); ++static int c = Foo (2); ++static int e = Foo (4); ++static int g = Foo (6); ++static int f = Foo (5); +Index: gcc/testsuite/g++.dg/cpp0x/pr71979.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/cpp0x/pr71979.C (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/g++.dg/cpp0x/pr71979.C (.../branches/gcc-6-branch) +@@ -0,0 +1,15 @@ ++// PR c++/71979 ++// { dg-do compile { target c++11 } } ++ ++struct A ++{ ++ A & operator= (A &); ++}; ++ ++struct B : A {}; // { dg-error "invalid initialization" } ++ ++void foo () ++{ ++ B b; ++ b = B (); // { dg-error "use of deleted" } ++} Index: gcc/testsuite/g++.dg/ipa/devirt-52.C =================================================================== --- a/src/gcc/testsuite/g++.dg/ipa/devirt-52.C (.../tags/gcc_6_2_0_release) @@ -2168,6 +3745,59 @@ + G (int); +}; +void test () { G (0); } +Index: gcc/testsuite/g++.dg/cpp1y/pr77539.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/cpp1y/pr77539.C (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/g++.dg/cpp1y/pr77539.C (.../branches/gcc-6-branch) +@@ -0,0 +1,14 @@ ++// PR c++/77539 ++// { dg-do compile { target c++14 } } ++ ++constexpr int foobar() ++{ ++ int array[100] = {}; ++ int *ar = array; ++ if (ar == nullptr) // Error... ++ { ++ return 0; ++ } ++ return 1; ++} ++static_assert(foobar(),""); +Index: gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C (.../branches/gcc-6-branch) +@@ -0,0 +1,29 @@ ++// PR c++/77553 ++// { dg-do compile { target c++14 } } ++ ++constexpr void ++bar (int *x) ++{ ++ int i = 0; ++ x[i++] = 1; ++ x[3] = i; ++} ++ ++constexpr int ++foo () ++{ ++ int a[] = { 0, 0, 0, 0 }; ++ bar (a); ++ ++ return a[0] + 8 * a[1] + 64 * a[2] + 512 * a[3]; ++} ++ ++constexpr int b = foo (); ++ ++int ++main () ++{ ++ static_assert (b == 513, ""); ++ if (foo () != 513) ++ __builtin_abort (); ++} Index: gcc/testsuite/g++.dg/gomp/pr71910.C =================================================================== --- a/src/gcc/testsuite/g++.dg/gomp/pr71910.C (.../tags/gcc_6_2_0_release) @@ -2186,6 +3816,40 @@ +#pragma omp parallel + __builtin_exit (0); +} +Index: gcc/testsuite/g++.dg/asan/pr77396-2.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/asan/pr77396-2.C (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/g++.dg/asan/pr77396-2.C (.../branches/gcc-6-branch) +@@ -0,0 +1,12 @@ ++// PR sanitizer/77396 ++// { dg-do run } ++// { dg-set-target-env-var ASAN_OPTIONS "check_initialization_order=true" } ++ ++struct S { S () { asm volatile ("" : : : "memory"); } }; ++static S c; ++ ++int ++main () ++{ ++ return 0; ++} +Index: gcc/testsuite/g++.dg/asan/pr77396.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/asan/pr77396.C (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/g++.dg/asan/pr77396.C (.../branches/gcc-6-branch) +@@ -0,0 +1,12 @@ ++// PR sanitizer/77396 ++// { dg-do run } ++// { dg-set-target-env-var ASAN_OPTIONS "check_initialization_order=true" } ++ ++static int a = 0; ++static int b = a; ++ ++int ++main () ++{ ++ return 0; ++} Index: gcc/testsuite/g++.dg/pr77427.C =================================================================== --- a/src/gcc/testsuite/g++.dg/pr77427.C (.../tags/gcc_6_2_0_release) @@ -2208,6 +3872,332 @@ + + bar (c1); +} +Index: gcc/testsuite/c-c++-common/tsan/pr68260.c +=================================================================== +--- a/src/gcc/testsuite/c-c++-common/tsan/pr68260.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/c-c++-common/tsan/pr68260.c (.../branches/gcc-6-branch) +@@ -0,0 +1,28 @@ ++/* PR sanitizer/68260 */ ++ ++#include ++#include ++ ++bool lock; ++int counter; ++ ++void * ++tf (void *arg) ++{ ++ (void) arg; ++ while (__atomic_test_and_set (&lock, __ATOMIC_ACQUIRE)) ++ ; ++ ++counter; ++ __atomic_clear (&lock, __ATOMIC_RELEASE); ++ return (void *) 0; ++} ++ ++int ++main () ++{ ++ pthread_t thr; ++ pthread_create (&thr, 0, tf, 0); ++ tf ((void *) 0); ++ pthread_join (thr, 0); ++ return 0; ++} +Index: gcc/testsuite/c-c++-common/ubsan/object-size-9.c +=================================================================== +--- a/src/gcc/testsuite/c-c++-common/ubsan/object-size-9.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/c-c++-common/ubsan/object-size-9.c (.../branches/gcc-6-branch) +@@ -93,5 +93,9 @@ + #endif + f4 (12); + f5 (12); ++#ifdef __cplusplus ++ /* Stack may be smashed by f2/f3 above. */ ++ __builtin_exit (0); ++#endif + return 0; + } +Index: gcc/testsuite/c-c++-common/torture/pr77544.c +=================================================================== +--- a/src/gcc/testsuite/c-c++-common/torture/pr77544.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/testsuite/c-c++-common/torture/pr77544.c (.../branches/gcc-6-branch) +@@ -0,0 +1,7 @@ ++/* { dg-do compile } */ ++ ++struct { ++ long a : 17; ++} b; ++int c, d; ++void e() { b.a = d + c + ~(long)(302806U >> 0); } +Index: gcc/cp/class.c +=================================================================== +--- a/src/gcc/cp/class.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/cp/class.c (.../branches/gcc-6-branch) +@@ -296,12 +296,13 @@ + /* This can happen when adjust_result_of_qualified_name_lookup can't + find a unique base binfo in a call to a member function. We + couldn't give the diagnostic then since we might have been calling +- a static member function, so we do it now. */ ++ a static member function, so we do it now. In other cases, eg. ++ during error recovery (c++/71979), we may not have a base at all. */ + if (complain & tf_error) + { + tree base = lookup_base (probe, BINFO_TYPE (d_binfo), + ba_unique, NULL, complain); +- gcc_assert (base == error_mark_node); ++ gcc_assert (base == error_mark_node || !base); + } + return error_mark_node; + } +Index: gcc/cp/constexpr.c +=================================================================== +--- a/src/gcc/cp/constexpr.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/cp/constexpr.c (.../branches/gcc-6-branch) +@@ -994,7 +994,8 @@ + } + + /* Reuse a copy or create a new unshared copy of the function FUN. +- Return this copy. */ ++ Return this copy. We use a TREE_LIST whose PURPOSE is body, VALUE ++ is parms, TYPE is result. */ + + static tree + get_fundef_copy (tree fun) +@@ -1002,15 +1003,26 @@ + maybe_initialize_fundef_copies_table (); + + tree copy; +- tree *slot = fundef_copies_table->get (fun); +- if (slot == NULL || *slot == NULL_TREE) ++ bool existed; ++ tree *slot = &fundef_copies_table->get_or_insert (fun, &existed); ++ ++ if (!existed) + { ++ /* There is no cached function available, or in use. We can use ++ the function directly. That the slot is now created records ++ that this function is now in use. */ ++ copy = build_tree_list (DECL_SAVED_TREE (fun), DECL_ARGUMENTS (fun)); ++ TREE_TYPE (copy) = DECL_RESULT (fun); ++ } ++ else if (*slot == NULL_TREE) ++ { ++ /* We've already used the function itself, so make a copy. */ + copy = build_tree_list (NULL, NULL); +- /* PURPOSE is body, VALUE is parms, TYPE is result. */ + TREE_PURPOSE (copy) = copy_fn (fun, TREE_VALUE (copy), TREE_TYPE (copy)); + } + else + { ++ /* We have a cached function available. */ + copy = *slot; + *slot = TREE_CHAIN (copy); + } +@@ -1018,12 +1030,14 @@ + return copy; + } + +-/* Save the copy COPY of function FUN for later reuse by get_fundef_copy(). */ ++/* Save the copy COPY of function FUN for later reuse by ++ get_fundef_copy(). By construction, there will always be an entry ++ to find. */ + + static void + save_fundef_copy (tree fun, tree copy) + { +- tree *slot = &fundef_copies_table->get_or_insert (fun, NULL); ++ tree *slot = fundef_copies_table->get (fun); + TREE_CHAIN (copy) = *slot; + *slot = copy; + } +@@ -1731,6 +1745,63 @@ + return r; + } + ++/* Helper function for cxx_eval_binary_expression. Try to optimize ++ original POINTER_PLUS_EXPR T, LHS p+ RHS, return NULL_TREE if the ++ generic folding should be used. */ ++ ++static tree ++cxx_fold_pointer_plus_expression (const constexpr_ctx *ctx, tree t, ++ tree lhs, tree rhs, bool *non_constant_p, ++ bool *overflow_p) ++{ ++ STRIP_NOPS (lhs); ++ if (TREE_CODE (lhs) != ADDR_EXPR) ++ return NULL_TREE; ++ ++ lhs = TREE_OPERAND (lhs, 0); ++ ++ /* &A[i] p+ j => &A[i + j] */ ++ if (TREE_CODE (lhs) == ARRAY_REF ++ && TREE_CODE (TREE_OPERAND (lhs, 1)) == INTEGER_CST ++ && TREE_CODE (rhs) == INTEGER_CST ++ && TYPE_SIZE_UNIT (TREE_TYPE (lhs)) ++ && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (lhs))) == INTEGER_CST) ++ { ++ tree orig_type = TREE_TYPE (t); ++ location_t loc = EXPR_LOCATION (t); ++ tree type = TREE_TYPE (lhs); ++ ++ t = fold_convert_loc (loc, ssizetype, TREE_OPERAND (lhs, 1)); ++ tree nelts = array_type_nelts_top (TREE_TYPE (TREE_OPERAND (lhs, 0))); ++ nelts = cxx_eval_constant_expression (ctx, nelts, false, non_constant_p, ++ overflow_p); ++ if (*non_constant_p) ++ return NULL_TREE; ++ /* Don't fold an out-of-bound access. */ ++ if (!tree_int_cst_le (t, nelts)) ++ return NULL_TREE; ++ rhs = cp_fold_convert (ssizetype, rhs); ++ /* Don't fold if rhs can't be divided exactly by TYPE_SIZE_UNIT. ++ constexpr int A[1]; ... (char *)&A[0] + 1 */ ++ if (!integer_zerop (fold_build2_loc (loc, TRUNC_MOD_EXPR, sizetype, ++ rhs, TYPE_SIZE_UNIT (type)))) ++ return NULL_TREE; ++ /* Make sure to treat the second operand of POINTER_PLUS_EXPR ++ as signed. */ ++ rhs = fold_build2_loc (loc, EXACT_DIV_EXPR, ssizetype, rhs, ++ TYPE_SIZE_UNIT (type)); ++ t = size_binop_loc (loc, PLUS_EXPR, rhs, t); ++ t = build4_loc (loc, ARRAY_REF, type, TREE_OPERAND (lhs, 0), ++ t, NULL_TREE, NULL_TREE); ++ t = cp_build_addr_expr (t, tf_warning_or_error); ++ t = cp_fold_convert (orig_type, t); ++ return cxx_eval_constant_expression (ctx, t, /*lval*/false, ++ non_constant_p, overflow_p); ++ } ++ ++ return NULL_TREE; ++} ++ + /* Subroutine of cxx_eval_constant_expression. + Like cxx_eval_unary_expression, except for binary expressions. */ + +@@ -1776,6 +1847,9 @@ + else if (TREE_CODE (rhs) == PTRMEM_CST) + rhs = cplus_expand_constant (rhs); + } ++ else if (code == POINTER_PLUS_EXPR) ++ r = cxx_fold_pointer_plus_expression (ctx, t, lhs, rhs, non_constant_p, ++ overflow_p); + + if (r == NULL_TREE) + r = fold_binary_loc (loc, code, type, lhs, rhs); +@@ -3434,65 +3508,6 @@ + return NULL_TREE; + } + +-/* Subroutine of cxx_eval_constant_expression. +- Attempt to reduce a POINTER_PLUS_EXPR expression T. */ +- +-static tree +-cxx_eval_pointer_plus_expression (const constexpr_ctx *ctx, tree t, +- bool lval, bool *non_constant_p, +- bool *overflow_p) +-{ +- tree orig_type = TREE_TYPE (t); +- tree op00 = TREE_OPERAND (t, 0); +- tree op01 = TREE_OPERAND (t, 1); +- location_t loc = EXPR_LOCATION (t); +- +- op00 = cxx_eval_constant_expression (ctx, op00, lval, +- non_constant_p, overflow_p); +- +- STRIP_NOPS (op00); +- if (TREE_CODE (op00) != ADDR_EXPR) +- return NULL_TREE; +- +- op01 = cxx_eval_constant_expression (ctx, op01, lval, +- non_constant_p, overflow_p); +- op00 = TREE_OPERAND (op00, 0); +- +- /* &A[i] p+ j => &A[i + j] */ +- if (TREE_CODE (op00) == ARRAY_REF +- && TREE_CODE (TREE_OPERAND (op00, 1)) == INTEGER_CST +- && TREE_CODE (op01) == INTEGER_CST +- && TYPE_SIZE_UNIT (TREE_TYPE (op00)) +- && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (op00))) == INTEGER_CST) +- { +- tree type = TREE_TYPE (op00); +- t = fold_convert_loc (loc, ssizetype, TREE_OPERAND (op00, 1)); +- tree nelts = array_type_nelts_top (TREE_TYPE (TREE_OPERAND (op00, 0))); +- /* Don't fold an out-of-bound access. */ +- if (!tree_int_cst_le (t, nelts)) +- return NULL_TREE; +- op01 = cp_fold_convert (ssizetype, op01); +- /* Don't fold if op01 can't be divided exactly by TYPE_SIZE_UNIT. +- constexpr int A[1]; ... (char *)&A[0] + 1 */ +- if (!integer_zerop (fold_build2_loc (loc, TRUNC_MOD_EXPR, sizetype, +- op01, TYPE_SIZE_UNIT (type)))) +- return NULL_TREE; +- /* Make sure to treat the second operand of POINTER_PLUS_EXPR +- as signed. */ +- op01 = fold_build2_loc (loc, EXACT_DIV_EXPR, ssizetype, op01, +- TYPE_SIZE_UNIT (type)); +- t = size_binop_loc (loc, PLUS_EXPR, op01, t); +- t = build4_loc (loc, ARRAY_REF, type, TREE_OPERAND (op00, 0), +- t, NULL_TREE, NULL_TREE); +- t = cp_build_addr_expr (t, tf_warning_or_error); +- t = cp_fold_convert (orig_type, t); +- return cxx_eval_constant_expression (ctx, t, lval, non_constant_p, +- overflow_p); +- } +- +- return NULL_TREE; +-} +- + /* Attempt to reduce the expression T to a constant value. + On failure, issue diagnostic and return error_mark_node. */ + /* FIXME unify with c_fully_fold */ +@@ -3810,12 +3825,6 @@ + break; + + case POINTER_PLUS_EXPR: +- r = cxx_eval_pointer_plus_expression (ctx, t, lval, non_constant_p, +- overflow_p); +- if (r) +- break; +- /* else fall through */ +- + case PLUS_EXPR: + case MINUS_EXPR: + case MULT_EXPR: +Index: gcc/cp/ChangeLog +=================================================================== +--- a/src/gcc/cp/ChangeLog (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/cp/ChangeLog (.../branches/gcc-6-branch) +@@ -1,3 +1,28 @@ ++2016-09-22 Paolo Carlini ++ ++ PR c++/71979 ++ * class.c (build_base_path): Allow for lookup_base returning ++ NULL_TREE. ++ ++2016-09-16 Jakub Jelinek ++ ++ Backported from mainline ++ 2016-09-13 Jakub Jelinek ++ ++ PR c++/77553 ++ * constexpr.c (cxx_fold_pointer_plus_expression): New function. ++ (cxx_eval_binary_expression): Use it for POINTER_PLUS_EXPR. ++ (cxx_eval_pointer_plus_expression): Remove. ++ (cxx_eval_constant_expression) : Don't ++ call cxx_eval_pointer_plus_expression. ++ ++2016-09-14 Nathan Sidwell ++ ++ PR c++/77539 ++ * constexpr.c (get_fundef_copy): Use the original function for ++ non-recursive evaluations. ++ (save_fundef_copy): Always expect a slot to be available. ++ + 2016-08-22 Release Manager + + * GCC 6.2.0 released. Index: gcc/tree-ssa-propagate.c =================================================================== --- a/src/gcc/tree-ssa-propagate.c (.../tags/gcc_6_2_0_release) @@ -2731,6 +4721,110 @@ } if (BYTES_BIG_ENDIAN) +Index: gcc/tsan.c +=================================================================== +--- a/src/gcc/tsan.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/tsan.c (.../branches/gcc-6-branch) +@@ -40,6 +40,7 @@ + #include "tsan.h" + #include "asan.h" + #include "builtins.h" ++#include "target.h" + + /* Number of instrumented memory accesses in the current function. */ + +@@ -240,7 +241,8 @@ + enum tsan_atomic_action + { + check_last, add_seq_cst, add_acquire, weak_cas, strong_cas, +- bool_cas, val_cas, lock_release, fetch_op, fetch_op_seq_cst ++ bool_cas, val_cas, lock_release, fetch_op, fetch_op_seq_cst, ++ bool_clear, bool_test_and_set + }; + + /* Table how to map sync/atomic builtins to their corresponding +@@ -274,6 +276,10 @@ + TRANSFORM (fcode, tsan_fcode, fetch_op, code) + #define FETCH_OPS(fcode, tsan_fcode, code) \ + TRANSFORM (fcode, tsan_fcode, fetch_op_seq_cst, code) ++#define BOOL_CLEAR(fcode, tsan_fcode) \ ++ TRANSFORM (fcode, tsan_fcode, bool_clear, ERROR_MARK) ++#define BOOL_TEST_AND_SET(fcode, tsan_fcode) \ ++ TRANSFORM (fcode, tsan_fcode, bool_test_and_set, ERROR_MARK) + + CHECK_LAST (ATOMIC_LOAD_1, TSAN_ATOMIC8_LOAD), + CHECK_LAST (ATOMIC_LOAD_2, TSAN_ATOMIC16_LOAD), +@@ -463,7 +469,11 @@ + LOCK_RELEASE (SYNC_LOCK_RELEASE_2, TSAN_ATOMIC16_STORE), + LOCK_RELEASE (SYNC_LOCK_RELEASE_4, TSAN_ATOMIC32_STORE), + LOCK_RELEASE (SYNC_LOCK_RELEASE_8, TSAN_ATOMIC64_STORE), +- LOCK_RELEASE (SYNC_LOCK_RELEASE_16, TSAN_ATOMIC128_STORE) ++ LOCK_RELEASE (SYNC_LOCK_RELEASE_16, TSAN_ATOMIC128_STORE), ++ ++ BOOL_CLEAR (ATOMIC_CLEAR, TSAN_ATOMIC8_STORE), ++ ++ BOOL_TEST_AND_SET (ATOMIC_TEST_AND_SET, TSAN_ATOMIC8_EXCHANGE) + }; + + /* Instrument an atomic builtin. */ +@@ -615,6 +625,57 @@ + build_int_cst (NULL_TREE, + MEMMODEL_RELEASE)); + return; ++ case bool_clear: ++ case bool_test_and_set: ++ if (BOOL_TYPE_SIZE != 8) ++ { ++ decl = NULL_TREE; ++ for (j = 1; j < 5; j++) ++ if (BOOL_TYPE_SIZE == (8 << j)) ++ { ++ enum built_in_function tsan_fcode ++ = (enum built_in_function) ++ (tsan_atomic_table[i].tsan_fcode + j); ++ decl = builtin_decl_implicit (tsan_fcode); ++ break; ++ } ++ if (decl == NULL_TREE) ++ return; ++ } ++ last_arg = gimple_call_arg (stmt, num - 1); ++ if (!tree_fits_uhwi_p (last_arg) ++ || memmodel_base (tree_to_uhwi (last_arg)) >= MEMMODEL_LAST) ++ return; ++ t = TYPE_ARG_TYPES (TREE_TYPE (decl)); ++ t = TREE_VALUE (TREE_CHAIN (t)); ++ if (tsan_atomic_table[i].action == bool_clear) ++ { ++ update_gimple_call (gsi, decl, 3, gimple_call_arg (stmt, 0), ++ build_int_cst (t, 0), last_arg); ++ return; ++ } ++ t = build_int_cst (t, targetm.atomic_test_and_set_trueval); ++ update_gimple_call (gsi, decl, 3, gimple_call_arg (stmt, 0), ++ t, last_arg); ++ stmt = gsi_stmt (*gsi); ++ lhs = gimple_call_lhs (stmt); ++ if (lhs == NULL_TREE) ++ return; ++ if (targetm.atomic_test_and_set_trueval != 1 ++ || !useless_type_conversion_p (TREE_TYPE (lhs), ++ TREE_TYPE (t))) ++ { ++ tree new_lhs = make_ssa_name (TREE_TYPE (t)); ++ gimple_call_set_lhs (stmt, new_lhs); ++ if (targetm.atomic_test_and_set_trueval != 1) ++ g = gimple_build_assign (lhs, NE_EXPR, new_lhs, ++ build_int_cst (TREE_TYPE (t), 0)); ++ else ++ g = gimple_build_assign (lhs, NOP_EXPR, new_lhs); ++ gsi_insert_after (gsi, g, GSI_NEW_STMT); ++ update_stmt (stmt); ++ } ++ return; + default: + continue; + } Index: gcc/fortran/openmp.c =================================================================== --- a/src/gcc/fortran/openmp.c (.../tags/gcc_6_2_0_release) @@ -2779,7 +4873,52 @@ =================================================================== --- a/src/gcc/fortran/trans-openmp.c (.../tags/gcc_6_2_0_release) +++ b/src/gcc/fortran/trans-openmp.c (.../branches/gcc-6-branch) -@@ -3552,7 +3552,9 @@ +@@ -2816,7 +2816,11 @@ + gfc_start_block (&block); + + expr2 = code->expr2; +- if (expr2->expr_type == EXPR_FUNCTION ++ if (((atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_MASK) ++ != GFC_OMP_ATOMIC_WRITE) ++ && (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_SWAP) == 0 ++ && expr2->expr_type == EXPR_FUNCTION ++ && expr2->value.function.isym + && expr2->value.function.isym->id == GFC_ISYM_CONVERSION) + expr2 = expr2->value.function.actual->expr; + +@@ -2855,6 +2859,7 @@ + var = code->expr1->symtree->n.sym; + expr2 = code->expr2; + if (expr2->expr_type == EXPR_FUNCTION ++ && expr2->value.function.isym + && expr2->value.function.isym->id == GFC_ISYM_CONVERSION) + expr2 = expr2->value.function.actual->expr; + } +@@ -2912,6 +2917,7 @@ + } + e = expr2->value.op.op1; + if (e->expr_type == EXPR_FUNCTION ++ && e->value.function.isym + && e->value.function.isym->id == GFC_ISYM_CONVERSION) + e = e->value.function.actual->expr; + if (e->expr_type == EXPR_VARIABLE +@@ -2925,6 +2931,7 @@ + { + e = expr2->value.op.op2; + if (e->expr_type == EXPR_FUNCTION ++ && e->value.function.isym + && e->value.function.isym->id == GFC_ISYM_CONVERSION) + e = e->value.function.actual->expr; + gcc_assert (e->expr_type == EXPR_VARIABLE +@@ -3039,6 +3046,7 @@ + code = code->next; + expr2 = code->expr2; + if (expr2->expr_type == EXPR_FUNCTION ++ && expr2->value.function.isym + && expr2->value.function.isym->id == GFC_ISYM_CONVERSION) + expr2 = expr2->value.function.actual->expr; + +@@ -3552,7 +3560,9 @@ gfc_start_block (&block); omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses, code->loc); @@ -2789,7 +4928,7 @@ stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt, omp_clauses); gfc_add_expr_to_block (&block, stmt); -@@ -3997,10 +3999,7 @@ +@@ -3997,10 +4007,7 @@ code->loc); pushlevel (); stmt = gfc_trans_omp_workshare (code, &workshare_clauses); @@ -2801,7 +4940,7 @@ stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt, omp_clauses); OMP_PARALLEL_COMBINED (stmt) = 1; -@@ -4060,7 +4059,9 @@ +@@ -4060,7 +4067,9 @@ gfc_start_block (&block); omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses, code->loc); @@ -2811,7 +4950,7 @@ stmt = build2_loc (input_location, OMP_TASK, void_type_node, stmt, omp_clauses); gfc_add_expr_to_block (&block, stmt); -@@ -4213,7 +4214,11 @@ +@@ -4213,7 +4222,11 @@ = gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_TARGET], code->loc); if (code->op == EXEC_OMP_TARGET) @@ -2828,7 +4967,17 @@ =================================================================== --- a/src/gcc/fortran/ChangeLog (.../tags/gcc_6_2_0_release) +++ b/src/gcc/fortran/ChangeLog (.../branches/gcc-6-branch) -@@ -1,3 +1,39 @@ +@@ -1,3 +1,49 @@ ++2016-09-16 Jakub Jelinek ++ ++ Backported from mainline ++ 2016-09-08 Jakub Jelinek ++ ++ PR fortran/77500 ++ * trans-openmp.c (gfc_trans_omp_atomic): For atomic write or ++ swap, don't try to look through GFC_ISYM_CONVERSION. In other cases, ++ check that value.function.isym is non-NULL before dereferencing it. ++ +2016-09-01 Jakub Jelinek + + Backported from mainline @@ -2951,6 +5100,216 @@ count = 1 + ((cp->ext.omp_atomic & GFC_OMP_ATOMIC_MASK) == GFC_OMP_ATOMIC_CAPTURE); +Index: gcc/configure.ac +=================================================================== +--- a/src/gcc/configure.ac (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/configure.ac (.../branches/gcc-6-branch) +@@ -4437,7 +4437,7 @@ + gcc_cv_as_aix_dwloc, [2,21,0],, + [ .dwsect 0xA0000 + Lframe..0: +- .vbyte 4,Lframe..0: ++ .vbyte 4,Lframe..0 + ],, + [AC_DEFINE(HAVE_XCOFF_DWARF_EXTRAS, 1, + [Define if your assembler supports AIX debug frame section label reference.])]) +Index: gcc/tree-data-ref.c +=================================================================== +--- a/src/gcc/tree-data-ref.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/tree-data-ref.c (.../branches/gcc-6-branch) +@@ -2680,13 +2680,13 @@ + + if (niter > 0) + { +- HOST_WIDE_INT tau2 = MIN (FLOOR_DIV (niter - i0, i1), +- FLOOR_DIV (niter - j0, j1)); ++ HOST_WIDE_INT tau2 = MIN (FLOOR_DIV (niter_a - i0, i1), ++ FLOOR_DIV (niter_b - j0, j1)); + HOST_WIDE_INT last_conflict = tau2 - (x1 - i0)/i1; + + /* If the overlap occurs outside of the bounds of the + loop, there is no dependence. */ +- if (x1 >= niter || y1 >= niter) ++ if (x1 >= niter_a || y1 >= niter_b) + { + *overlaps_a = conflict_fn_no_dependence (); + *overlaps_b = conflict_fn_no_dependence (); +Index: gcc/tree-vect-data-refs.c +=================================================================== +--- a/src/gcc/tree-vect-data-refs.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/tree-vect-data-refs.c (.../branches/gcc-6-branch) +@@ -2703,10 +2703,17 @@ + data_reference_p dra = datarefs_copy[i]; + stmt_vec_info stmtinfo_a = vinfo_for_stmt (DR_STMT (dra)); + stmt_vec_info lastinfo = NULL; ++ if (! STMT_VINFO_VECTORIZABLE (stmtinfo_a)) ++ { ++ ++i; ++ continue; ++ } + for (i = i + 1; i < datarefs_copy.length (); ++i) + { + data_reference_p drb = datarefs_copy[i]; + stmt_vec_info stmtinfo_b = vinfo_for_stmt (DR_STMT (drb)); ++ if (! STMT_VINFO_VECTORIZABLE (stmtinfo_b)) ++ break; + + /* ??? Imperfect sorting (non-compatible types, non-modulo + accesses, same accesses) can lead to a group to be artificially +Index: gcc/lra-constraints.c +=================================================================== +--- a/src/gcc/lra-constraints.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/lra-constraints.c (.../branches/gcc-6-branch) +@@ -871,15 +871,18 @@ + } + + /* Generate reloads for matching OUT and INS (array of input operand +- numbers with end marker -1) with reg class GOAL_CLASS. Add input +- and output reloads correspondingly to the lists *BEFORE and *AFTER. +- OUT might be negative. In this case we generate input reloads for +- matched input operands INS. EARLY_CLOBBER_P is a flag that the +- output operand is early clobbered for chosen alternative. */ ++ numbers with end marker -1) with reg class GOAL_CLASS, considering ++ output operands OUTS (similar array to INS) needing to be in different ++ registers. Add input and output reloads correspondingly to the lists ++ *BEFORE and *AFTER. OUT might be negative. In this case we generate ++ input reloads for matched input operands INS. EARLY_CLOBBER_P is a flag ++ that the output operand is early clobbered for chosen alternative. */ + static void +-match_reload (signed char out, signed char *ins, enum reg_class goal_class, +- rtx_insn **before, rtx_insn **after, bool early_clobber_p) ++match_reload (signed char out, signed char *ins, signed char *outs, ++ enum reg_class goal_class, rtx_insn **before, ++ rtx_insn **after, bool early_clobber_p) + { ++ bool out_conflict; + int i, in; + rtx new_in_reg, new_out_reg, reg; + machine_mode inmode, outmode; +@@ -968,6 +971,25 @@ + We don't care about eliminable hard regs here as we are + interesting only in pseudos. */ + ++ /* Matching input's register value is the same as one of the other ++ output operand. Output operands in a parallel insn must be in ++ different registers. */ ++ out_conflict = false; ++ if (REG_P (in_rtx)) ++ { ++ for (i = 0; outs[i] >= 0; i++) ++ { ++ rtx other_out_rtx = *curr_id->operand_loc[outs[i]]; ++ if (REG_P (other_out_rtx) ++ && (regno_val_use_in (REGNO (in_rtx), other_out_rtx) ++ != NULL_RTX)) ++ { ++ out_conflict = true; ++ break; ++ } ++ } ++ } ++ + new_in_reg = new_out_reg + = (! early_clobber_p && ins[1] < 0 && REG_P (in_rtx) + && (int) REGNO (in_rtx) < lra_new_regno_start +@@ -974,6 +996,7 @@ + && find_regno_note (curr_insn, REG_DEAD, REGNO (in_rtx)) + && (out < 0 + || regno_val_use_in (REGNO (in_rtx), out_rtx) == NULL_RTX) ++ && !out_conflict + ? lra_create_new_reg (inmode, in_rtx, goal_class, "") + : lra_create_new_reg_with_unique_value (outmode, out_rtx, + goal_class, "")); +@@ -3396,9 +3419,11 @@ + int i, j, k; + int n_operands; + int n_alternatives; ++ int n_outputs; + int commutative; + signed char goal_alt_matched[MAX_RECOG_OPERANDS][MAX_RECOG_OPERANDS]; + signed char match_inputs[MAX_RECOG_OPERANDS + 1]; ++ signed char outputs[MAX_RECOG_OPERANDS + 1]; + rtx_insn *before, *after; + bool alt_p = false; + /* Flag that the insn has been changed through a transformation. */ +@@ -3806,6 +3831,8 @@ + } + } + ++ n_outputs = 0; ++ outputs[0] = -1; + for (i = 0; i < n_operands; i++) + { + int regno; +@@ -3963,7 +3990,7 @@ + /* generate reloads for input and matched outputs. */ + match_inputs[0] = i; + match_inputs[1] = -1; +- match_reload (goal_alt_matched[i][0], match_inputs, ++ match_reload (goal_alt_matched[i][0], match_inputs, outputs, + goal_alt[i], &before, &after, + curr_static_id->operand_alternative + [goal_alt_number * n_operands + goal_alt_matched[i][0]] +@@ -3973,9 +4000,9 @@ + && (curr_static_id->operand[goal_alt_matched[i][0]].type + == OP_IN)) + /* Generate reloads for output and matched inputs. */ +- match_reload (i, goal_alt_matched[i], goal_alt[i], &before, &after, +- curr_static_id->operand_alternative +- [goal_alt_number * n_operands + i].earlyclobber); ++ match_reload (i, goal_alt_matched[i], outputs, goal_alt[i], &before, ++ &after, curr_static_id->operand_alternative ++ [goal_alt_number * n_operands + i].earlyclobber); + else if (curr_static_id->operand[i].type == OP_IN + && (curr_static_id->operand[goal_alt_matched[i][0]].type + == OP_IN)) +@@ -3985,12 +4012,22 @@ + for (j = 0; (k = goal_alt_matched[i][j]) >= 0; j++) + match_inputs[j + 1] = k; + match_inputs[j + 1] = -1; +- match_reload (-1, match_inputs, goal_alt[i], &before, &after, false); ++ match_reload (-1, match_inputs, outputs, goal_alt[i], &before, ++ &after, false); + } + else + /* We must generate code in any case when function + process_alt_operands decides that it is possible. */ + gcc_unreachable (); ++ ++ /* Memorise processed outputs so that output remaining to be processed ++ can avoid using the same register value (see match_reload). */ ++ if (curr_static_id->operand[i].type == OP_OUT) ++ { ++ outputs[n_outputs++] = i; ++ outputs[n_outputs] = -1; ++ } ++ + if (optional_p) + { + lra_assert (REG_P (op)); +Index: gcc/gimple-fold.c +=================================================================== +--- a/src/gcc/gimple-fold.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/gimple-fold.c (.../branches/gcc-6-branch) +@@ -5381,14 +5381,15 @@ + if (domain_type && TYPE_MIN_VALUE (domain_type)) + { + /* Static constructors for variably sized objects makes no sense. */ +- gcc_assert (TREE_CODE (TYPE_MIN_VALUE (domain_type)) == INTEGER_CST); ++ if (TREE_CODE (TYPE_MIN_VALUE (domain_type)) != INTEGER_CST) ++ return NULL_TREE; + low_bound = wi::to_offset (TYPE_MIN_VALUE (domain_type)); + } + else + low_bound = 0; + /* Static constructors for variably sized objects makes no sense. */ +- gcc_assert (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor)))) +- == INTEGER_CST); ++ if (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor)))) != INTEGER_CST) ++ return NULL_TREE; + elt_size = wi::to_offset (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor)))); + + /* We can handle only constantly sized accesses that are known to not Index: gcc/tree-cfgcleanup.c =================================================================== --- a/src/gcc/tree-cfgcleanup.c (.../tags/gcc_6_2_0_release) @@ -3001,7 +5360,33 @@ =================================================================== --- a/src/gcc/tree-ssa-pre.c (.../tags/gcc_6_2_0_release) +++ b/src/gcc/tree-ssa-pre.c (.../branches/gcc-6-branch) -@@ -4335,6 +4335,15 @@ +@@ -2896,7 +2896,24 @@ + gimple_seq_discard (forced_stmts); + return folded; + } +- ++ /* Likewise if we simplified to sth not queued for insertion. */ ++ bool found = false; ++ gsi = gsi_last (forced_stmts); ++ for (; !gsi_end_p (gsi); gsi_prev (&gsi)) ++ { ++ gimple *stmt = gsi_stmt (gsi); ++ tree forcedname = gimple_get_lhs (stmt); ++ if (forcedname == folded) ++ { ++ found = true; ++ break; ++ } ++ } ++ if (! found) ++ { ++ gimple_seq_discard (forced_stmts); ++ return folded; ++ } + gcc_assert (TREE_CODE (folded) == SSA_NAME); + + /* If we have any intermediate expressions to the value sets, add them +@@ -4335,6 +4352,15 @@ lang_hooks.decl_printable_name (fn, 2)); } gimple_call_set_fndecl (call_stmt, fn); @@ -569075,6 +571460,15 @@ { int u = is_min ? UNSPEC_IEEE_MIN : UNSPEC_IEEE_MAX; rtvec v; +@@ -40361,7 +40380,7 @@ + error ("%qE needs isa option %s", fndecl, opts); + free (opts); + } +- return const0_rtx; ++ return expand_call (exp, target, ignore); + } + + switch (fcode) @@ -48848,6 +48867,8 @@ /* ms_abi and sysv_abi calling convention function attributes. */ { "ms_abi", 0, 0, false, true, true, ix86_handle_abi_attribute, true }, @@ -569172,6 +571566,145 @@ return std_canonical_va_list_type (type); } +@@ -53662,9 +53642,7 @@ + return V4SFmode; + + case DFmode: +- if (!TARGET_VECTORIZE_DOUBLE) +- return word_mode; +- else if (TARGET_AVX512F) ++ if (TARGET_AVX512F) + return V8DFmode; + else if (TARGET_AVX && !TARGET_PREFER_AVX128) + return V4DFmode; +@@ -53749,9 +53727,14 @@ + tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE; + int stmt_cost = ix86_builtin_vectorization_cost (kind, vectype, misalign); + ++ /* Penalize DFmode vector operations for !TARGET_VECTORIZE_DOUBLE. */ ++ if (kind == vector_stmt && !TARGET_VECTORIZE_DOUBLE ++ && vectype && GET_MODE_INNER (TYPE_MODE (vectype)) == DFmode) ++ stmt_cost *= 5; /* FIXME: The value here is arbitrary. */ ++ + /* Statements in an inner loop relative to the loop being + vectorized are weighted more heavily. The value here is +- arbitrary and could potentially be improved with analysis. */ ++ arbitrary and could potentially be improved with analysis. */ + if (where == vect_body && stmt_info && stmt_in_inner_loop_p (stmt_info)) + count *= 50; /* FIXME. */ + +Index: gcc/config/avr/avr.c +=================================================================== +--- a/src/gcc/config/avr/avr.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/config/avr/avr.c (.../branches/gcc-6-branch) +@@ -2518,9 +2518,45 @@ + break; + + case CC_NONE: +- /* Insn does not affect CC at all. */ +- break; ++ /* Insn does not affect CC at all, but it might set some registers ++ that are stored in cc_status. If such a register is affected by ++ the current insn, for example by means of a SET or a CLOBBER, ++ then we must reset cc_status; cf. PR77326. + ++ Unfortunately, set_of cannot be used as reg_overlap_mentioned_p ++ will abort on COMPARE (which might be found in cc_status.value1/2). ++ Thus work out the registers set by the insn and regs mentioned ++ in cc_status.value1/2. */ ++ ++ if (cc_status.value1 ++ || cc_status.value2) ++ { ++ HARD_REG_SET regs_used; ++ HARD_REG_SET regs_set; ++ CLEAR_HARD_REG_SET (regs_used); ++ ++ if (cc_status.value1 ++ && !CONSTANT_P (cc_status.value1)) ++ { ++ find_all_hard_regs (cc_status.value1, ®s_used); ++ } ++ ++ if (cc_status.value2 ++ && !CONSTANT_P (cc_status.value2)) ++ { ++ find_all_hard_regs (cc_status.value2, ®s_used); ++ } ++ ++ find_all_hard_reg_sets (insn, ®s_set, false); ++ ++ if (hard_reg_set_intersect_p (regs_used, regs_set)) ++ { ++ CC_STATUS_INIT; ++ } ++ } ++ ++ break; // CC_NONE ++ + case CC_SET_N: + CC_STATUS_INIT; + break; +@@ -10120,6 +10156,7 @@ + break; + + case SImode: ++ case DImode: + if (AVR_HAVE_MUL) + { + if (!speed) +@@ -10145,8 +10182,11 @@ + *total = COSTS_N_INSNS (AVR_HAVE_JMP_CALL ? 5 : 4); + } + +- return true; ++ if (mode == DImode) ++ *total *= 2; + ++ return true; ++ + default: + return false; + } +@@ -10726,7 +10766,7 @@ + && (REG_P (XEXP (x, 0)) + || GET_CODE (XEXP (x, 0)) == SUBREG)) + { +- if (INTVAL (XEXP (x, 1)) >= 61) ++ if (INTVAL (XEXP (x, 1)) > MAX_LD_OFFSET(mode)) + cost = 18; + } + else if (CONSTANT_ADDRESS_P (x)) +Index: gcc/config/rs6000/xcoff.h +=================================================================== +--- a/src/gcc/config/rs6000/xcoff.h (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/config/rs6000/xcoff.h (.../branches/gcc-6-branch) +@@ -313,6 +313,9 @@ + #define EH_FRAME_THROUGH_COLLECT2 1 + #define EH_TABLES_CAN_BE_READ_ONLY 1 + ++/* AIX Assembler implicitly assumes DWARF 64 bit extension in 64 bit mode. */ ++#define DWARF_OFFSET_SIZE PTR_SIZE ++ + #define ASM_OUTPUT_DWARF_PCREL(FILE,SIZE,LABEL) \ + rs6000_asm_output_dwarf_pcrel ((FILE), (SIZE), (LABEL)); + +Index: gcc/config/rs6000/rs6000.c +=================================================================== +--- a/src/gcc/config/rs6000/rs6000.c (.../tags/gcc_6_2_0_release) ++++ b/src/gcc/config/rs6000/rs6000.c (.../branches/gcc-6-branch) +@@ -29217,7 +29217,10 @@ + (TREE_CODE (decl) == FUNCTION_DECL + ? "[DS]" : "[UA]"), + NULL); +- XSTR (x, 0) = name; ++ ++ /* Don't modify name in extern VAR_DECL to include mapping class. */ ++ if (TREE_CODE (decl) == FUNCTION_DECL) ++ XSTR (x, 0) = name; + } + + if (VTABLE_NAME_P (name)) Index: gcc/config/rs6000/vsx.md =================================================================== --- a/src/gcc/config/rs6000/vsx.md (.../tags/gcc_6_2_0_release) diff -u gcc-6-6.2.0/debian/rules.d/binary-java.mk gcc-6-6.2.0/debian/rules.d/binary-java.mk --- gcc-6-6.2.0/debian/rules.d/binary-java.mk +++ gcc-6-6.2.0/debian/rules.d/binary-java.mk @@ -485,6 +485,12 @@ mv $(d_jrehl)/$(PF)/bin/$(cmd_prefix)gij$(pkg_ver) \ $(d_jrehl)/$(PF)/bin/$(cmd_prefix)gij$(pkg_ver).bin install -m755 debian/gij-hppa $(d_jrehl)/$(PF)/bin/$(cmd_prefix)gij$(pkg_ver) + ifeq ($(unprefixed_names),yes) + ln -sf $(cmd_prefix)gij$(pkg_ver) \ + $(d_gcj)/$(PF)/bin/gij$(pkg_ver) + ln -sf $(cmd_prefix)gij$(pkg_ver).bin \ + $(d_gcj)/$(PF)/bin/gij$(pkg_ver).bin + endif endif ln -s ../libgcj.so.$(GCJ_SONAME) \ diff -u gcc-6-6.2.0/debian/rules.defs gcc-6-6.2.0/debian/rules.defs --- gcc-6-6.2.0/debian/rules.defs +++ gcc-6-6.2.0/debian/rules.defs @@ -406,12 +406,6 @@ endif endif -ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE))) - with_linaro_branch = - with_ibm_branch = -else ifneq (,$(findstring gcc-linaro, $(PKGSOURCE))) -endif - # check if we're building for armel or armhf ifneq (,$(filter %eabihf,$(DEB_TARGET_GNU_SYSTEM))) float_abi := hard diff -u gcc-6-6.2.0/debian/rules.parameters gcc-6-6.2.0/debian/rules.parameters --- gcc-6-6.2.0/debian/rules.parameters +++ gcc-6-6.2.0/debian/rules.parameters @@ -2,14 +2,14 @@ GCC_VERSION := 6.2.0 NEXT_GCC_VERSION := 6.2.1 BASE_VERSION := 6 -SOURCE_VERSION := 6.2.0-3ubuntu15 -DEB_VERSION := 6.2.0-3ubuntu15 -DEB_EVERSION := 1:6.2.0-3ubuntu15 -DEB_GDC_VERSION := 6.2.0-3ubuntu15 +SOURCE_VERSION := 6.2.0-5ubuntu21 +DEB_VERSION := 6.2.0-5ubuntu21 +DEB_EVERSION := 1:6.2.0-5ubuntu21 +DEB_GDC_VERSION := 6.2.0-5ubuntu21 DEB_SOVERSION := 5 DEB_SOEVERSION := 1:5 DEB_LIBGCC_SOVERSION := -DEB_LIBGCC_VERSION := 1:6.2.0-3ubuntu15 +DEB_LIBGCC_VERSION := 1:6.2.0-5ubuntu21 DEB_STDCXX_SOVERSION := 5 DEB_GCJ_SOVERSION := 5 PKG_GCJ_EXT := 17 diff -u gcc-6-6.2.0/debian/rules.patch gcc-6-6.2.0/debian/rules.patch --- gcc-6-6.2.0/debian/rules.patch +++ gcc-6-6.2.0/debian/rules.patch @@ -91,6 +91,10 @@ pr77379 \ $(if $(with_linaro_branch),,vulcan-cpu) \ $(if $(with_linaro_branch),,vulcan-costs) \ + libffi-pax \ + libffi-race-condition \ + pr71709 \ + pr77686-workaround \ # this is still needed on powerpc, e.g. firefox and insighttoolkit4 will ftbfs. ifneq (,$(filter $(DEB_TARGET_ARCH),powerpc)) diff -u gcc-6-6.2.0/debian/rules2 gcc-6-6.2.0/debian/rules2 --- gcc-6-6.2.0/debian/rules2 +++ gcc-6-6.2.0/debian/rules2 @@ -2274,6 +2274,7 @@ ifneq (,$(cmd_prefix)) for i in $(d)/$(PF)/share/info/$(cmd_prefix)*; do \ + [ -f "$$i" ] || continue; \ mv $$i $$(echo $$i | sed 's/$(cmd_prefix)//'); \ done endif only in patch2: unchanged: --- gcc-6-6.2.0.orig/debian/patches/libffi-pax.diff +++ gcc-6-6.2.0/debian/patches/libffi-pax.diff @@ -0,0 +1,161 @@ +From 757876336c183f5b20b6620d674cc9817fd0d280 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20B=C3=BChler?= +Date: Wed, 7 Sep 2016 15:50:54 +0200 +Subject: [PATCH 2/2] always check for PaX MPROTECT on linux, make EMUTRAMP + experimental + +- ffi_prep_closure_loc doesn't necessarily generate trampolines recognized by + PaX EMUTRAMP handler; there is no way to check before, and it isn't working +on x86-64 right now -> experimental +- if MPROTECT is enabled use the same workaround as is used for SELinux (double + mmap()) +--- + configure.ac | 11 +++++++--- + src/closures.c | 68 +++++++++++++++++++++++++++++++++++++++------------------- + 2 files changed, 54 insertions(+), 25 deletions(-) + +--- a/src/libffi/configure.ac ++++ b/src/libffi/configure.ac +@@ -177,12 +177,17 @@ + ;; + esac + +-# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. ++# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC; ++# if EMUTRAMP is active too ffi could try mapping without PROT_EXEC, ++# but the kernel needs to recognize the trampoline generated by ffi. ++# Otherwise fallback to double mmap trick. + AC_ARG_ENABLE(pax_emutramp, +- [ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC], ++ [ --enable-pax_emutramp enable pax emulated trampolines (experimental)], + if test "$enable_pax_emutramp" = "yes"; then ++ AC_MSG_WARN([EMUTRAMP is experimental only. Use --enable-pax_emutramp=experimental to enforce.]) ++ elif test "$enable_pax_emutramp" = "experimental"; then + AC_DEFINE(FFI_MMAP_EXEC_EMUTRAMP_PAX, 1, +- [Define this if you want to enable pax emulated trampolines]) ++ [Define this if you want to enable pax emulated trampolines (experimental)]) + fi) + + FFI_EXEC_TRAMPOLINE_TABLE=0 +--- a/src/libffi/src/closures.c ++++ b/src/libffi/src/closures.c +@@ -53,14 +53,18 @@ + # endif + #endif + +-#if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX +-# ifdef __linux__ ++#if FFI_MMAP_EXEC_WRIT && defined __linux__ ++# if !defined FFI_MMAP_EXEC_SELINUX + /* When defined to 1 check for SELinux and if SELinux is active, + don't attempt PROT_EXEC|PROT_WRITE mapping at all, as that + might cause audit messages. */ + # define FFI_MMAP_EXEC_SELINUX 1 +-# endif +-#endif ++# endif /* !defined FFI_MMAP_EXEC_SELINUX */ ++# if !defined FFI_MMAP_PAX ++/* Also check for PaX MPROTECT */ ++# define FFI_MMAP_PAX 1 ++# endif /* !defined FFI_MMAP_PAX */ ++#endif /* FFI_MMAP_EXEC_WRIT && defined __linux__ */ + + #if FFI_CLOSURES + +@@ -172,14 +176,18 @@ + + #endif /* !FFI_MMAP_EXEC_SELINUX */ + +-/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */ +-#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX ++/* On PaX enable kernels that have MPROTECT enabled we can't use PROT_EXEC. */ ++#if defined FFI_MMAP_PAX + #include + +-static int emutramp_enabled = -1; ++enum { ++ PAX_MPROTECT = (1 << 0), ++ PAX_EMUTRAMP = (1 << 1), ++}; ++static int cached_pax_flags = -1; + + static int +-emutramp_enabled_check (void) ++pax_flags_check (void) + { + char *buf = NULL; + size_t len = 0; +@@ -193,9 +201,10 @@ + while (getline (&buf, &len, f) != -1) + if (!strncmp (buf, "PaX:", 4)) + { +- char emutramp; +- if (sscanf (buf, "%*s %*c%c", &emutramp) == 1) +- ret = (emutramp == 'E'); ++ if (NULL != strchr (buf + 4, 'M')) ++ ret |= PAX_MPROTECT; ++ if (NULL != strchr (buf + 4, 'E')) ++ ret |= PAX_EMUTRAMP; + break; + } + free (buf); +@@ -203,9 +212,13 @@ + return ret; + } + +-#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ +- : (emutramp_enabled = emutramp_enabled_check ())) +-#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ ++#define get_pax_flags() (cached_pax_flags >= 0 ? cached_pax_flags \ ++ : (cached_pax_flags = pax_flags_check ())) ++#define has_pax_flags(flags) ((flags) == ((flags) & get_pax_flags ())) ++#define is_mprotect_enabled() (has_pax_flags (PAX_MPROTECT)) ++#define is_emutramp_enabled() (has_pax_flags (PAX_EMUTRAMP)) ++ ++#endif /* defined FFI_MMAP_PAX */ + + #elif defined (__CYGWIN__) || defined(__INTERIX) + +@@ -216,9 +229,10 @@ + + #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ + +-#ifndef FFI_MMAP_EXEC_EMUTRAMP_PAX +-#define is_emutramp_enabled() 0 +-#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ ++#if !defined FFI_MMAP_PAX ++# define is_mprotect_enabled() 0 ++# define is_emutramp_enabled() 0 ++#endif /* !defined FFI_MMAP_PAX */ + + /* Declare all functions defined in dlmalloc.c as static. */ + static void *dlmalloc(size_t); +@@ -525,13 +539,23 @@ + printf ("mapping in %zi\n", length); + #endif + +- if (execfd == -1 && is_emutramp_enabled ()) ++ /* -1 != execfd hints that we already decided to use dlmmap_locked ++ last time. */ ++ if (execfd == -1 && is_mprotect_enabled ()) + { +- ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset); +- return ptr; ++#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX ++ if (is_emutramp_enabled ()) ++ { ++ /* emutramp requires the kernel recognizing the trampoline pattern ++ generated by ffi_prep_closure_loc; there is no way to test ++ in advance whether this will work, so this is experimental. */ ++ ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset); ++ return ptr; ++ } ++#endif ++ /* fallback to dlmmap_locked. */ + } +- +- if (execfd == -1 && !is_selinux_enabled ()) ++ else if (execfd == -1 && !is_selinux_enabled ()) + { + ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset); + only in patch2: unchanged: --- gcc-6-6.2.0.orig/debian/patches/libffi-race-condition.diff +++ gcc-6-6.2.0/debian/patches/libffi-race-condition.diff @@ -0,0 +1,33 @@ +From 48d2e46528fb6e621d95a7fa194069fd136b712d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20B=C3=BChler?= +Date: Wed, 7 Sep 2016 15:49:48 +0200 +Subject: [PATCH 1/2] dlmmap_locked always needs locking as it always modifies + execsize + +--- + src/closures.c | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +--- a/src/libffi/src/closures.c ++++ b/src/libffi/src/closures.c +@@ -568,16 +568,11 @@ + MREMAP_DUP and prot at this point. */ + } + +- if (execsize == 0 || execfd == -1) +- { +- pthread_mutex_lock (&open_temp_exec_file_mutex); +- ptr = dlmmap_locked (start, length, prot, flags, offset); +- pthread_mutex_unlock (&open_temp_exec_file_mutex); ++ pthread_mutex_lock (&open_temp_exec_file_mutex); ++ ptr = dlmmap_locked (start, length, prot, flags, offset); ++ pthread_mutex_unlock (&open_temp_exec_file_mutex); + +- return ptr; +- } +- +- return dlmmap_locked (start, length, prot, flags, offset); ++ return ptr; + } + + /* Release memory at the given address, as well as the corresponding only in patch2: unchanged: --- gcc-6-6.2.0.orig/debian/patches/pr71709.diff +++ gcc-6-6.2.0/debian/patches/pr71709.diff @@ -0,0 +1,22 @@ +# DP: Fix PR rtl-optimization/71709, taken from the trunk + +gcc/ + +2016-07-01 Alan Modra + + PR rtl-optimization/71709 + * ira-lives.c (find_call_crossed_cheap_reg): Exit loop on arg reg + being set, not referenced. + + +--- a/src/gcc/ira-lives.c ++++ b/src/gcc/ira-lives.c +@@ -1014,7 +1014,7 @@ + break; + } + +- if (reg_overlap_mentioned_p (reg, PATTERN (prev))) ++ if (reg_set_p (reg, prev)) + break; + } + prev = PREV_INSN (prev); only in patch2: unchanged: --- gcc-6-6.2.0.orig/debian/patches/pr77686-workaround.diff +++ gcc-6-6.2.0/debian/patches/pr77686-workaround.diff @@ -0,0 +1,13 @@ +# DP: Apply workaround for PR libstdc++/77686 + +--- a/src/libstdc++-v3/include/std/functional ++++ b/src/libstdc++-v3/include/std/functional +@@ -1418,7 +1418,7 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, t + + _Nocopy_types _M_unused; + char _M_pod_data[sizeof(_Nocopy_types)]; +- }; ++ } __attribute__((may_alias)); + + enum _Manager_operation + {