From: Oleg Endo Date: Tue, 8 Oct 2024 04:08:50 +0000 (+0900) Subject: SH: Add test case from PR55212 c#367 / c#373 / att. 59285 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4ce923a7eab16eda87045f1040d0b2d7677d5aaf;p=thirdparty%2Fgcc.git SH: Add test case from PR55212 c#367 / c#373 / att. 59285 gcc/testsuite/ChangeLog: PR target/55212 * g++.target/sh/torture/pr55212-c373.C: New. --- diff --git a/gcc/testsuite/g++.target/sh/torture/pr55212-c373.C b/gcc/testsuite/g++.target/sh/torture/pr55212-c373.C new file mode 100644 index 00000000000..d1f30cb93c4 --- /dev/null +++ b/gcc/testsuite/g++.target/sh/torture/pr55212-c373.C @@ -0,0 +1,612 @@ +/* { dg-additional-options "-std=c++20 -mlra -fpic -w " } */ +/* { dg-do compile } */ + + namespace std { + typedef unsigned int size_t; + } + namespace std { + __attribute__((__always_inline__)) constexpr inline bool __is_constant_evaluated() noexcept { + return __builtin_is_constant_evaluated(); + } + } + typedef unsigned int size_t; + extern "C" { + typedef struct { + } + lldiv_t; + extern "C" { + typedef unsigned char __uint8_t; + typedef unsigned int __uint32_t; + typedef union { + struct { + } + __value32; + } + __atomic_wide_counter; + } + } + extern "C++" { + namespace std __attribute__ ((__visibility__ ("default"))) { + } + } + extern "C++" { + namespace std __attribute__ ((__visibility__ ("default"))) { + template struct integral_constant { + static constexpr _Tp value = __v; + using value_type = _Tp; + constexpr operator value_type() const noexcept { + } + }; + template using __bool_constant = integral_constant; + using true_type = __bool_constant; + using false_type = __bool_constant; + template struct enable_if { + }; + template struct enable_if { + using type = _Tp; + }; + template struct __conditional { + }; + template using __conditional_t = typename __conditional<_Cond>::template type<_If, _Else>; + template struct __type_identity { + }; + namespace __detail { + template auto __and_fn(...) -> false_type; + } + template struct __and_ : decltype(__detail::__and_fn<_Bn...>(0)) { + }; + template struct remove_cv; + template constexpr true_type __is_complete_or_unbounded(__type_identity<_Tp>) { + return { +}; + } + template struct is_void : public false_type { + }; + template struct is_member_object_pointer : public __bool_constant<__is_member_object_pointer(_Tp)> { + }; + template struct is_member_function_pointer : public __bool_constant<__is_member_function_pointer(_Tp)> { + }; + template struct is_empty : public __bool_constant<__is_empty(_Tp)> { + }; + template _Tp __declval(long); + template auto declval() noexcept -> decltype(__declval<_Tp>(0)); + template using __is_constructible_impl = __bool_constant<__is_constructible(_Tp, _Args...)>; + template using __add_lval_ref_t = __add_lvalue_reference(_Tp); + template struct is_copy_constructible : public __is_constructible_impl<_Tp, __add_lval_ref_t> { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{ +} +), "template argument must be a complete class or an unbounded array"); + }; + template using __add_rval_ref_t = __add_rvalue_reference(_Tp); + template struct is_move_constructible : public __is_constructible_impl<_Tp, __add_rval_ref_t<_Tp>> { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{ +} +), "template argument must be a complete class or an unbounded array"); + }; + template using __is_assignable_impl = __bool_constant<__is_assignable(_Tp, _Up)>; + template struct is_copy_assignable : public __is_assignable_impl<__add_lval_ref_t<_Tp>, __add_lval_ref_t> { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{ +} +), "template argument must be a complete class or an unbounded array"); + }; + template struct is_same : public __bool_constant<__is_same(_Tp, _Up)> { + }; + template struct remove_const { + }; + template struct add_const { + }; + template struct remove_reference { + }; + template using remove_reference_t = typename remove_reference<_Tp>::type; + template struct add_pointer { + }; + template using __remove_cvref_t = typename remove_cv::type>::type; + template struct conditional { + }; + struct __failure_type { + }; + struct __invoke_memfun_ref { + }; + struct __invoke_other { + }; + template> struct __inv_unwrap { + }; + template struct __result_of_impl { + }; + template struct __invoke_result : public __result_of_impl< is_member_object_pointer< typename remove_reference<_Functor>::type >::value, is_member_function_pointer< typename remove_reference<_Functor>::type >::value, _Functor, _ArgTypes... >::type { + }; + template::value, typename = void> struct __is_invocable_impl : false_type { + }; + template constexpr bool __call_is_nt(__invoke_memfun_ref) { + using _Up = typename __inv_unwrap<_Tp>::type; + return noexcept((std::declval<_Up>().*std::declval<_Fn>())( std::declval<_Args>()...)); + } + template struct __call_is_nothrow : __bool_constant< std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{ +} + ) > { + }; + template struct is_invocable_r : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{ +} +), "_Fn must be a complete class or an unbounded array"); + static_assert((std::__is_complete_or_unbounded( __type_identity<_ArgTypes>{ +} +) && ...), "each argument type must be a complete class or an unbounded array"); + static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{ +} +), "_Ret must be a complete class or an unbounded array"); + }; + template inline constexpr bool is_lvalue_reference_v = false; + template inline constexpr bool is_enum_v = __is_enum(_Tp); + template inline constexpr bool is_union_v = __is_union(_Tp); + template inline constexpr bool is_class_v = __is_class(_Tp); + template inline constexpr bool is_trivial_v = __is_trivial(_Tp); + template inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp); + template inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...); + template inline constexpr bool is_same_v = __is_same(_Tp, _Up); + template inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived); + template inline constexpr bool is_convertible_v = __is_convertible(_From, _To); + template struct common_reference; + template using common_reference_t = typename common_reference<_Tp...>::type; + } + } + namespace std __attribute__ ((__visibility__ ("default"))) { + template inline constexpr _Tp* __addressof(_Tp& __r) noexcept { + } + template [[__nodiscard__]] constexpr typename std::remove_reference<_Tp>::type&& move(_Tp&& __t) noexcept { + } + namespace __detail { + template concept __same_as = std::is_same_v<_Tp, _Up>; + } + template concept same_as = __detail::__same_as<_Tp, _Up> && __detail::__same_as<_Up, _Tp>; + template concept convertible_to = is_convertible_v<_From, _To> && requires { + static_cast<_To>(std::declval<_From>()); + }; + template concept common_reference_with = same_as, common_reference_t<_Up, _Tp>> && convertible_to<_Tp, common_reference_t<_Tp, _Up>> && convertible_to<_Up, common_reference_t<_Tp, _Up>>; + namespace __detail { + template using __cref = const remove_reference_t<_Tp>&; + template concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>; + template constexpr bool __destructible_impl = false; + template requires requires(_Tp& __t) { + { + __t.~_Tp() } + noexcept; + } + constexpr bool __destructible_impl<_Tp> = true; + template constexpr bool __destructible = __destructible_impl<_Tp>; + } + template concept assignable_from = is_lvalue_reference_v<_Lhs> && common_reference_with<__detail::__cref<_Lhs>, __detail::__cref<_Rhs>> && requires(_Lhs __lhs, _Rhs&& __rhs) { + { + __lhs = static_cast<_Rhs&&>(__rhs) } + -> same_as<_Lhs>; + }; + template concept destructible = __detail::__destructible<_Tp>; + template concept constructible_from = destructible<_Tp> && is_constructible_v<_Tp, _Args...>; + template concept default_initializable = constructible_from<_Tp> && requires { + (void) ::new _Tp; + }; + template concept move_constructible = constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>; + namespace ranges { + namespace __swap { + template concept __adl_swap = (std::__detail::__class_or_enum> || std::__detail::__class_or_enum>) && requires(_Tp&& __t, _Up&& __u) { + swap(static_cast<_Tp&&>(__t), static_cast<_Up&&>(__u)); + }; + struct _Swap { + private: template static constexpr bool _S_noexcept() { + if constexpr (__adl_swap<_Tp, _Up>) return noexcept(swap(std::declval<_Tp>(), std::declval<_Up>())); + } + public: template requires __adl_swap<_Tp, _Up> || (same_as<_Tp, _Up> && is_lvalue_reference_v<_Tp> && move_constructible> && assignable_from<_Tp, remove_reference_t<_Tp>>) constexpr void operator()(_Tp&& __t, _Up&& __u) const noexcept(_S_noexcept<_Tp, _Up>()) { + if constexpr (__adl_swap<_Tp, _Up>) swap(static_cast<_Tp&&>(__t), static_cast<_Up&&>(__u)); + else { + } + } + template requires requires(const _Swap& __swap, _Tp& __e1, _Up& __e2) { + __swap(__e1, __e2); + } + constexpr void operator()(_Tp (&__e1)[_Num], _Up (&__e2)[_Num]) const noexcept(noexcept(std::declval()(*__e1, *__e2))) { + for (size_t __n = 0; + __n < _Num; + ++__n) (*this)(__e1[__n], __e2[__n]); + } + }; + } + inline namespace _Cpo { + inline constexpr __swap::_Swap swap{ +}; + } + } + template concept swappable = requires(_Tp& __a, _Tp& __b) { + ranges::swap(__a, __b); + }; + template concept swappable_with = common_reference_with<_Tp, _Up> && requires(_Tp&& __t, _Up&& __u) { + ranges::swap(static_cast<_Tp&&>(__t), static_cast<_Tp&&>(__t)); + }; + namespace __detail { + template concept __boolean_testable_impl = convertible_to<_Tp, bool>; + template concept __boolean_testable = __boolean_testable_impl<_Tp> && requires(_Tp&& __t) { + { + !static_cast<_Tp&&>(__t) } + -> __boolean_testable_impl; + }; + template concept __weakly_eq_cmp_with = requires(__detail::__cref<_Tp> __t, __detail::__cref<_Up> __u) { + { + __t == __u } + -> __boolean_testable; + { + __u == __t } + -> __boolean_testable; + { + __u != __t } + -> __boolean_testable; + }; + } + namespace __detail { + template concept __partially_ordered_with = requires(const remove_reference_t<_Tp>& __t, const remove_reference_t<_Up>& __u) { + { + __t < __u } + -> __boolean_testable; + { + __t <= __u } + -> __boolean_testable; + { + __t >= __u } + -> __boolean_testable; + { + __u < __t } + -> __boolean_testable; + }; + } + template struct __get_first_arg { + }; + template struct __ptr_traits_elem : __get_first_arg<_Ptr> { + }; + template requires requires { + typename _Ptr::element_type; + } + struct __ptr_traits_elem<_Ptr, void> { + }; + template::value> struct __ptr_traits_ptr_to { + using pointer = _Ptr; + using element_type = _Elt; + static pointer pointer_to(element_type& __r) requires requires { + { + pointer::pointer_to(__r) } + -> convertible_to; + } + { + } + }; + namespace __detail { + template using __with_ref = _Tp&; + template concept __can_reference = requires { + typename __with_ref<_Tp>; + }; + template concept __dereferenceable = requires(_Tp& __t) { + { + *__t } + -> __can_reference; + }; + } + namespace ranges { + namespace __imove { + template concept __adl_imove = (std::__detail::__class_or_enum>) && requires(_Tp&& __t) { + iter_move(static_cast<_Tp&&>(__t)); + }; + struct _IterMove { + private: template struct __result { + }; + template static constexpr bool _S_noexcept() { + if constexpr (__adl_imove<_Tp>) return noexcept(iter_move(std::declval<_Tp>())); + } + public: template using __type = typename __result<_Tp>::type; + template [[nodiscard]] constexpr __type<_Tp> operator()(_Tp&& __e) const noexcept(_S_noexcept<_Tp>()) { + } + }; + } + } + template struct incrementable_traits { + }; + namespace __detail { + } + template struct tuple_element; + template using __tuple_element_t = typename tuple_element<__i, _Tp>::type; + template constexpr size_t __find_uniq_type_in_pack() { + constexpr size_t __sz = sizeof...(_Types); + constexpr bool __found[__sz] = { + __is_same(_Tp, _Types) ... }; + size_t __n = __sz; + for (size_t __i = 0; + __i < __sz; + ++__i) { + if (__found[__i]) { + if (__n < __sz) return __sz; + } + } + }; + template struct integer_sequence { + }; + template using make_integer_sequence = integer_sequence<_Tp, __integer_pack(_Num)...>; + template using index_sequence = integer_sequence; + template using make_index_sequence = make_integer_sequence; + template using index_sequence_for = make_index_sequence; + template struct in_place_type_t { + }; + template class tuple; + template class __pair_base { + }; + namespace __detail { + template struct __move_iter_cat { + }; + } + template class move_iterator : public __detail::__move_iter_cat<_Iterator> { + }; + template [[__nodiscard__]] inline constexpr bool operator<(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) requires requires { + { + __x.base() < __y.base() } + -> convertible_to; + } + { + return !(__x < __y); + } + namespace __ops { + template struct _Iter_comp_iter { + _Compare _M_comp; + explicit constexpr _Iter_comp_iter(_Compare __comp) : _M_comp(std::move(__comp)) { + } + template constexpr bool operator()(_Iterator1 __it1, _Iterator2 __it2) { + return bool(_M_comp(*__it1, *__it2)); + } + }; + template constexpr inline _Iter_comp_iter<_Compare> __iter_comp_iter(_Compare __comp) { + } + } + template [[__nodiscard__]] constexpr inline const _Tp& min(const _Tp& __a, const _Tp& __b) { + return __a; + } + template [[__nodiscard__]] constexpr inline const _Tp& max(const _Tp& __a, const _Tp& __b) { + if (__a < __b) return __b; + } + template constexpr inline _Iterator __find_if(_Iterator __first, _Iterator __last, _Predicate __pred) { + } + } + namespace std __attribute__ ((__visibility__ ("default"))) { + struct allocator_arg_t { + struct _Sink { + void constexpr operator=(const void*) { + } + } + _M_a; + }; + template constexpr _Res __invoke_impl(__invoke_other, _Fn&& __f, _Args&&... __args) { + } + template class initializer_list { + typedef size_t size_type; + typedef const _E* iterator; + private: iterator _M_array; + size_type _M_len; + }; + template struct __is_empty_non_tuple : is_empty<_Tp> { + }; + template using __empty_not_final = __conditional_t<__is_final(_Tp), false_type, __is_empty_non_tuple<_Tp>>; + template::value> struct _Head_base; + template struct _Tuple_impl; + template struct _Tuple_impl<_Idx, _Head, _Tail...> : public _Tuple_impl<_Idx + 1, _Tail...>, private _Head_base<_Idx, _Head> { + }; + template constexpr __tuple_element_t<__i, tuple<_Elements...>>& get(tuple<_Elements...>& __t) noexcept { + } + template requires (sizeof...(_Tps) == sizeof...(_Ups)) && (requires (const _Tps& __t, const _Ups& __u) { + { + __t == __u } + -> __detail::__boolean_testable; + } + && ...) constexpr bool operator== [[nodiscard]] (const tuple<_Tps...>& __t, const tuple<_Ups...>& __u) { + return [&](index_sequence<_Inds...>) { + } + (index_sequence_for<_Tps...>{ +} + ); + } + } + typedef struct { + union { + } + __value; + } + __mbstate_t; + namespace std __attribute__ ((__visibility__ ("default"))) { + } + static inline int __gthread_yield (void) { + } + namespace std __attribute__ ((__visibility__ ("default"))) { + template [[nodiscard, __gnu__::__always_inline__]] constexpr _Tp* data(_Tp (&__array)[_Nm]) noexcept { + }; + } + typedef __uint8_t uint8_t; + typedef __uint32_t uint32_t; + namespace std { + namespace __detail { + inline void __thread_yield() noexcept { + } + inline void __thread_relax() noexcept { + } + inline constexpr auto __atomic_spin_count = 16; + struct __default_spin_policy { + bool operator()() const noexcept { + } + }; + template bool __atomic_spin(_Pred& __pred, _Spin __spin = _Spin{ + } + ) noexcept { + for (auto __i = 0; + __i < __atomic_spin_count; + ++__i) { + } + } + } + struct __numeric_limits_base { + }; + template struct numeric_limits : public __numeric_limits_base { + static constexpr bool is_signed = true; + static constexpr bool is_integer = true; + }; + template<> struct numeric_limits { + static constexpr bool is_signed = false; + static constexpr bool is_integer = true; + }; + } + namespace WTF { + template struct IsSmartPtr { + }; + template > struct TypeCastTraits { + }; + template class TypeHasRefMemberFunction { + }; + } + namespace WTF { + } + namespace std { + namespace experimental { + }; + } + namespace std __attribute__ ((__visibility__ ("default"))) { + template struct array { + }; + } + extern "C" { + extern float sqrtf (float __x) noexcept (true); + extern float floorf (float __x) noexcept (true) __attribute__ ((__const__)); + namespace std __attribute__ ((__visibility__ ("default"))) { + constexpr bool isnan(float __x) { + return __builtin_isnan(__x); + } + } + } + constexpr float piFloat = static_cast( 3.14159265358979323846 ); + template typename std::enable_if::value && std::numeric_limits::is_integer && std::numeric_limits::is_integer && std::numeric_limits::is_signed && !std::numeric_limits::is_signed && sizeof(SourceType) >= sizeof(TargetType), TargetType>::type clampTo(SourceType value) { + return static_cast(value); + } + namespace WTF { + constexpr uint32_t roundUpToPowerOfTwo(uint32_t v) { + return v; + }; + template struct VectorTraitsBase; + template struct VectorTraits : VectorTraitsBase && std::is_trivial_v, T> { + }; + } + namespace WTF { + class StringHasher { + }; + enum class DestructionThread : uint8_t { + Any, Main, MainRunLoop }; + } + namespace WebCore { + class IntSize { + public: constexpr IntSize() = default; + void setWidth(int width) { + m_width = width; + } + void setHeight(int height) { + m_height = height; + } + private: int m_width { + 0 }; + int m_height { + 0 }; + }; + inline IntSize& operator+=(IntSize& a, const IntSize& b) { + } + } + namespace WebCore { + class FloatSize { + public: constexpr FloatSize() = default; + constexpr float width() const { + return m_width; + } + constexpr float height() const { + return m_height; + } + private: float m_width { + 0 }; + float m_height { + 0 }; + }; + } + namespace WTF { + class ThreadSafeRefCountedBase { + }; + template class ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr { + }; + } + using WTF::ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr; + namespace WebCore { + class FloatPoint { + }; + inline FloatSize toFloatSize(const FloatPoint& a) { + } + } + namespace WTF { + } + namespace WebCore { + template struct ColorComponents { + template constexpr auto map(F&& function) const -> ColorComponents())), N>; + }; + template struct AlphaTraits; + inline constexpr ColorComponents resolveColorComponents(const ColorComponents& colorComponents) { + return colorComponents.map([] (float component) { + return std::isnan(component) ? 0.0f : component; + } + ); + }; + enum class WhitePoint { + D50, D65 }; + template struct ColorWithAlphaHelper { + }; + template struct RGBAType : ColorWithAlphaHelper { + constexpr RGBAType(T red, T green, T blue, T alpha = AlphaTraits::opaque) : red { + red } + { + } + protected: T red; + }; + } + namespace WebCore { + class RenderingResource : public ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr { + }; + class FilterFunction : public RenderingResource { + }; + class FilterEffect : public FilterFunction { + }; + class AffineTransform { + public: constexpr AffineTransform(); + private: std::array m_transform; + }; + constexpr AffineTransform::AffineTransform() : m_transform { + } + { + } + } + namespace WTF { + } + namespace WebCore { + class FEGaussianBlur : public FilterEffect { + static IntSize calculateUnscaledKernelSize(FloatSize stdDeviation); + }; + } + namespace WTF { + } + namespace WebCore { + static inline float gaussianKernelFactor() { + return 3 / 4.f * sqrtf(2 * piFloat); + } + static int clampedToKernelSize(float value) { + static constexpr unsigned maxKernelSize = 500; + unsigned size = std::max(2, static_cast(floorf(value * gaussianKernelFactor() + 0.5f))); + return clampTo(std::min(size, maxKernelSize)); + } + IntSize FEGaussianBlur::calculateUnscaledKernelSize(FloatSize stdDeviation) { + IntSize kernelSize; + if (stdDeviation.width()) kernelSize.setWidth(clampedToKernelSize(stdDeviation.width())); + if (stdDeviation.height()) kernelSize.setHeight(clampedToKernelSize(stdDeviation.height())); + return kernelSize; + } + }