- _S_Single
+ _S_single
This policy uses a non-reentrant add_ref_lock() with no locking. It is
used when libstdc++ is built without --enable-threads.
Index: libstdc++-v3/po/Makefile.in
===================================================================
--- libstdc++-v3/po/Makefile.in (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/po/Makefile.in (.../branches/gcc-7-branch)
@@ -204,6 +204,7 @@
VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@
WARN_FLAGS = @WARN_FLAGS@
WERROR = @WERROR@
+XMLCATALOG = @XMLCATALOG@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
XSL_STYLE_DIR = @XSL_STYLE_DIR@
Index: libstdc++-v3/include/Makefile.in
===================================================================
--- libstdc++-v3/include/Makefile.in (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/Makefile.in (.../branches/gcc-7-branch)
@@ -204,6 +204,7 @@
VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@
WARN_FLAGS = @WARN_FLAGS@
WERROR = @WERROR@
+XMLCATALOG = @XMLCATALOG@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
XSL_STYLE_DIR = @XSL_STYLE_DIR@
Index: libstdc++-v3/include/std/optional
===================================================================
--- libstdc++-v3/include/std/optional (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/std/optional (.../branches/gcc-7-branch)
@@ -51,7 +51,7 @@
* @{
*/
-#define __cpp_lib_optional 201603
+#define __cpp_lib_optional 201606L
template
class optional;
Index: libstdc++-v3/include/std/any
===================================================================
--- libstdc++-v3/include/std/any (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/std/any (.../branches/gcc-7-branch)
@@ -66,7 +66,7 @@
#endif
}
-#define __cpp_lib_any 201603
+#define __cpp_lib_any 201606L
/**
* @brief A type-safe container of any type.
@@ -513,20 +513,34 @@
}
// @}
+ /// @cond undocumented
template
void* __any_caster(const any* __any)
{
- if constexpr (is_copy_constructible_v>)
+ // any_cast returns non-null if __any->type() == typeid(T) and
+ // typeid(T) ignores cv-qualifiers so remove them:
+ using _Up = remove_cv_t<_Tp>;
+ // The contained value has a decayed type, so if decay_t is not U,
+ // then it's not possible to have a contained value of type U:
+ if constexpr (!is_same_v, _Up>)
+ return nullptr;
+ // Only copy constructible types can be used for contained values:
+ else if constexpr (!is_copy_constructible_v<_Up>)
+ return nullptr;
+ // First try comparing function addresses, which works without RTTI
+ else if (__any->_M_manager == &any::_Manager<_Up>::_S_manage
+#if __cpp_rtti
+ || __any->type() == typeid(_Tp)
+#endif
+ )
{
- if (__any->_M_manager == &any::_Manager>::_S_manage)
- {
- any::_Arg __arg;
- __any->_M_manager(any::_Op_access, __any, &__arg);
- return __arg._M_obj;
- }
+ any::_Arg __arg;
+ __any->_M_manager(any::_Op_access, __any, &__arg);
+ return __arg._M_obj;
}
return nullptr;
}
+ /// @endcond
/**
* @brief Access the contained object.
@@ -542,8 +556,9 @@
template
inline const _ValueType* any_cast(const any* __any) noexcept
{
- if (__any)
- return static_cast<_ValueType*>(__any_caster<_ValueType>(__any));
+ if constexpr (is_object_v<_ValueType>)
+ if (__any)
+ return static_cast<_ValueType*>(__any_caster<_ValueType>(__any));
return nullptr;
}
@@ -550,8 +565,9 @@
template
inline _ValueType* any_cast(any* __any) noexcept
{
- if (__any)
- return static_cast<_ValueType*>(__any_caster<_ValueType>(__any));
+ if constexpr (is_object_v<_ValueType>)
+ if (__any)
+ return static_cast<_ValueType*>(__any_caster<_ValueType>(__any));
return nullptr;
}
// @}
Index: libstdc++-v3/include/std/variant
===================================================================
--- libstdc++-v3/include/std/variant (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/std/variant (.../branches/gcc-7-branch)
@@ -71,7 +71,7 @@
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_variant 201603
+#define __cpp_lib_variant 201606L
template class tuple;
template class variant;
Index: libstdc++-v3/include/experimental/any
===================================================================
--- libstdc++-v3/include/experimental/any (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/experimental/any (.../branches/gcc-7-branch)
@@ -300,7 +300,8 @@
_Storage _M_storage;
template
- friend void* __any_caster(const any* __any);
+ friend enable_if_t::value, void*>
+ __any_caster(const any* __any);
// Manage in-place contained object.
template
@@ -410,19 +411,45 @@
}
// @}
+ /// @cond undocumented
template
- void* __any_caster(const any* __any)
+ enable_if_t::value, void*>
+ __any_caster(const any* __any)
{
- struct _None { };
- using _Up = decay_t<_Tp>;
- using _Vp = conditional_t::value, _Up, _None>;
- if (__any->_M_manager != &any::_Manager<_Vp>::_S_manage)
- return nullptr;
- any::_Arg __arg;
- __any->_M_manager(any::_Op_access, __any, &__arg);
- return __arg._M_obj;
+ // any_cast returns non-null if __any->type() == typeid(T) and
+ // typeid(T) ignores cv-qualifiers so remove them:
+ using _Up = remove_cv_t<_Tp>;
+ // The contained value has a decayed type, so if decay_t is not U,
+ // then it's not possible to have a contained value of type U.
+ using __does_not_decay = is_same, _Up>;
+ // Only copy constructible types can be used for contained values.
+ using __is_copyable = is_copy_constructible<_Up>;
+ // If the type _Tp could never be stored in an any we don't want to
+ // instantiate _Manager<_Tp>, so use _Manager instead, which
+ // is explicitly specialized and has a no-op _S_manage function.
+ using _Vp = conditional_t<__and_<__does_not_decay, __is_copyable>::value,
+ _Up, any::_Op>;
+ // First try comparing function addresses, which works without RTTI
+ if (__any->_M_manager == &any::_Manager<_Vp>::_S_manage
+#if __cpp_rtti
+ || __any->type() == typeid(_Tp)
+#endif
+ )
+ {
+ any::_Arg __arg;
+ __any->_M_manager(any::_Op_access, __any, &__arg);
+ return __arg._M_obj;
+ }
+ return nullptr;
}
+ // This overload exists so that std::any_cast(a) is well-formed.
+ template
+ enable_if_t::value, _Tp*>
+ __any_caster(const any*) noexcept
+ { return nullptr; }
+ /// @endcond
+
/**
* @brief Access the contained object.
*
@@ -517,6 +544,14 @@
}
}
+ // Dummy specialization used by __any_caster.
+ template<>
+ struct any::_Manager_internal
+ {
+ static void
+ _S_manage(_Op, const any*, _Arg*) { }
+ };
+
// @} group any
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace fundamentals_v1
Index: libstdc++-v3/include/experimental/bits/fs_path.h
===================================================================
--- libstdc++-v3/include/experimental/bits/fs_path.h (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/experimental/bits/fs_path.h (.../branches/gcc-7-branch)
@@ -182,7 +182,8 @@
path(path&& __p) noexcept
: _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type)
{
- _M_split_cmpts();
+ if (_M_type == _Type::_Multi)
+ _M_split_cmpts();
__p.clear();
}
@@ -456,7 +457,7 @@
return _S_convert_loc(__tmp.data(), __tmp.data()+__tmp.size(), __loc);
}
- bool _S_is_dir_sep(value_type __ch)
+ static bool _S_is_dir_sep(value_type __ch)
{
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
return __ch == L'/' || __ch == preferred_separator;
Index: libstdc++-v3/include/experimental/type_traits
===================================================================
--- libstdc++-v3/include/experimental/type_traits (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/experimental/type_traits (.../branches/gcc-7-branch)
@@ -254,12 +254,12 @@
template class _Op, typename... _Args>
using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
-template class _Op, typename... _Args>
- using is_detected_exact = is_same>;
+template class _Op, typename... _Args>
+ using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
-template class _Op, typename... _Args>
+template class _Op, typename... _Args>
constexpr bool is_detected_exact_v
- = is_detected_exact::value;
+ = is_detected_exact<_Expected, _Op, _Args...>::value;
template class _Op, typename... _Args>
using is_detected_convertible
Index: libstdc++-v3/include/bits/unique_ptr.h
===================================================================
--- libstdc++-v3/include/bits/unique_ptr.h (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/bits/unique_ptr.h (.../branches/gcc-7-branch)
@@ -171,14 +171,9 @@
// unique_ptr
template
using __safe_conversion_up = __and_<
- is_convertible::pointer, pointer>,
- __not_>,
- __or_<__and_,
- is_same>,
- __and_<__not_>,
- is_convertible<_Ep, deleter_type>>
- >
- >;
+ is_convertible::pointer, pointer>,
+ __not_>
+ >;
// Constructors.
@@ -419,16 +414,14 @@
// helper template for detecting a safe conversion from another
// unique_ptr
template,
- typename _Up_element_type = typename _Up_up::element_type>
+ typename _UPtr = unique_ptr<_Up, _Ep>,
+ typename _UP_pointer = typename _UPtr::pointer,
+ typename _UP_element_type = typename _UPtr::element_type>
using __safe_conversion_up = __and_<
is_array<_Up>,
is_same,
- is_same,
- is_convertible<_Up_element_type(*)[], element_type(*)[]>,
- __or_<__and_, is_same>,
- __and_<__not_>,
- is_convertible<_Ep, deleter_type>>>
+ is_same<_UP_pointer, _UP_element_type*>,
+ is_convertible<_UP_element_type(*)[], element_type(*)[]>
>;
// helper template for detecting a safe conversion from a raw pointer
@@ -513,8 +506,11 @@
typename = _DeleterConstraint<_Up>>
constexpr unique_ptr(nullptr_t) noexcept : _M_t() { }
- template>>
+ template,
+ typename conditional::value,
+ is_same<_Ep, _Dp>,
+ is_convertible<_Ep, _Dp>>::type>>
unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
: _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
{ }
Index: libstdc++-v3/include/bits/stl_uninitialized.h
===================================================================
--- libstdc++-v3/include/bits/stl_uninitialized.h (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/bits/stl_uninitialized.h (.../branches/gcc-7-branch)
@@ -827,6 +827,8 @@
#endif
#if __cplusplus > 201402L
+# define __cpp_lib_raw_memory_algorithms 201606L
+
template
inline void
uninitialized_default_construct(_ForwardIterator __first,
Index: libstdc++-v3/include/bits/char_traits.h
===================================================================
--- libstdc++-v3/include/bits/char_traits.h (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/bits/char_traits.h (.../branches/gcc-7-branch)
@@ -246,7 +246,7 @@
__constant_char_array_p(const _CharT* __a, size_t __n)
{
size_t __i = 0;
- while (__builtin_constant_p(__a[__i]) && __i < __n)
+ while (__i < __n && __builtin_constant_p(__a[__i]))
__i++;
return __i == __n;
}
Index: libstdc++-v3/include/bits/forward_list.tcc
===================================================================
--- libstdc++-v3/include/bits/forward_list.tcc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/bits/forward_list.tcc (.../branches/gcc-7-branch)
@@ -381,7 +381,7 @@
auto __iy = __ly.cbegin();
while (__ix != __lx.cend() && __iy != __ly.cend())
{
- if (*__ix != *__iy)
+ if (!(*__ix == *__iy))
return false;
++__ix;
++__iy;
@@ -451,9 +451,9 @@
__p = static_cast<_Node*>(__p->_M_next);
--__psize;
}
- else if (__comp(*__p->_M_valptr(), *__q->_M_valptr()))
+ else if (!__comp(*__q->_M_valptr(), *__p->_M_valptr()))
{
- // First node of p is lower; e must come from p.
+ // First node of q is not lower; e must come from p.
__e = __p;
__p = static_cast<_Node*>(__p->_M_next);
--__psize;
Index: libstdc++-v3/include/bits/random.h
===================================================================
--- libstdc++-v3/include/bits/random.h (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/include/bits/random.h (.../branches/gcc-7-branch)
@@ -5982,9 +5982,9 @@
size_t size() const noexcept
{ return _M_v.size(); }
- template
+ template
void
- param(OutputIterator __dest) const
+ param(_OutputIterator __dest) const
{ std::copy(_M_v.begin(), _M_v.end(), __dest); }
// no copy functions
Index: libstdc++-v3/libsupc++/Makefile.in
===================================================================
--- libstdc++-v3/libsupc++/Makefile.in (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/libsupc++/Makefile.in (.../branches/gcc-7-branch)
@@ -277,6 +277,7 @@
VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@
WARN_FLAGS = @WARN_FLAGS@
WERROR = @WERROR@
+XMLCATALOG = @XMLCATALOG@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
XSL_STYLE_DIR = @XSL_STYLE_DIR@
Index: libstdc++-v3/libsupc++/guard_error.cc
===================================================================
--- libstdc++-v3/libsupc++/guard_error.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/libsupc++/guard_error.cc (.../branches/gcc-7-branch)
@@ -26,6 +26,6 @@
namespace __gnu_cxx
{
- recursive_init_error::~recursive_init_error() throw() { }
+ recursive_init_error::recursive_init_error() noexcept { }
+ recursive_init_error::~recursive_init_error() noexcept { }
}
-
Index: libstdc++-v3/libsupc++/hash_bytes.cc
===================================================================
--- libstdc++-v3/libsupc++/hash_bytes.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/libsupc++/hash_bytes.cc (.../branches/gcc-7-branch)
@@ -139,7 +139,7 @@
// Remove the bytes not divisible by the sizeof(size_t). This
// allows the main loop to process the data as 64-bit integers.
- const int len_aligned = len & ~0x7;
+ const size_t len_aligned = len & ~(size_t)0x7;
const char* const end = buf + len_aligned;
size_t hash = seed ^ (len * mul);
for (const char* p = buf; p != end; p += 8)
Index: libstdc++-v3/libsupc++/cxxabi.h
===================================================================
--- libstdc++-v3/libsupc++/cxxabi.h (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/libsupc++/cxxabi.h (.../branches/gcc-7-branch)
@@ -683,8 +683,9 @@
* @brief Exception thrown by __cxa_guard_acquire.
* @ingroup exceptions
*
- * 6.7[stmt.dcl]/4: If control re-enters the declaration (recursively)
- * while the object is being initialized, the behavior is undefined.
+ * C++ 2011 6.7 [stmt.dcl]/4: If control re-enters the declaration
+ * recursively while the variable is being initialized, the behavior
+ * is undefined.
*
* Since we already have a library function to handle locking, we might
* as well check for this situation and throw an exception.
@@ -694,8 +695,8 @@
class recursive_init_error: public std::exception
{
public:
- recursive_init_error() throw() { }
- virtual ~recursive_init_error() throw ();
+ recursive_init_error() _GLIBCXX_NOTHROW;
+ virtual ~recursive_init_error() _GLIBCXX_NOTHROW;
};
}
#endif // __cplusplus
Index: libstdc++-v3/ChangeLog
===================================================================
--- libstdc++-v3/ChangeLog (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/ChangeLog (.../branches/gcc-7-branch)
@@ -1,3 +1,253 @@
+2019-09-11 Jonathan Wakely
+
+ * python/libstdcxx/v6/xmethods.py (SharedPtrUseCountWorker.__call__):
+ Fix syntax error.
+
+2019-09-02 Jonathan Wakely
+
+ PR middle-end/89303
+ * testsuite/20_util/enable_shared_from_this/89303.cc: New test.
+
+2019-09-02 Jonathan Wakely
+
+ * testsuite/20_util/unique_ptr/assign/48635_neg.cc: Replace dg-error
+ with dg-prune-output for enable_if failure.
+ * testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Add
+ dg-prune-output for enable_if failure.
+
+ Backport from mainline
+ 2019-07-31 Jonathan Wakely
+
+ PR libstdc++/91308
+ * include/bits/unique_ptr.h (unique_ptr::__safe_conversion_up): Remove
+ constraints on deleter that should only apply to the constructor.
+ (unique_ptr::__safe_conversion_up): Likewise.
+ (unique_ptr::unique_ptr(unique_ptr&&)): Restore
+ constraints on deleter here.
+ * testsuite/20_util/unique_ptr/assign/91308.cc: New test.
+
+2019-09-02 Jonathan Wakely
+
+ Backport from mainline
+ 2019-07-29 Jonathan Wakely
+
+ PR libstdc++/51333
+ * libsupc++/cxxabi.h (__gnu_cxx::recursive_init_error): Do not define
+ constructor inline.
+ * libsupc++/guard_error.cc (__gnu_cxx::recursive_init_error): Define
+ constructor.
+ * testsuite/18_support/51333.cc: New test.
+
+2019-09-02 Jonathan Wakely
+
+ Backport from mainline
+ 2019-06-07 Jonathan Wakely
+
+ PR libstdc++/90770
+ * src/Makefile.am (stamp-debug): Also test for missing makefile.
+ * src/Makefile.in: Regenerate.
+
+2019-09-02 Jonathan Wakely
+
+ Backport from mainline
+ 2019-05-23 Jonathan Wakely
+
+ * doc/xml/manual/status_cxx2017.xml: Add feature test macro for
+ P0040R3.
+ * doc/html/*: Regenerate.
+
+ Backport from mainline
+ 2019-06-20 Jonathan Wakely
+
+ * doc/xml/manual/status_cxx2017.xml: Fix outdated reference to
+ C++17 working draft.
+
+ Backport from mainline
+ 2019-05-21 Jonathan Wakely
+
+ * doc/xml/manual/shared_ptr.xml: Fix names of lock policy constants.
+
+2019-09-02 Jonathan Wakely
+
+ Backport from mainline
+ 2019-05-17 Jonathan Wakely
+
+ * include/bits/random.h (seed_seq::param): Fix non-reserved name.
+ * include/experimental/type_traits (is_detected_exact)
+ (is_detected_exact_v): Likewise.
+ * testsuite/17_intro/names.cc: Check for more non-reserved names.
+ * testsuite/experimental/names.cc: New test.
+
+2019-06-26 Jonathan Wakely
+
+ Backport from mainline
+ 2019-05-28 Jonathan Wakely
+
+ PR libstdc++/90634
+ * include/experimental/bits/fs_path.h (path::path(path&&)): Only call
+ _M_split_cmpts() for a path with multiple components.
+ (path::_S_is_dir_sep()): Add missing 'static' keyword to function.
+ * src/filesystem/path.cc (path::_M_split_cmpts()): Count number of
+ components and reserve space in vector. Return early when there is
+ only one component.
+ * testsuite/experimental/filesystem/path/construct/90634.cc: New test.
+
+2019-05-23 Jonathan Wakely
+
+ Backport from mainline
+ 2019-02-27 Jonathan Wakely
+
+ PR libstdc++/89466
+ * acinclude.m4 (GLIBCXX_CONFIGURE_DOCBOOK): Reorder check for local
+ stylesheet directories before check for xsltproc. Try to use
+ xmlcatalog to find local stylesheet directory before trying hardcoded
+ paths. Add path used by suse to hardcoded paths. Adjust xsltproc
+ check to look for the same stylesheet as doc/Makefile.am uses. Don't
+ use xsltproc if xmlcatalog fails to find a local stylesheet.
+ * configure.ac: Check for xmlcatalog.
+ * Makefile.in: Regenerate.
+ * configure: Likewise.
+ * doc/Makefile.in: Likewise.
+ * include/Makefile.in: Likewise.
+ * libsupc++/Makefile.in: Likewise.
+ * po/Makefile.in: Likewise.
+ * python/Makefile.in: Likewise.
+ * src/Makefile.in: Likewise.
+ * src/c++11/Makefile.in: Likewise.
+ * src/c++17/Makefile.in: Likewise.
+ * src/c++98/Makefile.in: Likewise.
+ * src/filesystem/Makefile.in: Likewise.
+ * testsuite/Makefile.in: Likewise.
+
+2019-05-23 Jonathan Wakely
+
+ Backport from mainline
+ 2019-01-22 Jonathan Wakely
+
+ PR libstdc++/88740
+ * testsuite/util/testsuite_hooks.h [stderr] (VERIFY): Use fprintf to
+ write to stderr instead of using printf.
+
+2019-05-23 Jonathan Wakely
+
+ Backport from mainline
+ 2019-05-23 Jonathan Wakely
+
+ * include/experimental/any (__any_caster): Use RTTI if comparing
+ addresses fails, to support non-unique addresses in shared libraries.
+ * include/std/any (__any_caster): Likewise.
+ * testsuite/experimental/any/misc/any_cast_neg.cc: Use 0 for dg-error
+ line number.
+
+2019-05-23 Jonathan Wakely
+
+ Backport from mainline
+ 2019-05-23 Jonathan Wakely
+
+ PR libstdc++/90220
+ * include/experimental/any (__any_caster): Constrain to only be
+ callable for object types. Use remove_cv_t instead of decay_t.
+ If the type decays or isn't copy constructible, compare the manager
+ function to a dummy specialization.
+ (__any_caster): Add overload constrained for non-object types.
+ (any::_Manager_internal<_Op>): Add dummy specialization.
+ * testsuite/experimental/any/misc/any_cast.cc: Test function types
+ and array types.
+
+ Backport from mainline
+ 2019-04-24 Jonathan Wakely
+
+ PR libstdc++/90220
+ * include/std/any (__any_caster): Use remove_cv_t instead of decay_t.
+ Avoid a runtime check for types that can never be stored in std::any.
+ * testsuite/20_util/any/misc/any_cast.cc: Test std::any_cast with
+ array types.
+
+ Backport from mainline
+ 2019-04-24 Jonathan Wakely
+
+ PR libstdc++/90220 (partial)
+ * include/std/any (any_cast(any*), any_cast(const any*)): Do
+ not attempt ill-formed static_cast to pointers to non-object types.
+ * testsuite/20_util/any/misc/any_cast.cc: Test std::any_cast with
+ function types.
+
+2019-05-23 Jonathan Wakely
+
+ Backported from mainline
+ 2019-01-15 Jonathan Wakely
+
+ * doc/xml/manual/status_cxx2017.xml: Document P0032R3 and P0307R2
+ status.
+ * include/bits/stl_uninitialized.h (__cpp_lib_raw_memory_algorithms):
+ Define.
+ * include/std/any (__cpp_lib_any): Define as 201606L, because P0032R3
+ changes are supported.
+ * include/std/optional (__cpp_lib_optional): Likewise.
+ * include/std/variant (__cpp_lib_variant): Likewise.
+
+2019-05-08 Jonathan Wakely
+
+ Backport from mainline
+ 2019-04-17 Jonathan Wakely
+
+ PR libstdc++/90105
+ * include/bits/forward_list.tcc (operator==): Do not use operator!= to
+ compare elements.
+ (forward_list::sort(Comp)): When elements are equal take the one
+ earlier in the list, so that sort is stable.
+ * testsuite/23_containers/forward_list/operations/90105.cc: New test.
+ * testsuite/23_containers/forward_list/comparable.cc: Test with
+ types that meet the minimum EqualityComparable and LessThanComparable
+ requirements. Remove irrelevant comment.
+
+ Backport from mainline
+ 2019-03-11 Jonathan Wakely
+
+ PR libstdc++/89629
+ * libsupc++/hash_bytes.cc [__SIZEOF_SIZE_T__ == 8] (_Hash_bytes):
+ Use correct type for len_aligned.
+ * testsuite/20_util/hash/89629.cc: New test.
+
+2019-02-22 Jonathan Wakely
+
+ PR libstdc++/89446
+ * include/bits/char_traits.h (__constant_char_array): Check index is
+ in range before dereferencing.
+ * testsuite/21_strings/basic_string_view/operators/char/89446.cc:
+ New test.
+
+2018-12-24 Iain Sandoe
+
+ Backport from mainline
+ 2018-12-06 Iain Sandoe
+
+ * scripts/make_exports.pl (check names): Don’t try to export
+ construction vtable symbols.
+
+2018-12-24 Iain Sandoe
+
+ Backport from mainline
+ 2018-12-06 Jonathan Wakely
+ Iain Sandoe
+
+ PR libstdc++/64883
+ * testsuite/17_intro/headers/c++1998/all_attributes.cc: Don't test
+ always_inline on Darwin.
+ * testsuite/17_intro/headers/c++2011/all_attributes.cc: Likewise.
+ * testsuite/17_intro/headers/c++2014/all_attributes.cc: Likewise.
+ * testsuite/17_intro/headers/c++2017/all_attributes.cc: Likewise.
+ * testsuite/17_intro/headers/c++2020/all_attributes.cc: Likewise.
+
+2018-12-24 Iain Sandoe
+
+ Backport from mainline
+ 2018-08-25 Iain Sandoe
+
+ PR libstdc++/70694
+ * configure.host (OPT_LDFLAGS): Don't append
+ -fvisibility-inlines-hidden for newer Darwin.
+
2018-12-06 Release Manager
* GCC 7.4.0 released.
Index: libstdc++-v3/testsuite/Makefile.in
===================================================================
--- libstdc++-v3/testsuite/Makefile.in (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/Makefile.in (.../branches/gcc-7-branch)
@@ -204,6 +204,7 @@
VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@
WARN_FLAGS = @WARN_FLAGS@
WERROR = @WERROR@
+XMLCATALOG = @XMLCATALOG@
XMLLINT = @XMLLINT@
XSLTPROC = @XSLTPROC@
XSL_STYLE_DIR = @XSL_STYLE_DIR@
Index: libstdc++-v3/testsuite/18_support/51333.cc
===================================================================
--- libstdc++-v3/testsuite/18_support/51333.cc (.../tags/gcc_7_4_0_release) 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/18_support/51333.cc (.../branches/gcc-7-branch)
@@ -0,0 +1,22 @@
+// Copyright (C) 2019 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
+// .
+
+// { dg-options "-fkeep-inline-functions" }
+// { dg-do link }
+
+#include
+int main() { } // PR libstdc++/51333
Index: libstdc++-v3/testsuite/23_containers/forward_list/operations/90105.cc
===================================================================
--- libstdc++-v3/testsuite/23_containers/forward_list/operations/90105.cc (.../tags/gcc_7_4_0_release) 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/23_containers/forward_list/operations/90105.cc (.../branches/gcc-7-branch)
@@ -0,0 +1,60 @@
+// Copyright (C) 2019 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
+// .
+
+// { dg-do run { target c++11 } }
+
+#include
+#include
+
+// PR libstdc++/90105 - std::forward_list::sort() is not "stable"
+
+struct X
+{
+ int key;
+ int val;
+};
+
+bool operator<(const X& l, const X& r)
+{ return l.key < r.key; }
+
+bool operator==(const X& l, const X& r)
+{ return l.key == r.key && l.val == r.val; }
+
+void
+test01()
+{
+ std::forward_list l{ {1, 1}, {2, 2}, {1, 3}, {0, 4}, {2, 5}, {0, 6} };
+ l.sort();
+ std::forward_list exp{ {0, 4}, {0, 6}, {1, 1}, {1, 3}, {2, 2}, {2, 5} };
+ VERIFY( l == exp );
+}
+
+void
+test02()
+{
+ std::forward_list l{ {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6} };
+ const std::forward_list exp = l;
+ l.sort();
+ VERIFY( l == exp );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
Index: libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc
===================================================================
--- libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/23_containers/forward_list/comparable.cc (.../branches/gcc-7-branch)
@@ -17,15 +17,11 @@
// with this library; see the file COPYING3. If not see
// .
-
-// NOTE: This makes use of the fact that we know how moveable
-// is implemented on list (via swap). If the implementation changed
-// this test may begin to fail.
-
#include
#include
-int main()
+void
+test01()
{
std::forward_list a = {0.0, 1.0, 2.0, 3.0, 4.0};
std::forward_list b = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
@@ -43,6 +39,40 @@
VERIFY((b > a) == true);
VERIFY((b >= a) == true);
VERIFY((b <= a) == false);
+}
- return 0;
+void
+test02()
+{
+ // The EqualityComparable requirements only require ==
+ struct X {
+ bool operator==(const X&) const { return true; }
+ };
+
+ std::forward_list a(2);
+ const auto b = a;
+ VERIFY( a == b );
}
+
+void
+test03()
+{
+ // The LessThanComparable requirements only require <
+ struct X {
+ bool operator<(const X&) const { return false; }
+ };
+
+ std::forward_list a(2);
+ const auto b = a;
+ VERIFY( !(a < b) );
+ VERIFY( !(a > b) );
+ VERIFY( a <= b );
+ VERIFY( a >= b );
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+}
Index: libstdc++-v3/testsuite/21_strings/basic_string_view/operators/char/89446.cc
===================================================================
--- libstdc++-v3/testsuite/21_strings/basic_string_view/operators/char/89446.cc (.../tags/gcc_7_4_0_release) 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/21_strings/basic_string_view/operators/char/89446.cc (.../branches/gcc-7-branch)
@@ -0,0 +1,28 @@
+// Copyright (C) 2019 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
+// .
+
+// { dg-options "-std=gnu++17 -fexceptions -fnon-call-exceptions -O1" }
+// { dg-do run { target { powerpc*-*-linux* i?86-*-linux* x86_64-*-linux* } } }
+// { dg-require-effective-target c++1z }
+
+#include
+
+int main()
+{
+ std::string_view s1, s2;
+ return s1 != s2;
+}
Index: libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc
===================================================================
--- libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc (.../branches/gcc-7-branch)
@@ -24,6 +24,7 @@
using std::experimental::any;
using std::experimental::any_cast;
+using std::experimental::bad_any_cast;
void test01()
{
@@ -56,7 +57,6 @@
void test02()
{
- using std::experimental::bad_any_cast;
any x(1);
auto p = any_cast(&x);
VERIFY(p == nullptr);
@@ -105,7 +105,7 @@
MoveDeleted&& md3 = any_cast(any(std::move(md)));
}
-void test04()
+void test05()
{
// PR libstdc++/69321
struct noncopyable {
@@ -117,10 +117,60 @@
VERIFY( p == nullptr );
}
+void test06()
+{
+ // The contained value of a std::any is always an object type,
+ // but any_cast does not forbid checking for function types.
+
+ any a(1);
+ void (*p1)() = any_cast(&a);
+ VERIFY( p1 == nullptr );
+ int (*p2)(int) = any_cast(&a);
+ VERIFY( p2 == nullptr );
+ int (*p3)() = any_cast(&const_cast(a));
+ VERIFY( p3 == nullptr );
+
+ try {
+ any_cast(a);
+ VERIFY( false );
+ } catch (const bad_any_cast&) {
+ }
+
+ try {
+ any_cast(std::move(a));
+ VERIFY( false );
+ } catch (const bad_any_cast&) {
+ }
+
+ try {
+ any_cast(const_cast(a));
+ VERIFY( false );
+ } catch (const bad_any_cast&) {
+ }
+}
+
+void test07()
+{
+ int arr[3];
+ any a(arr);
+ VERIFY( a.type() == typeid(int*) ); // contained value is decayed
+
+ int (*p1)[3] = any_cast(&a);
+ VERIFY( a.type() != typeid(int[3]) ); // so any_cast should return nullptr
+ VERIFY( p1 == nullptr );
+ int (*p2)[] = any_cast(&a);
+ VERIFY( a.type() != typeid(int[]) ); // so any_cast should return nullptr
+ VERIFY( p2 == nullptr );
+ const int (*p3)[] = any_cast(&const_cast(a));
+ VERIFY( p3 == nullptr );
+}
+
int main()
{
test01();
test02();
test03();
- test04();
+ test05();
+ test06();
+ test07();
}
Index: libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
===================================================================
--- libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc (.../branches/gcc-7-branch)
@@ -25,5 +25,5 @@
using std::experimental::any_cast;
const any y(1);
- any_cast(y); // { dg-error "qualifiers" "" { target { *-*-* } } 357 }
+ any_cast(y); // { dg-error "qualifiers" "" { target { *-*-* } } 0 }
}
Index: libstdc++-v3/testsuite/experimental/filesystem/path/construct/90634.cc
===================================================================
--- libstdc++-v3/testsuite/experimental/filesystem/path/construct/90634.cc (.../tags/gcc_7_4_0_release) 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/experimental/filesystem/path/construct/90634.cc (.../branches/gcc-7-branch)
@@ -0,0 +1,75 @@
+// Copyright (C) 2019 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
+// .
+
+// { dg-options "-DUSE_FILESYSTEM_TS -lstdc++fs" }
+// { dg-do run { target c++11 } }
+// { dg-require-filesystem-ts "" }
+
+#include
+#include
+#include
+
+std::size_t bytes_allocated = 0;
+
+void* operator new(std::size_t n)
+{
+ bytes_allocated += n;
+ return std::malloc(n);
+}
+
+void operator delete(void* p) noexcept { std::free(p); }
+#if __cpp_sized_deallocation
+void operator delete(void* p, std::size_t) noexcept { std::free(p); }
+#endif
+
+void
+test01()
+{
+#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ std::wstring s0;
+ std::wstring s1 = L"/";
+ std::wstring s2 = L"file";
+ std::wstring s3 = L"C:";
+ std::wstring s4 = L"\\";
+#else
+ std::string s0;
+ std::string s1 = "/";
+ std::string s2 = "file";
+ std::string s3 = "C:";
+ std::string s4 = "\\";
+#endif
+
+ using std::experimental::filesystem::path;
+
+ bytes_allocated = 0;
+ path p0 = std::move(s0);
+ VERIFY( bytes_allocated == 0 );
+ path p1 = std::move(s1);
+ VERIFY( bytes_allocated == 0 );
+ path p2 = std::move(s2);
+ VERIFY( bytes_allocated == 0 );
+ path p3 = std::move(s3);
+ VERIFY( bytes_allocated == 0 );
+ path p4 = std::move(s4);
+ VERIFY( bytes_allocated == 0 );
+}
+
+int
+main()
+{
+ test01();
+}
Index: libstdc++-v3/testsuite/experimental/names.cc
===================================================================
--- libstdc++-v3/testsuite/experimental/names.cc (.../tags/gcc_7_4_0_release) 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/experimental/names.cc (.../branches/gcc-7-branch)
@@ -0,0 +1,57 @@
+// Copyright (C) 2017-2019 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
+// .
+
+// { dg-do compile }
+
+// Define macros for some common variables names that we must not use for
+// naming variables, parameters etc. in the library.
+
+#include "../17_intro/names.cc"
+// Filesystem
+#if __has_include()
+# include
+#endif
+// Library Fundamentals
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
Index: libstdc++-v3/testsuite/17_intro/names.cc
===================================================================
--- libstdc++-v3/testsuite/17_intro/names.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/17_intro/names.cc (.../branches/gcc-7-branch)
@@ -19,7 +19,6 @@
// Define macros for some common variables names that we must not use for
// naming variables, parameters etc. in the library.
-#define tmp (
#define A (
#define B (
#define C (
@@ -99,6 +98,78 @@
#define y (
#define z (
+#define tmp (
+
+#if __cplusplus < 201703L
+// defines to_chars_result::ptr and to_chars_result::ec
+#define ec (
+#define ptr (
+#endif
+
+// Common template parameter names
+#define OutputIterator OutputIterator is not a reserved name
+#define InputIterator InputIterator is not a reserved name
+#define ForwardIterator ForwardIterator is not a reserved name
+#define BidirectionalIterator BidirectionalIterator is not a reserved name
+#define RandomAccessIterator RandomAccessIterator is not a reserved name
+#define RandomAccessOutputIterator RandomAccessOutputIterator is not a reserved name
+#define RAIter RAIter is not a reserved name
+#define FwdIter FwdIter is not a reserved name
+#define OutIter OutIter is not a reserved name
+#define InIter InIter is not a reserved name
+
+#define Alloc Alloc is not a reserved name
+#define BinaryFunction1 BinaryFunction1 is not a reserved name
+#define BinaryFunction2 BinaryFunction2 is not a reserved name
+#define Char Char is not a reserved name
+#define CharT CharT is not a reserved name
+#define Cmp Cmp is not a reserved name
+#define Compare Compare is not a reserved name
+#define Const_Iterator Const_Iterator is not a reserved name
+#define Const_Key_Reference Const_Key_Reference is not a reserved name
+#define Const_Node_Iter Const_Node_Iter is not a reserved name
+#define Const_Pointer Const_Pointer is not a reserved name
+#define Const_Reference Const_Reference is not a reserved name
+#define Data Data is not a reserved name
+#define DiffType DiffType is not a reserved name
+#define Eq Eq is not a reserved name
+#define ExecPolicy ExecPolicy is not a reserved name
+#define Expected Expected is not a reserved name
+#define External_Load_Access External_Load_Access is not a reserved name
+#define External_Size_Access External_Size_Access is not a reserved name
+#define Fn Fn is not a reserved name
+#define Function Function is not a reserved name
+#define Functor Functor is not a reserved name
+#define Hash Hash is not a reserved name
+#define H1 H1 is not a reserved name
+#define H2 H2 is not a reserved name
+#define Head Head is not a reserved name
+#define It It is not a reserved name
+#define Iter Iter is not a reserved name
+#define Iterator Iterator is not a reserved name
+#define Key Key is not a reserved name
+#define Mapped Mapped is not a reserved name
+#define Node Node is not a reserved name
+#define Node_iter Node_iter is not a reserved name
+#define Node_ptr Node_ptr is not a reserved name
+#define Overflow Overflow is not a reserved name
+#define Pointer Pointer is not a reserved name
+#define Policy Policy is not a reserved name
+#define Pred Pred is not a reserved name
+#define Ptr Ptr is not a reserved name
+#define Reference Reference is not a reserved name
+#define Seq Seq is not a reserved name
+#define Seq_RAIter Seq_RAIter is not a reserved name
+#define Series Series is not a reserved name
+#define Set Set is not a reserved name
+#define String String is not a reserved name
+#define Tp Tp is not a reserved name
+#define Traits Traits is not a reserved name
+#define Type Type is not a reserved name
+#define Value Value is not a reserved name
+#define ValueT ValueT is not a reserved name
+#define ValueType ValueType is not a reserved name
+
#ifdef _AIX
// See https://gcc.gnu.org/ml/libstdc++/2017-03/msg00015.html
#undef f
@@ -116,4 +187,9 @@
#undef y
#endif
+#ifdef __sun__
+// See https://gcc.gnu.org/ml/libstdc++/2019-05/msg00175.html
+#undef ptr
+#endif
+
#include
Index: libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
===================================================================
--- libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc (.../branches/gcc-7-branch)
@@ -21,9 +21,9 @@
// Ensure the library only uses the __name__ form for attributes.
// Don't test 'const' and 'noreturn' because they are reserved anyway.
#define abi_tag 1
-#define always_inline 1
#ifndef __APPLE__
// darwin headers use these, see PR 64883
+# define always_inline 1
# define deprecated 1
# define visibility 1
#endif
Index: libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
===================================================================
--- libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc (.../branches/gcc-7-branch)
@@ -21,9 +21,9 @@
// Ensure the library only uses the __name__ form for attributes.
// Don't test 'const' because it is reserved anyway.
#define abi_tag 1
-#define always_inline 1
#ifndef __APPLE__
// darwin headers use these, see PR 64883
+# define always_inline 1
# define deprecated 1
# define noreturn 1
# define visibility 1
Index: libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc
===================================================================
--- libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc (.../branches/gcc-7-branch)
@@ -21,11 +21,11 @@
// Ensure the library only uses the __name__ form for attributes.
// Don't test 'const' and 'noreturn' because they are reserved anyway.
#define abi_tag 1
-#define always_inline 1
#ifndef __APPLE__
// darwin headers use these, see PR 64883
+# define always_inline 1
+# define deprecated 1
# define visibility 1
-# define deprecated 1
#endif
#define packed 1
#define pure 1
Index: libstdc++-v3/testsuite/util/testsuite_hooks.h
===================================================================
--- libstdc++-v3/testsuite/util/testsuite_hooks.h (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/util/testsuite_hooks.h (.../branches/gcc-7-branch)
@@ -46,18 +46,25 @@
#include
#include
#include
+#include
#ifdef _GLIBCXX_HAVE_SYS_STAT_H
#include
#endif
+#ifdef stderr
+# define _VERIFY_PRINT(S, F, L, P, C) __builtin_fprintf(stderr, S, F, L, P, C)
+#else
+# define _VERIFY_PRINT(S, F, L, P, C) __builtin_printf(S, F, L, P, C)
+#endif
+
#define VERIFY(fn) \
do \
{ \
if (! (fn)) \
{ \
- __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", \
- __FILE__, __LINE__, __PRETTY_FUNCTION__, #fn); \
+ _VERIFY_PRINT("%s:%d: %s: Assertion '%s' failed.\n", \
+ __FILE__, __LINE__, __PRETTY_FUNCTION__, #fn); \
__builtin_abort(); \
} \
} while (false)
Index: libstdc++-v3/testsuite/20_util/enable_shared_from_this/89303.cc
===================================================================
--- libstdc++-v3/testsuite/20_util/enable_shared_from_this/89303.cc (.../tags/gcc_7_4_0_release) 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/20_util/enable_shared_from_this/89303.cc (.../branches/gcc-7-branch)
@@ -0,0 +1,39 @@
+// Copyright (C) 2019 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
+// .
+
+// { dg-options "-O1" }
+// { dg-do run { target c++11 } }
+
+// PR middle-end/89303
+
+#include
+
+class blob final: public std::enable_shared_from_this
+{
+ int* data;
+
+public:
+ blob() { data = new int; }
+ ~blob() { delete data; }
+};
+
+int
+main()
+{
+ std::shared_ptr tg = std::make_shared();
+ return tg->shared_from_this().use_count() - 2;
+}
Index: libstdc++-v3/testsuite/20_util/hash/89629.cc
===================================================================
--- libstdc++-v3/testsuite/20_util/hash/89629.cc (.../tags/gcc_7_4_0_release) 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/20_util/hash/89629.cc (.../branches/gcc-7-branch)
@@ -0,0 +1,43 @@
+// Copyright (C) 2019 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
+// .
+
+// { dg-do run { target { lp64 || llp64 } } }
+// { dg-require-effective-target c++11 }
+// { dg-require-effective-target run_expensive_tests }
+
+#include
+#include
+
+void
+test01()
+{
+ const std::size_t big = std::size_t(1) << 31;
+ std::string s;
+ try {
+ s.resize(big, 'a');
+ } catch (const std::bad_alloc&) {
+ return; // try to avoid a FAIL if memory allocation fails
+ }
+ // PR libstdc++/89629
+ (void) std::hash{}(s);
+}
+
+int
+main()
+{
+ test01();
+}
Index: libstdc++-v3/testsuite/20_util/any/misc/any_cast.cc
===================================================================
--- libstdc++-v3/testsuite/20_util/any/misc/any_cast.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/20_util/any/misc/any_cast.cc (.../branches/gcc-7-branch)
@@ -20,6 +20,7 @@
#include
#include
+#include
#include
#include
@@ -130,6 +131,54 @@
VERIFY( p == nullptr );
}
+void test06()
+{
+ // The contained value of a std::any is always an object type,
+ // but std::any_cast does not forbid checking for function types.
+
+ any a(1);
+ void (*p1)() = any_cast(&a);
+ VERIFY( p1 == nullptr );
+ int (*p2)(int) = any_cast(&a);
+ VERIFY( p2 == nullptr );
+ int (*p3)() = any_cast(&std::as_const(a));
+ VERIFY( p3 == nullptr );
+
+ try {
+ any_cast(a);
+ VERIFY( false );
+ } catch (const std::bad_any_cast&) {
+ }
+
+ try {
+ any_cast(std::move(a));
+ VERIFY( false );
+ } catch (const std::bad_any_cast&) {
+ }
+
+ try {
+ any_cast(std::as_const(a));
+ VERIFY( false );
+ } catch (const std::bad_any_cast&) {
+ }
+}
+
+void test07()
+{
+ int arr[3];
+ any a(arr);
+ VERIFY( a.type() == typeid(int*) ); // contained value is decayed
+
+ int (*p1)[3] = any_cast(&a);
+ VERIFY( a.type() != typeid(int[3]) ); // so any_cast should return nullptr
+ VERIFY( p1 == nullptr );
+ int (*p2)[] = any_cast(&a);
+ VERIFY( a.type() != typeid(int[]) ); // so any_cast should return nullptr
+ VERIFY( p2 == nullptr );
+ const int (*p3)[] = any_cast(&std::as_const(a));
+ VERIFY( p3 == nullptr );
+}
+
int main()
{
test01();
@@ -137,4 +186,6 @@
test03();
test04();
test05();
+ test06();
+ test07();
}
Index: libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc
===================================================================
--- libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc (.../branches/gcc-7-branch)
@@ -39,7 +39,7 @@
std::unique_ptr cA3(p); // { dg-error "no matching function" }
std::unique_ptr vA3(p); // { dg-error "no matching function" }
std::unique_ptr cvA3(p); // { dg-error "no matching function" }
- // { dg-error "no type" "" { target *-*-* } 467 }
+ // { dg-prune-output "no type" }
}
template
Index: libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc
===================================================================
--- libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc (.../branches/gcc-7-branch)
@@ -42,10 +42,9 @@
std::unique_ptr ud(nullptr, d);
ub = std::move(ud); // { dg-error "no match" }
ub2 = ud; // { dg-error "no match" }
-// { dg-error "no type" "" { target *-*-* } 301 }
std::unique_ptr uba(nullptr, b);
std::unique_ptr uda(nullptr, d);
uba = std::move(uda); // { dg-error "no match" }
-// { dg-error "no type" "" { target *-*-* } 560 }
}
+// { dg-prune-output "no type" }
Index: libstdc++-v3/testsuite/20_util/unique_ptr/assign/91308.cc
===================================================================
--- libstdc++-v3/testsuite/20_util/unique_ptr/assign/91308.cc (.../tags/gcc_7_4_0_release) 1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/20_util/unique_ptr/assign/91308.cc (.../branches/gcc-7-branch)
@@ -0,0 +1,46 @@
+// Copyright (C) 2019 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
+// .
+
+// { dg-do compile { target c++11 } }
+
+#include
+
+struct D1
+{
+ void operator()(int* p) const noexcept { }
+};
+
+struct D2 : D1
+{
+ D2& operator=(D1&&) noexcept { return *this; }
+};
+
+void
+test01()
+{
+ std::unique_ptr d1;
+ std::unique_ptr d2;
+ d2 = std::move(d1);
+}
+
+void
+test02()
+{
+ std::unique_ptr d1;
+ std::unique_ptr d2;
+ d2 = std::move(d1);
+}
Index: libstdc++-v3/acinclude.m4
===================================================================
--- libstdc++-v3/acinclude.m4 (.../tags/gcc_7_4_0_release)
+++ libstdc++-v3/acinclude.m4 (.../branches/gcc-7-branch)
@@ -642,28 +642,27 @@
dnl
AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [
-AC_MSG_CHECKING([for docbook stylesheets for documentation creation])
-glibcxx_stylesheets=no
-if test x${XSLTPROC} = xyes && echo '' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then
- glibcxx_stylesheets=yes
-fi
-AC_MSG_RESULT($glibcxx_stylesheets)
+glibcxx_docbook_url=http://docbook.sourceforge.net/release/xsl-ns/current/
AC_MSG_CHECKING([for local stylesheet directory])
glibcxx_local_stylesheets=no
-if test x"$glibcxx_stylesheets" = x"yes"; then
- if test -d /usr/share/sgml/docbook/xsl-ns-stylesheets; then
- glibcxx_local_stylesheets=yes
- XSL_STYLE_DIR=/usr/share/sgml/docbook/xsl-ns-stylesheets
- fi
- if test -d /usr/share/xml/docbook/stylesheet/docbook-xsl-ns; then
- glibcxx_local_stylesheets=yes
- XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
- fi
- if test -d /usr/share/xml/docbook/stylesheet/nwalsh5/current; then
- glibcxx_local_stylesheets=yes
- XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/nwalsh5/current
- fi
+if test x${XMLCATALOG} = xyes && xsl_style_dir=`xmlcatalog "" $glibcxx_docbook_url 2>/dev/null`
+then
+ XSL_STYLE_DIR=`echo $xsl_style_dir | sed -n 's;^file://;;p'`
+ glibcxx_local_stylesheets=yes
+else
+ for dir in \
+ /usr/share/sgml/docbook/xsl-ns-stylesheets \
+ /usr/share/xml/docbook/stylesheet/docbook-xsl-ns \
+ /usr/share/xml/docbook/stylesheet/nwalsh5/current \
+ /usr/share/xml/docbook/stylesheet/nwalsh/current
+ do
+ if test -d $dir; then
+ glibcxx_local_stylesheets=yes
+ XSL_STYLE_DIR=$dir
+ break
+ fi
+ done
fi
AC_MSG_RESULT($glibcxx_local_stylesheets)
@@ -670,6 +669,16 @@
if test x"$glibcxx_local_stylesheets" = x"yes"; then
AC_SUBST(XSL_STYLE_DIR)
AC_MSG_NOTICE($XSL_STYLE_DIR)
+
+ AC_MSG_CHECKING([for docbook stylesheets for documentation creation])
+ glibcxx_stylesheets=no
+ if test x${XMLCATALOG} = xno || xmlcatalog "" $glibcxx_docbook_url/xhtml/docbook.xsl >/dev/null 2>&1; then
+ if test x${XSLTPROC} = xyes && echo '' | xsltproc --noout --nonet --xinclude $glibcxx_docbook_url/xhtml/docbook.xsl - 2>/dev/null; then
+ glibcxx_stylesheets=yes
+ fi
+ fi
+ AC_MSG_RESULT($glibcxx_stylesheets)
+
else
glibcxx_stylesheets=no
fi
Index: libiberty/simple-object-elf.c
===================================================================
--- libiberty/simple-object-elf.c (.../tags/gcc_7_4_0_release)
+++ libiberty/simple-object-elf.c (.../branches/gcc-7-branch)
@@ -479,6 +479,14 @@
return NULL;
}
+ if (eor->shstrndx == 0)
+ {
+ *errmsg = "invalid ELF shstrndx == 0";
+ *err = 0;
+ XDELETE (eor);
+ return NULL;
+ }
+
return (void *) eor;
}
Index: libiberty/ChangeLog
===================================================================
--- libiberty/ChangeLog (.../tags/gcc_7_4_0_release)
+++ libiberty/ChangeLog (.../branches/gcc-7-branch)
@@ -1,3 +1,12 @@
+2019-07-25 Richard Biener
+
+ PR lto/90924
+ Backport from mainline
+ 2019-07-12 Ren Kimura
+
+ * simple-object-elf.c (simple_object_elf_match): Check zero value
+ shstrndx.
+
2018-12-06 Release Manager
* GCC 7.4.0 released.
Index: contrib/ChangeLog
===================================================================
--- contrib/ChangeLog (.../tags/gcc_7_4_0_release)
+++ contrib/ChangeLog (.../branches/gcc-7-branch)
@@ -1,3 +1,7 @@
+2019-08-16 Uros Bizjak
+
+ * test_summary: Do not escape "=".
+
2018-12-06 Release Manager
* GCC 7.4.0 released.
Index: contrib/test_summary
===================================================================
--- contrib/test_summary (.../tags/gcc_7_4_0_release)
+++ contrib/test_summary (.../branches/gcc-7-branch)
@@ -126,7 +126,7 @@
if (lang == "") lang = " "$2" "; else lang = " ";
}
$2 == "version" { save = $0; $1 = ""; $2 = ""; version = $0; gsub(/^ */, "", version); gsub(/\r$/, "", version); $0 = save; }
-/\===.*Summary/ { print ""; print; blanks=1; }
+/===.*Summary/ { print ""; print; blanks=1; }
/tests ===/ || /^(Target|Host|Native)/ || $2 == "version" { print; blanks=1; }
/^(XPASS|FAIL|UNRESOLVED|WARNING|ERROR|# of )/ { sub ("\r", ""); print; }
/^using:/ { print ""; print; print ""; }
Index: libgcc/ChangeLog
===================================================================
--- libgcc/ChangeLog (.../tags/gcc_7_4_0_release)
+++ libgcc/ChangeLog (.../branches/gcc-7-branch)
@@ -1,3 +1,18 @@
+2019-09-04 Iain Sandoe
+
+ Backport from mainline.
+ 2019-06-06 Iain Sandoe
+
+ * config/rs6000/t-darwin: Ensure that the unwinder is built with
+ altivec enabled.
+
+2019-09-03 Iain Sandoe
+
+ Backport from mainline.
+ 2019-05-12 Iain Sandoe
+
+ * config/rs6000/darwin-vecsave.S: Set .machine appropriately.
+
2018-12-06 Release Manager
* GCC 7.4.0 released.
Index: libgcc/config/rs6000/t-darwin
===================================================================
--- libgcc/config/rs6000/t-darwin (.../tags/gcc_7_4_0_release)
+++ libgcc/config/rs6000/t-darwin (.../branches/gcc-7-branch)
@@ -20,4 +20,7 @@
# earlier OSX versions.
HOST_LIBGCC2_CFLAGS += -Wa,-force_cpusubtype_ALL -mmacosx-version-min=10.4
+unwind-dw2_s.o: HOST_LIBGCC2_CFLAGS += -maltivec
+unwind-dw2.o: HOST_LIBGCC2_CFLAGS += -maltivec
+
LIB2ADDEH += $(srcdir)/config/rs6000/darwin-fallback.c
Index: libgcc/config/rs6000/darwin-vecsave.S
===================================================================
--- libgcc/config/rs6000/darwin-vecsave.S (.../tags/gcc_7_4_0_release)
+++ libgcc/config/rs6000/darwin-vecsave.S (.../branches/gcc-7-branch)
@@ -31,8 +31,14 @@
(4 bytes) to do the operation; for Vector regs, 2 instructions are
required (8 bytes.). */
+/* With some assemblers, we need the correct machine directive to get the
+ right CPU type / subtype in the file header. */
+#if __ppc64__
+ .machine ppc64
+#else
.machine ppc7400
-.text
+#endif
+ .text
.align 2
.private_extern saveVEC
Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi (.../tags/gcc_7_4_0_release)
+++ gcc/doc/sourcebuild.texi (.../branches/gcc-7-branch)
@@ -1273,6 +1273,16 @@
specified for the particular test in an earlier @code{dg-options} or
@code{dg-add-options} directive.
+@subsubsection Endianness
+
+@table @code
+@item be
+Target uses big-endian memory order for multi-byte and multi-word data.
+
+@item le
+Target uses little-endian memory order for multi-byte and multi-word data.
+@end table
+
@subsubsection Data type sizes
@table @code
Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi (.../tags/gcc_7_4_0_release)
+++ gcc/doc/extend.texi (.../branches/gcc-7-branch)
@@ -7710,7 +7710,7 @@
A basic @code{asm} statement has the following syntax:
@example
-asm @r{[} volatile @r{]} ( @var{AssemblerInstructions} )
+asm @var{asm-qualifiers} ( @var{AssemblerInstructions} )
@end example
The @code{asm} keyword is a GNU extension.
@@ -7723,6 +7723,10 @@
@item volatile
The optional @code{volatile} qualifier has no effect.
All basic @code{asm} blocks are implicitly volatile.
+
+@item inline
+If you use the @code{inline} qualifier, then for inlining purposes the size
+of the asm is taken as the smallest size possible (@pxref{Size of an asm}).
@end table
@subsubheading Parameters
@@ -7838,17 +7842,19 @@
the operand parameters after the assembler template:
@example
-asm @r{[}volatile@r{]} ( @var{AssemblerTemplate}
+asm @var{asm-qualifiers} ( @var{AssemblerTemplate}
: @var{OutputOperands}
@r{[} : @var{InputOperands}
@r{[} : @var{Clobbers} @r{]} @r{]})
-asm @r{[}volatile@r{]} goto ( @var{AssemblerTemplate}
+asm @var{asm-qualifiers} ( @var{AssemblerTemplate}
:
: @var{InputOperands}
: @var{Clobbers}
: @var{GotoLabels})
@end example
+where in the last form, @var{asm-qualifiers} contains @code{goto} (and in the
+first form, not).
The @code{asm} keyword is a GNU extension.
When writing code that can be compiled with @option{-ansi} and the
@@ -7864,6 +7870,10 @@
also produce side effects. If so, you may need to use the @code{volatile}
qualifier to disable certain optimizations. @xref{Volatile}.
+@item inline
+If you use the @code{inline} qualifier, then for inlining purposes the size
+of the asm is taken as the smallest size possible (@pxref{Size of an asm}).
+
@item goto
This qualifier informs the compiler that the @code{asm} statement may
perform a jump to one of the labels listed in the @var{GotoLabels}.
@@ -9146,7 +9156,7 @@
@code{asm} and multiplying that by the length of the longest
instruction supported by that processor. (When working out the number
of instructions, it assumes that any occurrence of a newline or of
-whatever statement separator character is supported by the assembler --
+whatever statement separator character is supported by the assembler ---
typically @samp{;} --- indicates the end of an instruction.)
Normally, GCC's estimate is adequate to ensure that correct
@@ -9157,6 +9167,11 @@
If this happens then the assembler may produce a diagnostic saying that
a label is unreachable.
+@cindex @code{asm inline}
+This size is also used for inlining decisions. If you use @code{asm inline}
+instead of just @code{asm}, then for inlining purposes the size of the asm
+is taken as the minimum size, ignoring how many instructions GCC thinks it is.
+
@node Alternate Keywords
@section Alternate Keywords
@cindex alternate keywords
@@ -15566,9 +15581,32 @@
@item
GCC allows using a @code{typedef} name as the type specifier for a
-vector type.
+vector type, but only under the following circumstances:
+@itemize @bullet
+
@item
+When using @code{__vector} instead of @code{vector}; for example,
+
+@smallexample
+typedef signed short int16;
+__vector int16 data;
+@end smallexample
+
+@item
+When using @code{vector} in keyword-and-predefine mode; for example,
+
+@smallexample
+typedef signed short int16;
+vector int16 data;
+@end smallexample
+
+Note that keyword-and-predefine mode is enabled by disabling GNU
+extensions (e.g., by using @code{-std=c11}) and including
+@code{}.
+@end itemize
+
+@item
For C, overloaded functions are implemented with macros so the following
does not work:
@@ -15734,6 +15772,8 @@
vector float vec_and (vector float, vector float);
vector float vec_and (vector float, vector bool int);
vector float vec_and (vector bool int, vector float);
+vector bool long long vec_and (vector bool long long int,
+ vector bool long long);
vector bool int vec_and (vector bool int, vector bool int);
vector signed int vec_and (vector bool int, vector signed int);
vector signed int vec_and (vector signed int, vector bool int);
@@ -16663,6 +16703,13 @@
vector bool char vec_sld (vector bool char,
vector bool char,
const int);
+vector bool long long int vec_sld (vector bool long long int,
+ vector bool long long int, const int);
+vector long long int vec_sld (vector long long int,
+ vector long long int, const int);
+vector unsigned long long int vec_sld (vector unsigned long long int,
+ vector unsigned long long int,
+ const int);
vector signed int vec_sll (vector signed int,
vector unsigned int);
@@ -16694,6 +16741,10 @@
vector unsigned short);
vector unsigned short vec_sll (vector unsigned short,
vector unsigned char);
+vector long long int vec_sll (vector long long int,
+ vector unsigned char);
+vector unsigned long long int vec_sll (vector unsigned long long int,
+ vector unsigned char);
vector bool short vec_sll (vector bool short, vector unsigned int);
vector bool short vec_sll (vector bool short, vector unsigned short);
vector bool short vec_sll (vector bool short, vector unsigned char);
@@ -16846,6 +16897,10 @@
vector unsigned short);
vector unsigned short vec_srl (vector unsigned short,
vector unsigned char);
+vector long long int vec_srl (vector long long int,
+ vector unsigned char);
+vector unsigned long long int vec_srl (vector unsigned long long int,
+ vector unsigned char);
vector bool short vec_srl (vector bool short, vector unsigned int);
vector bool short vec_srl (vector bool short, vector unsigned short);
vector bool short vec_srl (vector bool short, vector unsigned char);
@@ -16877,6 +16932,14 @@
vector signed char);
vector unsigned short vec_sro (vector unsigned short,
vector unsigned char);
+vector long long int vec_sro (vector long long int,
+ vector char);
+vector long long int vec_sro (vector long long int,
+ vector unsigned char);
+vector unsigned long long int vec_sro (vector unsigned long long int,
+ vector char);
+vector unsigned long long int vec_sro (vector unsigned long long int,
+ vector unsigned char);
vector pixel vec_sro (vector pixel, vector signed char);
vector pixel vec_sro (vector pixel, vector unsigned char);
vector signed char vec_sro (vector signed char, vector signed char);
@@ -17112,6 +17175,7 @@
vector signed int vec_unpackh (vector signed short);
vector bool int vec_unpackh (vector bool short);
vector unsigned int vec_unpackh (vector pixel);
+vector double vec_unpackh (vector float);
vector bool int vec_vupkhsh (vector bool short);
vector signed int vec_vupkhsh (vector signed short);
@@ -17126,6 +17190,7 @@
vector unsigned int vec_unpackl (vector pixel);
vector signed int vec_unpackl (vector signed short);
vector bool int vec_unpackl (vector bool short);
+vector double vec_unpackl (vector float);
vector unsigned int vec_vupklpx (vector pixel);
@@ -17485,6 +17550,10 @@
vector long vec_div (vector long, vector long);
vector unsigned long vec_div (vector unsigned long, vector unsigned long);
vector double vec_floor (vector double);
+vector signed long long vec_ld (int, const vector signed long long *);
+vector signed long long vec_ld (int, const signed long long *);
+vector unsigned long long vec_ld (int, const vector unsigned long long *);
+vector unsigned long long vec_ld (int, const unsigned long long *);
vector double vec_ld (int, const vector double *);
vector double vec_ld (int, const double *);
vector double vec_ldl (int, const vector double *);
@@ -17557,6 +17626,13 @@
vector unsigned long vec_splats (unsigned long);
vector float vec_sqrt (vector float);
vector double vec_sqrt (vector double);
+void vec_st (vector signed long long, int, vector signed long long *);
+void vec_st (vector signed long long, int, signed long long *);
+void vec_st (vector unsigned long long, int, vector unsigned long long *);
+void vec_st (vector unsigned long long, int, unsigned long long *);
+void vec_st (vector bool long long, int, vector bool long long *);
+void vec_st (vector bool long long, int, signed long long *);
+void vec_st (vector bool long long, int, unsigned long long *);
void vec_st (vector double, int, vector double *);
void vec_st (vector double, int, double *);
vector double vec_sub (vector double, vector double);
@@ -17874,9 +17950,18 @@
vector unsigned int vec_packs (vector unsigned long long,
vector unsigned long long);
+test_vsi_packsu_vssi_vssi (vector signed short x,
+
+vector unsigned char vec_packsu (vector signed short, vector signed short )
+vector unsigned char vec_packsu (vector unsigned short, vector unsigned short )
+vector unsigned short int vec_packsu (vector signed int, vector signed int);
+vector unsigned short int vec_packsu (vector unsigned int,
+ vector unsigned int);
vector unsigned int vec_packsu (vector long long, vector long long);
vector unsigned int vec_packsu (vector unsigned long long,
vector unsigned long long);
+vector unsigned int vec_packsu (vector signed long long,
+ vector signed long long);
vector long long vec_rl (vector long long,
vector unsigned long long);
@@ -18094,10 +18179,25 @@
vector unsigned char);
vector bool char vec_cmpne (vector bool char, vector bool char);
-vector bool short vec_cmpne (vector bool short, vector bool short);
+vector bool char vec_cmpne (vector signed char, vector signed char);
+vector bool char vec_cmpne (vector unsigned char, vector unsigned char);
vector bool int vec_cmpne (vector bool int, vector bool int);
+vector bool int vec_cmpne (vector signed int, vector signed int);
+vector bool int vec_cmpne (vector unsigned int, vector unsigned int);
vector bool long long vec_cmpne (vector bool long long, vector bool long long);
+vector bool long long vec_cmpne (vector signed long long,
+ vector signed long long);
+vector bool long long vec_cmpne (vector unsigned long long,
+ vector unsigned long long);
+vector bool short vec_cmpne (vector bool short, vector bool short);
+vector bool short vec_cmpne (vector signed short, vector signed short);
+vector bool short vec_cmpne (vector unsigned short, vector unsigned short);
+vector bool long long vec_cmpne (vector double, vector double);
+vector bool int vec_cmpne (vector float, vector float);
+vector float vec_extract_fp32_from_shorth (vector unsigned short);
+vector float vec_extract_fp32_from_shortl (vector unsigned short);
+
vector long long vec_vctz (vector long long);
vector unsigned long long vec_vctz (vector unsigned long long);
vector int vec_vctz (vector int);
@@ -18371,20 +18471,33 @@
@smallexample
vector unsigned long long __builtin_crypto_vsbox (vector unsigned long long);
+vector unsigned char vec_sbox_be (vector unsigned char);
+
vector unsigned long long __builtin_crypto_vcipher (vector unsigned long long,
vector unsigned long long);
+vector unsigned char vec_cipher_be (vector unsigned char, vector unsigned char);
+
vector unsigned long long __builtin_crypto_vcipherlast
(vector unsigned long long,
vector unsigned long long);
+vector unsigned char vec_cipherlast_be (vector unsigned char,
+ vector unsigned char);
+
vector unsigned long long __builtin_crypto_vncipher (vector unsigned long long,
vector unsigned long long);
+vector unsigned char vec_ncipher_be (vector unsigned char,
+ vector unsigned char);
+
vector unsigned long long __builtin_crypto_vncipherlast
(vector unsigned long long,
vector unsigned long long);
+vector unsigned char vec_ncipherlast_be (vector unsigned char,
+ vector unsigned char);
+
vector unsigned char __builtin_crypto_vpermxor (vector unsigned char,
vector unsigned char,
vector unsigned char);
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (.../tags/gcc_7_4_0_release)
+++ gcc/doc/invoke.texi (.../branches/gcc-7-branch)
@@ -7136,14 +7136,16 @@
@item -Os
@opindex Os
Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
-do not typically increase code size. It also performs further
-optimizations designed to reduce code size.
+do not typically increase code size.
@option{-Os} disables the following optimization flags:
@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
--falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
--freorder-blocks-and-partition -fprefetch-loop-arrays}
+-falign-labels -fprefetch-loop-arrays}
+It also enables @option{-finline-functions}, causes the compiler to tune for
+code size rather than execution speed, and performs further optimizations
+designed to reduce code size.
+
@item -Ofast
@opindex Ofast
Disregard strict standards compliance. @option{-Ofast} enables all
@@ -7261,7 +7263,7 @@
in this way. This inlining applies to all functions, even those not declared
inline.
-Enabled at level @option{-O2}.
+Enabled at level @option{-O2}, @option{-O3}, @option{-Os}.
@item -findirect-inlining
@opindex findirect-inlining
@@ -7270,7 +7272,7 @@
when inlining itself is turned on by the @option{-finline-functions}
or @option{-finline-small-functions} options.
-Enabled at level @option{-O2}.
+Enabled at level @option{-O2}, @option{-O3}, @option{-Os}.
@item -finline-functions
@opindex finline-functions
@@ -7282,7 +7284,8 @@
declared @code{static}, then the function is normally not output as
assembler code in its own right.
-Enabled at level @option{-O3}.
+Enabled at levels @option{-O3}, @option{-Os}. Also enabled
+by @option{-fprofile-use} and @option{-fauto-profile}.
@item -finline-functions-called-once
@opindex finline-functions-called-once
@@ -21937,12 +21940,14 @@
@item -mabi=ibmlongdouble
@opindex mabi=ibmlongdouble
Change the current ABI to use IBM extended-precision long double.
-This is a PowerPC 32-bit SYSV ABI option.
+This is a PowerPC 32-bit SYSV ABI option. Requires @option{-mlong-double-128}
+to be enabled.
@item -mabi=ieeelongdouble
@opindex mabi=ieeelongdouble
Change the current ABI to use IEEE extended-precision long double.
-This is a PowerPC 32-bit Linux ABI option.
+This is a PowerPC 32-bit Linux ABI option. Requires @option{-mlong-double-128}
+to be enabled.
@item -mabi=elfv1
@opindex mabi=elfv1
Index: gcc/tree-complex.c
===================================================================
--- gcc/tree-complex.c (.../tags/gcc_7_4_0_release)
+++ gcc/tree-complex.c (.../branches/gcc-7-branch)
@@ -75,6 +75,9 @@
non-SSA_NAME/non-invariant args that need to be replaced by SSA_NAMEs. */
static vec phis_to_revisit;
+/* BBs that need EH cleanup. */
+static bitmap need_eh_cleanup;
+
/* Lookup UID in the complex_variable_components hashtable and return the
associated tree. */
static tree
@@ -690,13 +693,12 @@
static void
update_complex_assignment (gimple_stmt_iterator *gsi, tree r, tree i)
{
- gimple *stmt;
-
+ gimple *old_stmt = gsi_stmt (*gsi);
gimple_assign_set_rhs_with_ops (gsi, COMPLEX_EXPR, r, i);
- stmt = gsi_stmt (*gsi);
+ gimple *stmt = gsi_stmt (*gsi);
update_stmt (stmt);
- if (maybe_clean_eh_stmt (stmt))
- gimple_purge_dead_eh_edges (gimple_bb (stmt));
+ if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt))
+ bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index);
if (gimple_in_ssa_p (cfun))
update_complex_components (gsi, gsi_stmt (*gsi), r, i);
@@ -1451,6 +1453,8 @@
}
update_stmt (stmt);
+ if (maybe_clean_eh_stmt (stmt))
+ bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index);
}
/* Expand inline asm that sets some complex SSA_NAMEs. */
@@ -1668,6 +1672,8 @@
init_parameter_lattice_values ();
ssa_propagate (complex_visit_stmt, complex_visit_phi);
+ need_eh_cleanup = BITMAP_ALLOC (NULL);
+
complex_variable_components = new int_tree_htab_type (10);
complex_ssa_name_components.create (2 * num_ssa_names);
@@ -1711,11 +1717,15 @@
gsi_commit_edge_inserts ();
+ unsigned todo
+ = gimple_purge_all_dead_eh_edges (need_eh_cleanup) ? TODO_cleanup_cfg : 0;
+ BITMAP_FREE (need_eh_cleanup);
+
delete complex_variable_components;
complex_variable_components = NULL;
complex_ssa_name_components.release ();
complex_lattice_values.release ();
- return 0;
+ return todo;
}
namespace {
Index: gcc/ipa-icf-gimple.c
===================================================================
--- gcc/ipa-icf-gimple.c (.../tags/gcc_7_4_0_release)
+++ gcc/ipa-icf-gimple.c (.../branches/gcc-7-branch)
@@ -994,6 +994,9 @@
if (gimple_asm_input_p (g1) != gimple_asm_input_p (g2))
return false;
+ if (gimple_asm_inline_p (g1) != gimple_asm_inline_p (g2))
+ return false;
+
if (gimple_asm_ninputs (g1) != gimple_asm_ninputs (g2))
return false;
Index: gcc/opts-common.c
===================================================================
--- gcc/opts-common.c (.../tags/gcc_7_4_0_release)
+++ gcc/opts-common.c (.../branches/gcc-7-branch)
@@ -438,7 +438,8 @@
extra_args = 0;
- opt_index = find_opt (argv[0] + 1, lang_mask);
+ const char *opt_value = argv[0] + 1;
+ opt_index = find_opt (opt_value, lang_mask);
i = 0;
while (opt_index == OPT_SPECIAL_unknown
&& i < ARRAY_SIZE (option_map))
@@ -641,7 +642,24 @@
/* Check if this is a switch for a different front end. */
if (!option_ok_for_language (option, lang_mask))
errors |= CL_ERR_WRONG_LANG;
+ else if (strcmp (option->opt_text, "-Werror=") == 0
+ && strchr (opt_value, ',') == NULL)
+ {
+ /* Verify that -Werror argument is a valid warning
+ for a language. */
+ char *werror_arg = xstrdup (opt_value + 6);
+ werror_arg[0] = 'W';
+ size_t warning_index = find_opt (werror_arg, lang_mask);
+ if (warning_index != OPT_SPECIAL_unknown)
+ {
+ const struct cl_option *warning_option
+ = &cl_options[warning_index];
+ if (!option_ok_for_language (warning_option, lang_mask))
+ errors |= CL_ERR_WRONG_LANG;
+ }
+ }
+
/* Convert the argument to lowercase if appropriate. */
if (arg && option->cl_tolower)
{
Index: gcc/c-family/ChangeLog
===================================================================
--- gcc/c-family/ChangeLog (.../tags/gcc_7_4_0_release)
+++ gcc/c-family/ChangeLog (.../branches/gcc-7-branch)
@@ -1,3 +1,36 @@
+2019-09-05 Iain Sandoe
+
+ Backport from mainline
+ 2019-08-23 Iain Sandoe
+
+ PR pch/61250
+ * c-lex.c (c_lex_with_flags): Don't call
+ c_common_no_more_pch () from here.
+
+2019-08-30 Richard Biener
+
+ Backport from mainline
+ 2019-05-15 Richard Biener
+
+ PR c/90474
+ * c-common.c (c_common_mark_addressable_vec): Also mark
+ a COMPOUND_LITERAL_EXPR_DECL addressable similar to
+ c_mark_addressable.
+
+2019-08-30 Jakub Jelinek
+
+ Backported from mainline
+ 2019-06-25 Jakub Jelinek
+
+ PR sanitizer/90954
+ * c-omp.c (c_finish_omp_atomic): Allow tree_invariant_p in addition
+ to SAVE_EXPR in first operand of a COMPOUND_EXPR.
+
+2019-04-09 Eric Botcazou
+
+ * c-ada-spec.c (print_destructor): Deal with deleting destructors.
+ (dump_ada_declaration) : Likewise.
+
2018-12-06 Release Manager
* GCC 7.4.0 released.
Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c (.../tags/gcc_7_4_0_release)
+++ gcc/c-family/c-common.c (.../branches/gcc-7-branch)
@@ -6529,6 +6529,8 @@
return;
if (!VAR_P (t) || !DECL_HARD_REGISTER (t))
TREE_ADDRESSABLE (t) = 1;
+ if (TREE_CODE (t) == COMPOUND_LITERAL_EXPR)
+ TREE_ADDRESSABLE (COMPOUND_LITERAL_EXPR_DECL (t)) = 1;
}
Index: gcc/c-family/c-lex.c
===================================================================
--- gcc/c-family/c-lex.c (.../tags/gcc_7_4_0_release)
+++ gcc/c-family/c-lex.c (.../branches/gcc-7-branch)
@@ -387,7 +387,6 @@
c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags,
int lex_flags)
{
- static bool no_more_pch;
const cpp_token *tok;
enum cpp_ttype type;
unsigned char add_flags = 0;
@@ -621,12 +620,6 @@
if (cpp_flags)
*cpp_flags = tok->flags | add_flags;
- if (!no_more_pch)
- {
- no_more_pch = true;
- c_common_no_more_pch ();
- }
-
timevar_pop (TV_CPP);
return type;
Index: gcc/c-family/c-omp.c
===================================================================
--- gcc/c-family/c-omp.c (.../tags/gcc_7_4_0_release)
+++ gcc/c-family/c-omp.c (.../branches/gcc-7-branch)
@@ -256,7 +256,7 @@
if (TREE_CODE (x) == COMPOUND_EXPR)
{
pre = TREE_OPERAND (x, 0);
- gcc_assert (TREE_CODE (pre) == SAVE_EXPR);
+ gcc_assert (TREE_CODE (pre) == SAVE_EXPR || tree_invariant_p (pre));
x = TREE_OPERAND (x, 1);
}
gcc_assert (TREE_CODE (x) == MODIFY_EXPR);
Index: gcc/c-family/c-ada-spec.c
===================================================================
--- gcc/c-family/c-ada-spec.c (.../tags/gcc_7_4_0_release)
+++ gcc/c-family/c-ada-spec.c (.../branches/gcc-7-branch)
@@ -2663,6 +2663,8 @@
tree decl_name = DECL_NAME (DECL_ORIGIN (t));
pp_string (buffer, "Delete_");
+ if (strncmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__del", 5) == 0)
+ pp_string (buffer, "And_Free_");
pp_ada_tree_identifier (buffer, decl_name, t, false);
}
@@ -2915,8 +2917,9 @@
if (DECL_ARTIFICIAL (t))
return 0;
- /* Only consider constructors/destructors for complete objects. */
- if (strncmp (IDENTIFIER_POINTER (decl_name), "__comp", 6) != 0)
+ /* Only consider complete constructors and deleting destructors. */
+ if (strncmp (IDENTIFIER_POINTER (decl_name), "__comp", 6) != 0
+ && strncmp (IDENTIFIER_POINTER (decl_name), "__del", 5) != 0)
return 0;
}
Index: gcc/tree-loop-distribution.c
===================================================================
--- gcc/tree-loop-distribution.c (.../tags/gcc_7_4_0_release)
+++ gcc/tree-loop-distribution.c (.../branches/gcc-7-branch)
@@ -64,6 +64,7 @@
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
#include "tree-vectorizer.h"
+#include "tree-eh.h"
/* A Reduced Dependence Graph (RDG) vertex representing a statement. */
@@ -815,6 +816,7 @@
nb_bytes = build_size_arg_loc (loc, partition->main_dr, partition->niter,
partition->plus_one);
+ nb_bytes = rewrite_to_non_trapping_overflow (nb_bytes);
nb_bytes = force_gimple_operand_gsi (&gsi, nb_bytes, true, NULL_TREE,
false, GSI_CONTINUE_LINKING);
mem = build_addr_arg_loc (loc, partition->main_dr, nb_bytes);
@@ -871,6 +873,7 @@
nb_bytes = build_size_arg_loc (loc, partition->main_dr, partition->niter,
partition->plus_one);
+ nb_bytes = rewrite_to_non_trapping_overflow (nb_bytes);
nb_bytes = force_gimple_operand_gsi (&gsi, nb_bytes, true, NULL_TREE,
false, GSI_CONTINUE_LINKING);
dest = build_addr_arg_loc (loc, partition->main_dr, nb_bytes);
Index: gcc/c/ChangeLog
===================================================================
--- gcc/c/ChangeLog (.../tags/gcc_7_4_0_release)
+++ gcc/c/ChangeLog (.../branches/gcc-7-branch)
@@ -1,3 +1,100 @@
+2019-09-05 Iain Sandoe
+
+ Backport from mainline.
+ 2019-08-23 Iain Sandoe
+
+ PR pch/61250
+ * c-parser.c (c_parse_file): Call c_common_no_more_pch ()
+ after determining that the first token is not
+ PRAGMA_GCC_PCH_PREPROCESS.
+
+2019-08-30 Jakub Jelinek
+
+ Backported from mainline
+ 2019-04-19 Jakub Jelinek
+
+ PR c++/90108
+ * c-decl.c (merge_decls): If remove is main variant and
+ DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
+ variant that has newdecl as TYPE_NAME if any.
+
+ 2019-04-12 Jakub Jelinek
+
+ PR c/89933
+ * c-decl.c (merge_decls): When newdecl's type is its main variant,
+ don't try to remove it from the variant list, but instead assert
+ it has no variants.
+
+ 2019-03-19 Jakub Jelinek
+
+ PR c/89734
+ * c-decl.c (grokdeclarator): Call c_build_qualified_type on function
+ return type even if quals_used is 0. Formatting fixes.
+
+2019-01-16 Joseph Myers
+
+ Backport from mainline
+ 2019-01-07 Joseph Myers
+
+ PR c/88720
+ PR c/88726
+ * c-decl.c (pop_scope): Use TREE_PUBLIC and b->nested to determine
+ whether a function is nested, not DECL_EXTERNAL. Diagnose inline
+ functions declared but never defined only for external scope, not
+ for other scopes.
+
+2018-01-02 Segher Boessenkool
+
+ Backport from trunk
+ 2018-12-06 Segher Boessenkool
+
+ PR inline-asm/55681
+ * c-parser.c (c_parser_asm_statement): Update grammar. Allow any
+ combination of volatile and goto, in any order, without repetitions.
+
+ Backport from trunk
+ 2018-12-06 Segher Boessenkool
+
+ * c-parser.c (c_parser_asm_statement): Detect the inline keyword
+ after asm. Pass a flag for it to build_asm_expr.
+ * c-tree.h (build_asm_expr): Update declaration.
+ * c-typeck.c (build_asm_stmt): Add is_inline parameter. Use it to
+ set ASM_INLINE_P.
+
+ Backport from trunk
+ 2018-12-08 Segher Boessenkool
+
+ * c-parser (c_parser_asm_statement) [RID_INLINE]: Delete stray line
+ setting "quals".
+
+ Backport from trunk
+ 2018-12-19 Segher Boessenkool
+
+ * c-parser.c (c_parser_asm_statement): Rewrite the loop to work without
+ "done" boolean variable.
+
+ Backport from trunk
+ 2018-12-19 Segher Boessenkool
+
+ * c-parser.c (c_parser_asm_statement): Keep track of the location each
+ asm qualifier is first seen; use that to give nicer "duplicate asm
+ qualifier" messages. Delete 'quals" variable, instead pass the
+ "is_volatile_ flag to build_asm_stmt directly.
+ * c-tree.h (build_asm_stmt): Make the first arg bool instead of tree.
+ * c-typeck.c (build_asm_stmt): Ditto; adjust.
+
+ Backport from trunk
+ 2018-12-19 Segher Boessenkool
+
+ * c-parser.c (c_parser_asm_statement) : Give
+ a more specific error message (instead of just falling through).
+
+ And extra for the backport
+ 2019-01-02 Segher Boessenkool
+
+ * c-parser.c (c_parser_asm_statement): Output a warning instead of an
+ error for const and restrict.
+
2018-12-06 Release Manager
* GCC 7.4.0 released.
Index: gcc/c/c-parser.c
===================================================================
--- gcc/c/c-parser.c (.../tags/gcc_7_4_0_release)
+++ gcc/c/c-parser.c (.../branches/gcc-7-branch)
@@ -6089,61 +6089,104 @@
}
/* Parse an asm statement, a GNU extension. This is a full-blown asm
- statement with inputs, outputs, clobbers, and volatile tag
- allowed.
+ statement with inputs, outputs, clobbers, and volatile, inline, and goto
+ tags allowed.
+ asm-qualifier:
+ volatile
+ inline
+ goto
+
+ asm-qualifier-list:
+ asm-qualifier-list asm-qualifier
+ asm-qualifier
+
asm-statement:
- asm type-qualifier[opt] ( asm-argument ) ;
- asm type-qualifier[opt] goto ( asm-goto-argument ) ;
+ asm asm-qualifier-list[opt] ( asm-argument ) ;
asm-argument:
asm-string-literal
asm-string-literal : asm-operands[opt]
asm-string-literal : asm-operands[opt] : asm-operands[opt]
- asm-string-literal : asm-operands[opt] : asm-operands[opt] : asm-clobbers[opt]
-
- asm-goto-argument:
+ asm-string-literal : asm-operands[opt] : asm-operands[opt] \
+ : asm-clobbers[opt]
asm-string-literal : : asm-operands[opt] : asm-clobbers[opt] \
: asm-goto-operands
- Qualifiers other than volatile are accepted in the syntax but
- warned for. */
+ The form with asm-goto-operands is valid if and only if the
+ asm-qualifier-list contains goto, and is the only allowed form in that case.
+ Duplicate asm-qualifiers are not allowed. */
static tree
c_parser_asm_statement (c_parser *parser)
{
- tree quals, str, outputs, inputs, clobbers, labels, ret;
- bool simple, is_goto;
+ tree str, outputs, inputs, clobbers, labels, ret;
+ bool simple;
location_t asm_loc = c_parser_peek_token (parser)->location;
int section, nsections;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_ASM));
c_parser_consume_token (parser);
- if (c_parser_next_token_is_keyword (parser, RID_VOLATILE))
+
+ /* Handle the asm-qualifier-list. */
+ location_t volatile_loc = UNKNOWN_LOCATION;
+ location_t inline_loc = UNKNOWN_LOCATION;
+ location_t goto_loc = UNKNOWN_LOCATION;
+ for (;;)
{
- quals = c_parser_peek_token (parser)->value;
- c_parser_consume_token (parser);
- }
- else if (c_parser_next_token_is_keyword (parser, RID_CONST)
- || c_parser_next_token_is_keyword (parser, RID_RESTRICT))
- {
- warning_at (c_parser_peek_token (parser)->location,
- 0,
- "%E qualifier ignored on asm",
- c_parser_peek_token (parser)->value);
- quals = NULL_TREE;
- c_parser_consume_token (parser);
- }
- else
- quals = NULL_TREE;
+ c_token *token = c_parser_peek_token (parser);
+ location_t loc = token->location;
+ switch (token->keyword)
+ {
+ case RID_VOLATILE:
+ if (volatile_loc)
+ {
+ error_at (loc, "duplicate asm qualifier %qE", token->value);
+ inform (volatile_loc, "first seen here");
+ }
+ else
+ volatile_loc = loc;
+ c_parser_consume_token (parser);
+ continue;
- is_goto = false;
- if (c_parser_next_token_is_keyword (parser, RID_GOTO))
- {
- c_parser_consume_token (parser);
- is_goto = true;
+ case RID_INLINE:
+ if (inline_loc)
+ {
+ error_at (loc, "duplicate asm qualifier %qE", token->value);
+ inform (inline_loc, "first seen here");
+ }
+ else
+ inline_loc = loc;
+ c_parser_consume_token (parser);
+ continue;
+
+ case RID_GOTO:
+ if (goto_loc)
+ {
+ error_at (loc, "duplicate asm qualifier %qE", token->value);
+ inform (goto_loc, "first seen here");
+ }
+ else
+ goto_loc = loc;
+ c_parser_consume_token (parser);
+ continue;
+
+ case RID_CONST:
+ case RID_RESTRICT:
+ warning_at (loc, 0, "%qE is not an asm qualifier", token->value);
+ c_parser_consume_token (parser);
+ continue;
+
+ default:
+ break;
+ }
+ break;
}
+ bool is_volatile = (volatile_loc != UNKNOWN_LOCATION);
+ bool is_inline = (inline_loc != UNKNOWN_LOCATION);
+ bool is_goto = (goto_loc != UNKNOWN_LOCATION);
+
/* ??? Follow the C++ parser rather than using the
lex_untranslated_string kludge. */
parser->lex_untranslated_string = true;
@@ -6216,8 +6259,9 @@
if (!c_parser_require (parser, CPP_SEMICOLON, "expected %<;%>"))
c_parser_skip_to_end_of_block_or_statement (parser);
- ret = build_asm_stmt (quals, build_asm_expr (asm_loc, str, outputs, inputs,
- clobbers, labels, simple));
+ ret = build_asm_stmt (is_volatile,
+ build_asm_expr (asm_loc, str, outputs, inputs,
+ clobbers, labels, simple, is_inline));
error:
parser->lex_untranslated_string = false;
@@ -18170,6 +18214,8 @@
if (c_parser_peek_token (&tparser)->pragma_kind == PRAGMA_GCC_PCH_PREPROCESS)
c_parser_pragma_pch_preprocess (&tparser);
+ else
+ c_common_no_more_pch ();
the_parser = ggc_alloc ();
*the_parser = tparser;
Index: gcc/c/c-typeck.c
===================================================================
--- gcc/c/c-typeck.c (.../tags/gcc_7_4_0_release)
+++ gcc/c/c-typeck.c (.../branches/gcc-7-branch)
@@ -9669,9 +9669,9 @@
(guaranteed to be 'volatile' or null) and ARGS (represented using
an ASM_EXPR node). */
tree
-build_asm_stmt (tree cv_qualifier, tree args)
+build_asm_stmt (bool is_volatile, tree args)
{
- if (!ASM_VOLATILE_P (args) && cv_qualifier)
+ if (is_volatile)
ASM_VOLATILE_P (args) = 1;
return add_stmt (args);
}
@@ -9680,10 +9680,12 @@
some INPUTS, and some CLOBBERS. The latter three may be NULL.
SIMPLE indicates whether there was anything at all after the
string in the asm expression -- asm("blah") and asm("blah" : )
- are subtly different. We use a ASM_EXPR node to represent this. */
+ are subtly different. We use a ASM_EXPR node to represent this.
+ LOC is the location of the asm, and IS_INLINE says whether this
+ is asm inline. */
tree
build_asm_expr (location_t loc, tree string, tree outputs, tree inputs,
- tree clobbers, tree labels, bool simple)
+ tree clobbers, tree labels, bool simple, bool is_inline)
{
tree tail;
tree args;
@@ -9801,6 +9803,7 @@
as volatile. */
ASM_INPUT_P (args) = simple;
ASM_VOLATILE_P (args) = (noutputs == 0);
+ ASM_INLINE_P (args) = is_inline;
return args;
}
Index: gcc/c/c-tree.h
===================================================================
--- gcc/c/c-tree.h (.../tags/gcc_7_4_0_release)
+++ gcc/c/c-tree.h (.../branches/gcc-7-branch)
@@ -659,8 +659,9 @@
extern void check_compound_literal_type (location_t, struct c_type_name *);
extern tree c_start_case (location_t, location_t, tree, bool);
extern void c_finish_case (tree, tree);
-extern tree build_asm_expr (location_t, tree, tree, tree, tree, tree, bool);
-extern tree build_asm_stmt (tree, tree);
+extern tree build_asm_expr (location_t, tree, tree, tree, tree, tree, bool,
+ bool);
+extern tree build_asm_stmt (bool, tree);
extern int c_types_compatible_p (tree, tree);
extern tree c_begin_compound_stmt (bool);
extern tree c_end_compound_stmt (location_t, tree, bool);
Index: gcc/c/c-decl.c
===================================================================
--- gcc/c/c-decl.c (.../tags/gcc_7_4_0_release)
+++ gcc/c/c-decl.c (.../branches/gcc-7-branch)
@@ -1235,8 +1235,9 @@
&& DECL_ABSTRACT_ORIGIN (p) != 0
&& DECL_ABSTRACT_ORIGIN (p) != p)
TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (p)) = 1;
- if (!DECL_EXTERNAL (p)
+ if (!TREE_PUBLIC (p)
&& !DECL_INITIAL (p)
+ && !b->nested
&& scope != file_scope
&& scope != external_scope)
{
@@ -1252,7 +1253,7 @@
in the same translation unit." */
if (!flag_gnu89_inline
&& !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (p))
- && scope != external_scope)
+ && scope == external_scope)
pedwarn (input_location, 0,
"inline function %q+D declared but never defined", p);
DECL_EXTERNAL (p) = 1;
@@ -2347,13 +2348,33 @@
if (TYPE_NAME (TREE_TYPE (newdecl)) == newdecl)
{
tree remove = TREE_TYPE (newdecl);
- for (tree t = TYPE_MAIN_VARIANT (remove); ;
- t = TYPE_NEXT_VARIANT (t))
- if (TYPE_NEXT_VARIANT (t) == remove)
- {
- TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (remove);
- break;
- }
+ if (TYPE_MAIN_VARIANT (remove) == remove)
+ {
+ gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE);
+ /* If remove is the main variant, no need to remove that
+ from the list. One of the DECL_ORIGINAL_TYPE
+ variants, e.g. created for aligned attribute, might still
+ refer to the newdecl TYPE_DECL though, so remove that one
+ in that case. */
+ if (DECL_ORIGINAL_TYPE (newdecl)
+ && DECL_ORIGINAL_TYPE (newdecl) != remove)
+ for (tree t = TYPE_MAIN_VARIANT (DECL_ORIGINAL_TYPE (newdecl));
+ t; t = TYPE_MAIN_VARIANT (t))
+ if (TYPE_NAME (TYPE_NEXT_VARIANT (t)) == newdecl)
+ {
+ TYPE_NEXT_VARIANT (t)
+ = TYPE_NEXT_VARIANT (TYPE_NEXT_VARIANT (t));
+ break;
+ }
+ }
+ else
+ for (tree t = TYPE_MAIN_VARIANT (remove); ;
+ t = TYPE_NEXT_VARIANT (t))
+ if (TYPE_NEXT_VARIANT (t) == remove)
+ {
+ TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (remove);
+ break;
+ }
}
}
@@ -6360,10 +6381,12 @@
quals_used &= TYPE_QUAL_ATOMIC;
if (quals_used && VOID_TYPE_P (type) && really_funcdef)
pedwarn (specs_loc, 0,
- "function definition has qualified void return type");
+ "function definition has qualified void "
+ "return type");
else
warning_at (specs_loc, OPT_Wignored_qualifiers,
- "type qualifiers ignored on function return type");
+ "type qualifiers ignored on function "
+ "return type");
/* Ensure an error for restrict on invalid types; the
DR#423 resolution is not entirely clear about
@@ -6373,8 +6396,7 @@
&& (!POINTER_TYPE_P (type)
|| !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type))))
error_at (loc, "invalid use of %");
- if (quals_used)
- type = c_build_qualified_type (type, quals_used);
+ type = c_build_qualified_type (type, quals_used);
}
type_quals = TYPE_UNQUALIFIED;
Index: gcc/cfgloopmanip.c
===================================================================
--- gcc/cfgloopmanip.c (.../tags/gcc_7_4_0_release)
+++ gcc/cfgloopmanip.c (.../branches/gcc-7-branch)
@@ -1023,6 +1023,7 @@
target->warned_aggressive_loop_optimizations
|= loop->warned_aggressive_loop_optimizations;
target->in_oacc_kernels_region = loop->in_oacc_kernels_region;
+ target->owned_clique = loop->owned_clique;
}
/* Copies copy of LOOP as subloop of TARGET loop, placing newly
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c (.../tags/gcc_7_4_0_release)
+++ gcc/optabs.c (.../branches/gcc-7-branch)
@@ -3811,7 +3811,7 @@
/* Must make sure the size fits the insn's mode. */
if ((CONST_INT_P (size)
- && INTVAL (size) >= (1 << GET_MODE_BITSIZE (cmp_mode)))
+ && UINTVAL (size) > GET_MODE_MASK (cmp_mode))
|| (GET_MODE_BITSIZE (GET_MODE (size))
> GET_MODE_BITSIZE (cmp_mode)))
continue;
@@ -3830,7 +3830,7 @@
goto fail;
/* Otherwise call a library function. */
- result = emit_block_comp_via_libcall (XEXP (x, 0), XEXP (y, 0), size);
+ result = emit_block_comp_via_libcall (x, y, size);
x = result;
y = const0_rtx;
Index: gcc/DATESTAMP
===================================================================
--- gcc/DATESTAMP (.../tags/gcc_7_4_0_release)
+++ gcc/DATESTAMP (.../branches/gcc-7-branch)
@@ -1 +1 @@
-20181206
+20191009
Index: gcc/valtrack.c
===================================================================
--- gcc/valtrack.c (.../tags/gcc_7_4_0_release)
+++ gcc/valtrack.c (.../branches/gcc-7-branch)
@@ -56,8 +56,6 @@
cleanup_auto_inc_dec (rtx src, machine_mode mem_mode ATTRIBUTE_UNUSED)
{
rtx x = src;
- if (!AUTO_INC_DEC)
- return copy_rtx (x);
const RTX_CODE code = GET_CODE (x);
int i;
Index: gcc/lra.c
===================================================================
--- gcc/lra.c (.../tags/gcc_7_4_0_release)
+++ gcc/lra.c (.../branches/gcc-7-branch)
@@ -1670,10 +1670,12 @@
case SCRATCH:
case CONST_DOUBLE:
- case CONST_INT:
case CONST_VECTOR:
return val;
+ case CONST_INT:
+ return val + UINTVAL (x);
+
default:
break;
}
Index: gcc/tree-ssa-loop-ch.c
===================================================================
--- gcc/tree-ssa-loop-ch.c (.../tags/gcc_7_4_0_release)
+++ gcc/tree-ssa-loop-ch.c (.../branches/gcc-7-branch)
@@ -99,7 +99,7 @@
}
last = last_stmt (header);
- if (gimple_code (last) != GIMPLE_COND)
+ if (!last || gimple_code (last) != GIMPLE_COND)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
@@ -373,11 +373,23 @@
{
gimple *stmt = gsi_stmt (bsi);
if (gimple_code (stmt) == GIMPLE_COND)
- gimple_set_no_warning (stmt, true);
+ {
+ tree lhs = gimple_cond_lhs (stmt);
+ if (gimple_cond_code (stmt) != EQ_EXPR
+ && gimple_cond_code (stmt) != NE_EXPR
+ && INTEGRAL_TYPE_P (TREE_TYPE (lhs))
+ && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (lhs)))
+ gimple_set_no_warning (stmt, true);
+ }
else if (is_gimple_assign (stmt))
{
enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
- if (TREE_CODE_CLASS (rhs_code) == tcc_comparison)
+ tree rhs1 = gimple_assign_rhs1 (stmt);
+ if (TREE_CODE_CLASS (rhs_code) == tcc_comparison
+ && rhs_code != EQ_EXPR
+ && rhs_code != NE_EXPR
+ && INTEGRAL_TYPE_P (TREE_TYPE (rhs1))
+ && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (rhs1)))
gimple_set_no_warning (stmt, true);
}
}
Index: gcc/tree-ssa-strlen.c
===================================================================
--- gcc/tree-ssa-strlen.c (.../tags/gcc_7_4_0_release)
+++ gcc/tree-ssa-strlen.c (.../branches/gcc-7-branch)
@@ -936,10 +936,18 @@
return false;
tree callee = gimple_call_fndecl (stmt);
+ tree decl = builtin_decl_explicit (DECL_FUNCTION_CODE (callee));
+ if (decl
+ && decl != callee
+ && !gimple_builtin_call_types_compatible_p (stmt, decl))
+ return false;
+
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_MEMCMP:
case BUILT_IN_MEMCMP_EQ:
+ case BUILT_IN_STRCMP:
+ case BUILT_IN_STRNCMP:
case BUILT_IN_STRCHR:
case BUILT_IN_STRCHR_CHKP:
case BUILT_IN_STRLEN:
@@ -964,6 +972,8 @@
case BUILT_IN_STPCPY_CHK:
case BUILT_IN_STPCPY_CHKP:
case BUILT_IN_STPCPY_CHK_CHKP:
+ case BUILT_IN_STPNCPY:
+ case BUILT_IN_STPNCPY_CHK:
case BUILT_IN_STRCAT:
case BUILT_IN_STRCAT_CHK:
case BUILT_IN_STRCAT_CHKP:
@@ -972,6 +982,10 @@
case BUILT_IN_STRCPY_CHK:
case BUILT_IN_STRCPY_CHKP:
case BUILT_IN_STRCPY_CHK_CHKP:
+ case BUILT_IN_STRNCAT:
+ case BUILT_IN_STRNCAT_CHK:
+ case BUILT_IN_STRNCPY:
+ case BUILT_IN_STRNCPY_CHK:
/* The above functions should be neither const nor pure. Punt if they
aren't. */
if (gimple_vdef (stmt) == NULL_TREE || gimple_vuse (stmt) == NULL_TREE)
Index: gcc/tree.c
===================================================================
--- gcc/tree.c (.../tags/gcc_7_4_0_release)
+++ gcc/tree.c (.../branches/gcc-7-branch)
@@ -6456,6 +6456,11 @@
a function global scope, unless declared static. */
if (current_function_decl != NULL_TREE && !TREE_STATIC (node))
TREE_PUBLIC (node) = 1;
+ /* Clear TREE_STATIC because DECL_EXTERNAL is set, unless
+ it is a C++ static data member. */
+ if (DECL_CONTEXT (node) == NULL_TREE
+ || !RECORD_OR_UNION_TYPE_P (DECL_CONTEXT (node)))
+ TREE_STATIC (node) = 0;
}
if (*no_add_attrs == false)
Index: gcc/tree.h
===================================================================
--- gcc/tree.h (.../tags/gcc_7_4_0_release)
+++ gcc/tree.h (.../branches/gcc-7-branch)
@@ -912,6 +912,11 @@
(TREE_CHECK2 (NODE, VAR_DECL, \
RESULT_DECL)->decl_common.decl_nonshareable_flag)
+/* In a PARM_DECL, set for Fortran hidden string length arguments that some
+ buggy callers don't pass to the callee. */
+#define DECL_HIDDEN_STRING_LENGTH(NODE) \
+ (TREE_CHECK (NODE, PARM_DECL)->decl_common.decl_nonshareable_flag)
+
/* In a CALL_EXPR, means that the call is the jump from a thunk to the
thunked-to function. */
#define CALL_FROM_THUNK_P(NODE) (CALL_EXPR_CHECK (NODE)->base.protected_flag)
@@ -1231,6 +1236,9 @@
ASM_OPERAND with no operands. */
#define ASM_INPUT_P(NODE) (ASM_EXPR_CHECK (NODE)->base.static_flag)
#define ASM_VOLATILE_P(NODE) (ASM_EXPR_CHECK (NODE)->base.public_flag)
+/* Nonzero if we want to consider this asm as minimum length and cost
+ for inlining decisions. */
+#define ASM_INLINE_P(NODE) (ASM_EXPR_CHECK (NODE)->base.protected_flag)
/* COND_EXPR accessors. */
#define COND_EXPR_COND(NODE) (TREE_OPERAND (COND_EXPR_CHECK (NODE), 0))
Index: gcc/ipa-cp.c
===================================================================
--- gcc/ipa-cp.c (.../tags/gcc_7_4_0_release)
+++ gcc/ipa-cp.c (.../branches/gcc-7-branch)
@@ -810,7 +810,7 @@
topo->stack = XCNEWVEC (struct cgraph_node *, symtab->cgraph_count);
gcc_checking_assert (topo->stack_top == 0);
- topo->nnodes = ipa_reduced_postorder (topo->order, true, true, NULL);
+ topo->nnodes = ipa_reduced_postorder (topo->order, true, NULL);
}
/* Free information about strongly connected components and the arrays in
@@ -1072,7 +1072,6 @@
if (TREE_CODE_CLASS (code) == tcc_binary)
{
tree type = TREE_TYPE (operand);
- gcc_assert (INTEGRAL_TYPE_P (type));
widest_int o_value, o_mask;
get_value_and_mask (operand, &o_value, &o_mask);
@@ -2819,12 +2818,19 @@
estimate_ipcp_clone_size_and_time (node, known_csts, known_contexts,
known_aggs_ptrs, &size, &time,
&hints);
- time_benefit = base_time - time
- + devirtualization_time_bonus (node, known_csts, known_contexts,
- known_aggs_ptrs)
- + hint_time_bonus (hints)
- + removable_params_cost + est_move_cost;
+ /* Extern inline functions have no cloning local time benefits because they
+ will be inlined anyway. The only reason to clone them is if it enables
+ optimization in any of the functions they call. */
+ if (DECL_EXTERNAL (node->decl) && DECL_DECLARED_INLINE_P (node->decl))
+ time_benefit = 0;
+ else
+ time_benefit = base_time - time
+ + devirtualization_time_bonus (node, known_csts, known_contexts,
+ known_aggs_ptrs)
+ + hint_time_bonus (hints)
+ + removable_params_cost + est_move_cost;
+
gcc_checking_assert (size >=0);
/* The inliner-heuristics based estimates may think that in certain
contexts some functions do not have any size at all but we want
Index: gcc/tree-scalar-evolution.c
===================================================================
--- gcc/tree-scalar-evolution.c (.../tags/gcc_7_4_0_release)
+++ gcc/tree-scalar-evolution.c (.../branches/gcc-7-branch)
@@ -280,6 +280,7 @@
#include "params.h"
#include "tree-ssa-propagate.h"
#include "gimple-fold.h"
+#include "tree-into-ssa.h"
static tree analyze_scalar_evolution_1 (struct loop *, tree, tree);
static tree analyze_scalar_evolution_for_address_of (struct loop *loop,
@@ -866,7 +867,7 @@
gimple *stmt;
stmt = last_stmt (exit_edge->src);
- if (gcond *cond_stmt = dyn_cast (stmt))
+ if (gcond *cond_stmt = safe_dyn_cast (stmt))
res = cond_stmt;
}
@@ -1412,6 +1413,11 @@
return build_polynomial_chrec (loop->num, init_cond, right);
}
+ /* The affine code only deals with pointer and integer types. */
+ if (!POINTER_TYPE_P (type)
+ && !INTEGRAL_TYPE_P (type))
+ return chrec_dont_know;
+
/* Try harder to check if they are equal. */
tree_to_aff_combination_expand (left, type, &aff1, &peeled_chrec_map);
tree_to_aff_combination_expand (step_val, type, &aff2, &peeled_chrec_map);
@@ -1532,7 +1538,10 @@
follow_copies_to_constant (tree var)
{
tree res = var;
- while (TREE_CODE (res) == SSA_NAME)
+ while (TREE_CODE (res) == SSA_NAME
+ /* We face not updated SSA form in multiple places and this walk
+ may end up in sibling loops so we have to guard it. */
+ && !name_registered_for_update_p (res))
{
gimple *def = SSA_NAME_DEF_STMT (res);
if (gphi *phi = dyn_cast (def))
Index: gcc/rtlanal.c
===================================================================
--- gcc/rtlanal.c (.../tags/gcc_7_4_0_release)
+++ gcc/rtlanal.c (.../branches/gcc-7-branch)
@@ -357,10 +357,10 @@
if (to == from)
return 0;
- /* It is not safe to call INITIAL_ELIMINATION_OFFSET
- before the reload pass. We need to give at least
- an estimation for the resulting frame size. */
- if (! reload_completed)
+ /* It is not safe to call INITIAL_ELIMINATION_OFFSET before the epilogue
+ is completed, but we need to give at least an estimate for the stack
+ pointer based on the frame size. */
+ if (!epilogue_completed)
{
offset1 = crtl->outgoing_args_size + get_frame_size ();
#if !STACK_GROWS_DOWNWARD
@@ -4636,7 +4636,7 @@
|| ((extend_op = load_extend_op (inner_mode)) == SIGN_EXTEND
? val_signbit_known_set_p (inner_mode, nonzero)
: extend_op != ZERO_EXTEND)
- || (!MEM_P (SUBREG_REG (x)) && !REG_P (SUBREG_REG (x))))
+ || !MEM_P (SUBREG_REG (x)))
&& GET_MODE_PRECISION (GET_MODE (x))
> GET_MODE_PRECISION (inner_mode))
nonzero
Index: gcc/internal-fn.c
===================================================================
--- gcc/internal-fn.c (.../tags/gcc_7_4_0_release)
+++ gcc/internal-fn.c (.../branches/gcc-7-branch)
@@ -2770,6 +2770,56 @@
0
};
+/* Return true if IFN is some form of load from memory. */
+
+bool
+internal_load_fn_p (internal_fn fn)
+{
+ switch (fn)
+ {
+ case IFN_MASK_LOAD:
+ case IFN_LOAD_LANES:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* Return true if IFN is some form of store to memory. */
+
+bool
+internal_store_fn_p (internal_fn fn)
+{
+ switch (fn)
+ {
+ case IFN_MASK_STORE:
+ case IFN_STORE_LANES:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/* If FN takes a vector mask argument, return the index of that argument,
+ otherwise return -1. */
+
+int
+internal_fn_mask_index (internal_fn fn)
+{
+ switch (fn)
+ {
+ case IFN_MASK_LOAD:
+ case IFN_MASK_STORE:
+ return 2;
+
+ default:
+ return -1;
+ }
+}
+
+
/* Expand STMT as though it were a call to internal function FN. */
void
Index: gcc/internal-fn.h
===================================================================
--- gcc/internal-fn.h (.../tags/gcc_7_4_0_release)
+++ gcc/internal-fn.h (.../branches/gcc-7-branch)
@@ -176,6 +176,10 @@
optimization_type);
extern bool set_edom_supported_p (void);
+extern bool internal_load_fn_p (internal_fn);
+extern bool internal_store_fn_p (internal_fn);
+extern int internal_fn_mask_index (internal_fn);
+
extern void expand_internal_call (gcall *);
extern void expand_internal_call (internal_fn, gcall *);
extern void expand_PHI (internal_fn, gcall *);
Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c (.../tags/gcc_7_4_0_release)
+++ gcc/builtins.c (.../branches/gcc-7-branch)
@@ -2508,7 +2508,7 @@
tree arg;
if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE))
- gcc_unreachable ();
+ return NULL_RTX;
arg = CALL_EXPR_ARG (exp, 0);
@@ -2644,7 +2644,7 @@
enum built_in_function fallback_fn = BUILT_IN_NONE;
if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE))
- gcc_unreachable ();
+ return NULL_RTX;
arg = CALL_EXPR_ARG (exp, 0);
@@ -9774,6 +9774,9 @@
static void
maybe_emit_free_warning (tree exp)
{
+ if (call_expr_nargs (exp) != 1)
+ return;
+
tree arg = CALL_EXPR_ARG (exp, 0);
STRIP_NOPS (arg);
Index: gcc/final.c
===================================================================
--- gcc/final.c (.../tags/gcc_7_4_0_release)
+++ gcc/final.c (.../branches/gcc-7-branch)
@@ -4490,7 +4490,11 @@
assemble_start_function (current_function_decl, fnname);
final_start_function (get_insns (), asm_out_file, optimize);
final (get_insns (), asm_out_file, optimize);
- if (flag_ipa_ra)
+ if (flag_ipa_ra
+ /* Functions with naked attributes are supported only with basic asm
+ statements in the body, thus for supported use cases the information
+ on clobbered registers is not available. */
+ && !lookup_attribute ("naked", DECL_ATTRIBUTES (current_function_decl)))
collect_fn_hard_reg_usage ();
final_end_function ();
Index: gcc/input.c
===================================================================
--- gcc/input.c (.../tags/gcc_7_4_0_release)
+++ gcc/input.c (.../branches/gcc-7-branch)
@@ -3480,6 +3480,34 @@
ASSERT_EQ (num_cases_tested, 2 * 12);
}
+/* Verify that when presented with a consecutive pair of locations with
+ a very large line offset, we don't attempt to consolidate them into
+ a single ordinary linemap where the line offsets within the line map
+ would lead to overflow (PR lto/88147). */
+
+static void
+test_line_offset_overflow ()
+{
+ line_table_test ltt (line_table_case (5, 0));
+
+ linemap_add (line_table, LC_ENTER, false, "foo.c", 0);
+ linemap_line_start (line_table, 1, 100);
+ location_t loc_a = linemap_line_start (line_table, 2578, 255);
+ assert_loceq ("foo.c", 2578, 0, loc_a);
+
+ const line_map_ordinary *ordmap_a = LINEMAPS_LAST_ORDINARY_MAP (line_table);
+ ASSERT_EQ (ordmap_a->m_column_and_range_bits, 13);
+ ASSERT_EQ (ordmap_a->m_range_bits, 5);
+
+ location_t loc_b = linemap_line_start (line_table, 404198, 512);
+ assert_loceq ("foo.c", 404198, 0, loc_b);
+
+ /* We should have started a new linemap, rather than attempting to store
+ a very large line offset. */
+ const line_map_ordinary *ordmap_b = LINEMAPS_LAST_ORDINARY_MAP (line_table);
+ ASSERT_NE (ordmap_a, ordmap_b);
+}
+
/* Run all of the selftests within this file. */
void
@@ -3518,6 +3546,8 @@
for_each_line_table_case (test_lexer_char_constants);
test_reading_source_line ();
+
+ test_line_offset_overflow ();
}
} // namespace selftest
Index: gcc/cfghooks.c
===================================================================
--- gcc/cfghooks.c (.../tags/gcc_7_4_0_release)
+++ gcc/cfghooks.c (.../branches/gcc-7-branch)
@@ -1067,7 +1067,7 @@
AFTER. */
basic_block
-duplicate_block (basic_block bb, edge e, basic_block after)
+duplicate_block (basic_block bb, edge e, basic_block after, copy_bb_data *id)
{
edge s, n;
basic_block new_bb;
@@ -1083,7 +1083,7 @@
gcc_checking_assert (can_duplicate_block_p (bb));
- new_bb = cfg_hooks->duplicate_block (bb);
+ new_bb = cfg_hooks->duplicate_block (bb, id);
if (after)
move_block_after (new_bb, after);
@@ -1355,6 +1355,7 @@
unsigned i, j;
basic_block bb, new_bb, dom_bb;
edge e;
+ copy_bb_data id;
/* Duplicate bbs, update dominators, assign bbs to loops. */
for (i = 0; i < n; i++)
@@ -1361,7 +1362,7 @@
{
/* Duplicate. */
bb = bbs[i];
- new_bb = new_bbs[i] = duplicate_block (bb, NULL, after);
+ new_bb = new_bbs[i] = duplicate_block (bb, NULL, after, &id);
after = new_bb;
bb->flags |= BB_DUPLICATED;
if (bb->loop_father)
Index: gcc/cfghooks.h
===================================================================
--- gcc/cfghooks.h (.../tags/gcc_7_4_0_release)
+++ gcc/cfghooks.h (.../branches/gcc-7-branch)
@@ -54,7 +54,20 @@
bool run;
};
+typedef int_hash dependence_hash;
+/* Optional data for duplicate_block. */
+
+struct copy_bb_data
+{
+ copy_bb_data() : dependence_map (NULL) {}
+ ~copy_bb_data () { delete dependence_map; }
+
+ /* A map from the copied BBs dependence info cliques to
+ equivalents in the BBs duplicated to. */
+ hash_map *dependence_map;
+};
+
struct cfg_hooks
{
/* Name of the corresponding ir. */
@@ -112,7 +125,7 @@
bool (*can_duplicate_block_p) (const_basic_block a);
/* Duplicate block A. */
- basic_block (*duplicate_block) (basic_block a);
+ basic_block (*duplicate_block) (basic_block a, copy_bb_data *);
/* Higher level functions representable by primitive operations above if
we didn't have some oddities in RTL and Tree representations. */
@@ -227,7 +240,8 @@
extern void predict_edge (edge e, enum br_predictor predictor, int probability);
extern bool predicted_by_p (const_basic_block bb, enum br_predictor predictor);
extern bool can_duplicate_block_p (const_basic_block);
-extern basic_block duplicate_block (basic_block, edge, basic_block);
+extern basic_block duplicate_block (basic_block, edge, basic_block,
+ copy_bb_data * = NULL);
extern bool block_ends_with_call_p (basic_block bb);
extern bool empty_block_p (basic_block);
extern basic_block split_block_before_cond_jump (basic_block);
Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c (.../tags/gcc_7_4_0_release)
+++ gcc/fold-const.c (.../branches/gcc-7-branch)
@@ -3044,10 +3044,16 @@
switch (TREE_CODE (arg0))
{
case INDIRECT_REF:
- if (!(flags & OEP_ADDRESS_OF)
- && (TYPE_ALIGN (TREE_TYPE (arg0))
- != TYPE_ALIGN (TREE_TYPE (arg1))))
- return 0;
+ if (!(flags & OEP_ADDRESS_OF))
+ {
+ if (TYPE_ALIGN (TREE_TYPE (arg0))
+ != TYPE_ALIGN (TREE_TYPE (arg1)))
+ return 0;
+ /* Verify that the access types are compatible. */
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (arg0))
+ != TYPE_MAIN_VARIANT (TREE_TYPE (arg1)))
+ return 0;
+ }
flags &= ~OEP_ADDRESS_OF;
return OP_SAME (0);
@@ -4159,7 +4165,7 @@
There are problems with FP fields since the type_for_size call
below can fail for, e.g., XFmode. */
if (! INTEGRAL_TYPE_P (TREE_TYPE (exp)))
- return 0;
+ return NULL_TREE;
/* We are interested in the bare arrangement of bits, so strip everything
that doesn't affect the machine mode. However, record the type of the
@@ -4175,7 +4181,7 @@
exp = TREE_OPERAND (exp, 0);
STRIP_NOPS (exp); STRIP_NOPS (and_mask);
if (TREE_CODE (and_mask) != INTEGER_CST)
- return 0;
+ return NULL_TREE;
}
inner = get_inner_reference (exp, pbitsize, pbitpos, &offset, pmode,
@@ -4187,8 +4193,12 @@
|| (! AGGREGATE_TYPE_P (TREE_TYPE (inner))
&& compare_tree_int (TYPE_SIZE (TREE_TYPE (inner)),
*pbitpos + *pbitsize) < 0))
- return 0;
+ return NULL_TREE;
+ unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1);
+ if (unsigned_type == NULL_TREE)
+ return NULL_TREE;
+
*exp_ = exp;
/* If the number of bits in the reference is the same as the bitsize of
@@ -4198,7 +4208,6 @@
*punsignedp = TYPE_UNSIGNED (outer_type);
/* Compute the mask to access the bitfield. */
- unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1);
precision = TYPE_PRECISION (unsigned_type);
mask = build_int_cst_type (unsigned_type, -1);
@@ -10726,8 +10735,7 @@
strlen(ptr) != 0 => *ptr != 0
Other cases should reduce to one of these two (or a constant)
due to the return value of strlen being unsigned. */
- if (TREE_CODE (arg0) == CALL_EXPR
- && integer_zerop (arg1))
+ if (TREE_CODE (arg0) == CALL_EXPR && integer_zerop (arg1))
{
tree fndecl = get_callee_fndecl (arg0);
@@ -10735,12 +10743,17 @@
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STRLEN
&& call_expr_nargs (arg0) == 1
- && TREE_CODE (TREE_TYPE (CALL_EXPR_ARG (arg0, 0))) == POINTER_TYPE)
+ && (TREE_CODE (TREE_TYPE (CALL_EXPR_ARG (arg0, 0)))
+ == POINTER_TYPE))
{
- tree iref = build_fold_indirect_ref_loc (loc,
- CALL_EXPR_ARG (arg0, 0));
+ tree ptrtype
+ = build_pointer_type (build_qualified_type (char_type_node,
+ TYPE_QUAL_CONST));
+ tree ptr = fold_convert_loc (loc, ptrtype,
+ CALL_EXPR_ARG (arg0, 0));
+ tree iref = build_fold_indirect_ref_loc (loc, ptr);
return fold_build2_loc (loc, code, type, iref,
- build_int_cst (TREE_TYPE (iref), 0));
+ build_int_cst (TREE_TYPE (iref), 0));
}
}
Index: gcc/gimple-ssa-sprintf.c
===================================================================
--- gcc/gimple-ssa-sprintf.c (.../tags/gcc_7_4_0_release)
+++ gcc/gimple-ssa-sprintf.c (.../branches/gcc-7-branch)
@@ -3353,10 +3353,10 @@
are badly declared. */
&& !stmt_ends_bb_p (info.callstmt))
{
- tree cst = build_int_cst (integer_type_node, minretval);
+ tree cst = build_int_cst (lhs ? TREE_TYPE (lhs) : integer_type_node,
+ minretval);
- if (lhs == NULL_TREE
- && info.nowrite)
+ if (lhs == NULL_TREE && info.nowrite)
{
/* Remove the call to the bounded function with a zero size
(e.g., snprintf(0, 0, "%i", 123)) if there is no lhs. */
@@ -3397,7 +3397,7 @@
}
}
}
- else if (lhs)
+ else if (lhs && types_compatible_p (TREE_TYPE (lhs), integer_type_node))
{
bool setrange = false;
Index: gcc/omp-low.c
===================================================================
--- gcc/omp-low.c (.../tags/gcc_7_4_0_release)
+++ gcc/omp-low.c (.../branches/gcc-7-branch)
@@ -853,6 +853,7 @@
ctx->cb.copy_decl = omp_copy_decl;
ctx->cb.eh_lp_nr = 0;
ctx->cb.transform_call_graph_edges = CB_CGE_MOVE;
+ ctx->cb.dont_remap_vla_if_no_change = true;
ctx->depth = 1;
}
@@ -2888,8 +2889,10 @@
case GIMPLE_OMP_FOR:
if (gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_TASKLOOP)
goto ordered_in_taskloop;
- if (omp_find_clause (gimple_omp_for_clauses (ctx->stmt),
- OMP_CLAUSE_ORDERED) == NULL)
+ tree o;
+ o = omp_find_clause (gimple_omp_for_clauses (ctx->stmt),
+ OMP_CLAUSE_ORDERED);
+ if (o == NULL)
{
error_at (gimple_location (stmt),
"% region must be closely nested inside "
@@ -2896,6 +2899,15 @@
"a loop region with an % clause");
return false;
}
+ if (OMP_CLAUSE_ORDERED_EXPR (o) != NULL_TREE
+ && omp_find_clause (c, OMP_CLAUSE_DEPEND) == NULL_TREE)
+ {
+ error_at (gimple_location (stmt),
+ "% region without % clause may "
+ "not be closely nested inside a loop region with "
+ "an % clause with a parameter");
+ return false;
+ }
return true;
case GIMPLE_OMP_TARGET:
if (gimple_omp_target_kind (ctx->stmt)
Index: gcc/objc/ChangeLog
===================================================================
--- gcc/objc/ChangeLog (.../tags/gcc_7_4_0_release)
+++ gcc/objc/ChangeLog (.../branches/gcc-7-branch)
@@ -1,3 +1,14 @@
+2019-09-05 Iain Sandoe
+
+ Backport from mainline.
+ 2019-05-18 Iain Sandoe
+
+ * objc/objc-act.h (OCTI_INSTANCE_TYPE, OCTI_INSTANCETYPE_NAME): New.
+ (objc_global_trees): Add instance type and name.
+ (INSTANCE_TYPEDEF_NAME): New.
+ * objc/objc-act.c (synth_module_prologue): Build decls for
+ objc_instancetype_type and objc_instancetype_name.
+
2018-12-06 Release Manager
* GCC 7.4.0 released.
Index: gcc/objc/objc-act.c
===================================================================
--- gcc/objc/objc-act.c (.../tags/gcc_7_4_0_release)
+++ gcc/objc/objc-act.c (.../branches/gcc-7-branch)
@@ -2944,12 +2944,14 @@
objc_class_reference = xref_tag (RECORD_TYPE, objc_class_id);
objc_object_type = build_pointer_type (objc_object_reference);
+ objc_instancetype_type = build_pointer_type (objc_object_reference);
objc_class_type = build_pointer_type (objc_class_reference);
objc_object_name = get_identifier (OBJECT_TYPEDEF_NAME);
+ objc_instancetype_name = get_identifier (INSTANCE_TYPEDEF_NAME);
objc_class_name = get_identifier (CLASS_TYPEDEF_NAME);
- /* Declare the 'id' and 'Class' typedefs. */
+ /* Declare the 'id', 'instancetype' and 'Class' typedefs. */
type = lang_hooks.decls.pushdecl (build_decl (input_location,
TYPE_DECL,
objc_object_name,
@@ -2958,6 +2960,12 @@
type = lang_hooks.decls.pushdecl (build_decl (input_location,
TYPE_DECL,
+ objc_instancetype_name,
+ objc_instancetype_type));
+ TREE_NO_WARNING (type) = 1;
+
+ type = lang_hooks.decls.pushdecl (build_decl (input_location,
+ TYPE_DECL,
objc_class_name,
objc_class_type));
TREE_NO_WARNING (type) = 1;
Index: gcc/objc/objc-act.h
===================================================================
--- gcc/objc/objc-act.h (.../tags/gcc_7_4_0_release)
+++ gcc/objc/objc-act.h (.../branches/gcc-7-branch)
@@ -313,6 +313,7 @@
OCTI_SUPER_TYPE,
OCTI_SEL_TYPE,
OCTI_ID_TYPE,
+ OCTI_INSTANCE_TYPE,
OCTI_CLS_TYPE,
OCTI_NST_TYPE,
OCTI_PROTO_TYPE,
@@ -368,6 +369,7 @@
OCTI_OBJ_ID,
OCTI_CLS_ID,
OCTI_ID_NAME,
+ OCTI_INSTANCETYPE_NAME,
OCTI_CLASS_NAME,
OCTI_CNST_STR_ID,
OCTI_CNST_STR_TYPE,
@@ -443,6 +445,7 @@
#define objc_super_type objc_global_trees[OCTI_SUPER_TYPE]
#define objc_selector_type objc_global_trees[OCTI_SEL_TYPE]
#define objc_object_type objc_global_trees[OCTI_ID_TYPE]
+#define objc_instancetype_type objc_global_trees[OCTI_INSTANCE_TYPE]
#define objc_class_type objc_global_trees[OCTI_CLS_TYPE]
#define objc_instance_type objc_global_trees[OCTI_NST_TYPE]
#define objc_protocol_type objc_global_trees[OCTI_PROTO_TYPE]
@@ -570,7 +573,8 @@
#define objc_object_id objc_global_trees[OCTI_OBJ_ID]
#define objc_class_id objc_global_trees[OCTI_CLS_ID]
-#define objc_object_name objc_global_trees[OCTI_ID_NAME]
+#define objc_object_name objc_global_trees[OCTI_ID_NAME]
+#define objc_instancetype_name objc_global_trees[OCTI_INSTANCETYPE_NAME]
#define objc_class_name objc_global_trees[OCTI_CLASS_NAME]
/* Constant string classes. */
@@ -608,6 +612,7 @@
/* Reserved tag definitions. */
#define OBJECT_TYPEDEF_NAME "id"
+#define INSTANCE_TYPEDEF_NAME "instancetype"
#define CLASS_TYPEDEF_NAME "Class"
#define TAG_OBJECT "objc_object"
Index: gcc/ipa-reference.c
===================================================================
--- gcc/ipa-reference.c (.../tags/gcc_7_4_0_release)
+++ gcc/ipa-reference.c (.../branches/gcc-7-branch)
@@ -730,7 +730,7 @@
the global information. All the nodes within a cycle will have
the same info so we collapse cycles first. Then we can do the
propagation in one pass from the leaves to the roots. */
- order_pos = ipa_reduced_postorder (order, true, true, ignore_edge_p);
+ order_pos = ipa_reduced_postorder (order, true, ignore_edge_p);
if (dump_file)
ipa_print_order (dump_file, "reduced", order, order_pos);
Index: gcc/toplev.c
===================================================================
--- gcc/toplev.c (.../tags/gcc_7_4_0_release)
+++ gcc/toplev.c (.../branches/gcc-7-branch)
@@ -1981,6 +1981,36 @@
else
int_n_enabled_p[i] = false;
+ /* Initialize mpfrs exponent range. This is important to get
+ underflow/overflow in a reasonable timeframe. */
+ machine_mode mode;
+ int min_exp = -1;
+ int max_exp = 1;
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
+ mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ if (SCALAR_FLOAT_MODE_P (mode))
+ {
+ const real_format *fmt = REAL_MODE_FORMAT (mode);
+ if (fmt)
+ {
+ /* fmt->emin - fmt->p + 1 should be enough but the
+ back-and-forth dance in real_to_decimal_for_mode we
+ do for checking fails due to rounding effects then. */
+ if ((fmt->emin - fmt->p) < min_exp)
+ min_exp = fmt->emin - fmt->p;
+ if (fmt->emax > max_exp)
+ max_exp = fmt->emax;
+ }
+ }
+ /* E.g. mpc_norm assumes it can square a number without bothering with
+ with range scaling, so until that is fixed, double the minimum
+ and maximum exponents, plus add some buffer for arithmetics
+ on the squared numbers. */
+ if (mpfr_set_emin (2 * (min_exp - 1))
+ || mpfr_set_emax (2 * (max_exp + 1)))
+ sorry ("mpfr not configured to handle all float modes");
+
/* Set up the back-end if requested. */
if (!no_backend)
backend_init ();
Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c (.../tags/gcc_7_4_0_release)
+++ gcc/tree-ssa-sccvn.c (.../branches/gcc-7-branch)
@@ -1981,9 +1981,20 @@
tree rhs = gimple_assign_rhs1 (def_stmt);
if (TREE_CODE (rhs) == SSA_NAME)
rhs = SSA_VAL (rhs);
+ unsigned pad = 0;
+ enum machine_mode mode = TYPE_MODE (TREE_TYPE (rhs));
+ if (BYTES_BIG_ENDIAN
+ && (SCALAR_INT_MODE_P (mode)
+ || ALL_SCALAR_FIXED_POINT_MODE_P (mode)
+ || SCALAR_FLOAT_MODE_P (mode)))
+ {
+ /* On big-endian the padding is at the 'front' so
+ just skip the initial bytes. */
+ pad = GET_MODE_SIZE (mode) - size2 / BITS_PER_UNIT;
+ }
len = native_encode_expr (gimple_assign_rhs1 (def_stmt),
buffer, sizeof (buffer),
- (offset - offset2) / BITS_PER_UNIT);
+ (offset - offset2) / BITS_PER_UNIT + pad);
if (len > 0 && len * BITS_PER_UNIT >= ref->size)
{
tree type = vr->type;
@@ -2029,6 +2040,7 @@
base2 = get_ref_base_and_extent (gimple_assign_lhs (def_stmt),
&offset2, &size2, &maxsize2,
&reverse);
+ tree def_rhs = gimple_assign_rhs1 (def_stmt);
if (!reverse
&& maxsize2 != -1
&& maxsize2 == size2
@@ -2041,11 +2053,14 @@
according to endianness. */
&& (! INTEGRAL_TYPE_P (vr->type)
|| ref->size == TYPE_PRECISION (vr->type))
- && ref->size % BITS_PER_UNIT == 0)
+ && ref->size % BITS_PER_UNIT == 0
+ && (! INTEGRAL_TYPE_P (TREE_TYPE (def_rhs))
+ || (TYPE_PRECISION (TREE_TYPE (def_rhs))
+ == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (def_rhs))))))
{
code_helper rcode = BIT_FIELD_REF;
tree ops[3];
- ops[0] = SSA_VAL (gimple_assign_rhs1 (def_stmt));
+ ops[0] = SSA_VAL (def_rhs);
ops[1] = bitsize_int (ref->size);
ops[2] = bitsize_int (offset - offset2);
tree val = vn_nary_build_or_lookup (rcode, vr->type, ops);
@@ -3572,7 +3587,17 @@
ops[0] = vn_nary_op_lookup_pieces
(2, gimple_assign_rhs_code (def), type, ops, NULL);
/* We have wider operation available. */
- if (ops[0])
+ if (ops[0]
+ /* If the leader is a wrapping operation we can
+ insert it for code hoisting w/o introducing
+ undefined overflow. If it is not it has to
+ be available. See PR86554. */
+ && (TYPE_OVERFLOW_WRAPS (TREE_TYPE (ops[0]))
+ || TREE_CODE (ops[0]) != SSA_NAME
+ || SSA_NAME_IS_DEFAULT_DEF (ops[0])
+ || dominated_by_p_w_unex
+ (gimple_bb (stmt),
+ gimple_bb (SSA_NAME_DEF_STMT (ops[0])))))
{
unsigned lhs_prec = TYPE_PRECISION (type);
unsigned rhs_prec = TYPE_PRECISION (TREE_TYPE (rhs1));
@@ -5133,3 +5158,54 @@
return false;
}
+
+/* Return true if the reference operation REF may trap. */
+
+bool
+vn_reference_may_trap (vn_reference_t ref)
+{
+ switch (ref->operands[0].opcode)
+ {
+ case MODIFY_EXPR:
+ case CALL_EXPR:
+ /* We do not handle calls. */
+ case ADDR_EXPR:
+ /* And toplevel address computations never trap. */
+ return false;
+ default:;
+ }
+
+ vn_reference_op_t op;
+ unsigned i;
+ FOR_EACH_VEC_ELT (ref->operands, i, op)
+ {
+ switch (op->opcode)
+ {
+ case WITH_SIZE_EXPR:
+ case TARGET_MEM_REF:
+ /* Always variable. */
+ return true;
+ case COMPONENT_REF:
+ if (op->op1 && TREE_CODE (op->op1) == SSA_NAME)
+ return true;
+ break;
+ case ARRAY_RANGE_REF:
+ case ARRAY_REF:
+ if (TREE_CODE (op->op0) == SSA_NAME)
+ return true;
+ break;
+ case MEM_REF:
+ /* Nothing interesting in itself, the base is separate. */
+ break;
+ /* The following are the address bases. */
+ case SSA_NAME:
+ return true;
+ case ADDR_EXPR:
+ if (op->op0)
+ return tree_could_trap_p (TREE_OPERAND (op->op0, 0));
+ return false;
+ default:;
+ }
+ }
+ return false;
+}
Index: gcc/tree-ssa-sccvn.h
===================================================================
--- gcc/tree-ssa-sccvn.h (.../tags/gcc_7_4_0_release)
+++ gcc/tree-ssa-sccvn.h (.../branches/gcc-7-branch)
@@ -237,6 +237,7 @@
bool vn_nary_op_eq (const_vn_nary_op_t const vno1,
const_vn_nary_op_t const vno2);
bool vn_nary_may_trap (vn_nary_op_t);
+bool vn_reference_may_trap (vn_reference_t);
bool vn_reference_eq (const_vn_reference_t const, const_vn_reference_t const);
unsigned int get_max_value_id (void);
unsigned int get_next_value_id (void);
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog (.../tags/gcc_7_4_0_release)
+++ gcc/ChangeLog (.../branches/gcc-7-branch)
@@ -1,3 +1,1901 @@
+2019-10-07 Bill Schmidt
+
+ Backport from mainline
+ 2019-10-01 Bill Schmidt
+
+ PR target/91275
+ * config/rs6000/rs6000.c (rtx_is_swappable_p): Don't swap
+ vpmsumd.
+
+2019-10-01 Oleg Endo