| 1 |
// { dg-do compile } |
| 2 |
// { dg-additional-options "-Wno-return-type" } |
| 3 |
/* Reduced from libstdc++-v3/testsuite/25_algorithms/equal/1.cc |
| 4 |
|
| 5 |
1.2.ii: In function 'void test1()': |
| 6 |
1.2.ii:104: error: true/false edge after a non-COND_EXPR in bb 15 |
| 7 |
1.2.ii:104: internal compiler error: verify_flow_info failed |
| 8 |
|
| 9 |
*/ |
| 10 |
|
| 11 |
__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t; |
| 12 |
namespace std __attribute__ ((__visibility__ ("default"))) { |
| 13 |
template<typename, typename> struct __are_same { |
| 14 |
enum { |
| 15 |
__value = 0 }; |
| 16 |
}; |
| 17 |
template<typename _Tp> struct __is_integer { |
| 18 |
enum { |
| 19 |
__value = 0 }; |
| 20 |
}; |
| 21 |
template<typename _Tp> struct __is_pointer { |
| 22 |
enum { |
| 23 |
__value = 0 }; |
| 24 |
}; |
| 25 |
template<typename _Tp> struct __is_normal_iterator { |
| 26 |
enum { |
| 27 |
__value = 0 }; |
| 28 |
}; |
| 29 |
struct input_iterator_tag { |
| 30 |
}; |
| 31 |
template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&> struct iterator { |
| 32 |
typedef _Tp value_type; |
| 33 |
}; |
| 34 |
template<typename _Iterator> struct iterator_traits { |
| 35 |
typedef typename _Iterator::value_type value_type; |
| 36 |
}; |
| 37 |
template<typename _Iterator, bool _BoolType = __is_normal_iterator<_Iterator>::__value> struct __niter_base { |
| 38 |
static const _Iterator& __b(const _Iterator& __it) { |
| 39 |
return __it; |
| 40 |
} |
| 41 |
}; |
| 42 |
template<bool _BoolType> struct __equal { |
| 43 |
template<typename _II1, typename _II2> static bool equal(_II1 __first1, _II1 __last1, _II2 __first2) { |
| 44 |
for (; |
| 45 |
__first1 != __last1; |
| 46 |
++__first1, ++__first2) if (!(*__first1 == *__first2)) return false; |
| 47 |
} |
| 48 |
}; |
| 49 |
template<typename _II1, typename _II2> inline bool __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2) { |
| 50 |
typedef typename iterator_traits<_II1>::value_type _ValueType1; |
| 51 |
typedef typename iterator_traits<_II2>::value_type _ValueType2; |
| 52 |
const bool __simple = (__is_integer<_ValueType1>::__value && __is_pointer<_II1>::__value && __is_pointer<_II2>::__value && __are_same<_ValueType1, _ValueType2>::__value); |
| 53 |
return std::__equal<__simple>::equal(__first1, __last1, __first2); |
| 54 |
} |
| 55 |
template<typename _II1, typename _II2> inline bool equal(_II1 __first1, _II1 __last1, _II2 __first2) { |
| 56 |
return std::__equal_aux(__niter_base<_II1>::__b(__first1), __niter_base<_II1>::__b(__last1), __niter_base<_II2>::__b(__first2)); |
| 57 |
} |
| 58 |
} |
| 59 |
extern "C" { |
| 60 |
extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) throw () __attribute__ ((__noreturn__)); |
| 61 |
} |
| 62 |
namespace __gnu_test { |
| 63 |
template<typename T> struct BoundsContainer { |
| 64 |
T* first; |
| 65 |
T* last; |
| 66 |
BoundsContainer(T* _first, T* _last) : first(_first), last(_last) { |
| 67 |
} |
| 68 |
}; |
| 69 |
template<class T> class input_iterator_wrapper:public std::iterator <std::input_iterator_tag, T, ptrdiff_t, T*, T&> { |
| 70 |
public: |
| 71 |
typedef BoundsContainer<T> ContainerType; |
| 72 |
T* ptr; |
| 73 |
ContainerType* SharedInfo; |
| 74 |
input_iterator_wrapper(T* _ptr, ContainerType* SharedInfo_in) : ptr(_ptr), SharedInfo(SharedInfo_in) { |
| 75 |
} |
| 76 |
bool operator==(const input_iterator_wrapper& in) const { |
| 77 |
(static_cast<void> (__builtin_expect (!!(SharedInfo != __null && SharedInfo == in.SharedInfo), 1) ? 0 : (__assert_fail ("SharedInfo != __null && SharedInfo == in.SharedInfo", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/util/testsuite_iterators.h", 201, __PRETTY_FUNCTION__), 0))); |
| 78 |
(static_cast<void> (__builtin_expect (!!(ptr>=SharedInfo->first && in.ptr>=SharedInfo->first), 1) ? 0 : (__assert_fail ("ptr>=SharedInfo->first && in.ptr>=SharedInfo->first", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/util/testsuite_iterators.h", 202, __PRETTY_FUNCTION__), 0))); |
| 79 |
} |
| 80 |
bool operator!=(const input_iterator_wrapper& in) const { |
| 81 |
return !(*this == in); |
| 82 |
} |
| 83 |
T& operator*() const { |
| 84 |
(static_cast<void> (__builtin_expect (!!(SharedInfo && ptr < SharedInfo->last), 1) ? 0 : (__assert_fail ("SharedInfo && ptr < SharedInfo->last", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/util/testsuite_iterators.h", 215, __PRETTY_FUNCTION__), 0))); |
| 85 |
(static_cast<void> (__builtin_expect (!!(ptr >= SharedInfo->first), 1) ? 0 : (__assert_fail ("ptr >= SharedInfo->first", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/util/testsuite_iterators.h", 216, __PRETTY_FUNCTION__), 0))); |
| 86 |
} |
| 87 |
input_iterator_wrapper& operator++() { |
| 88 |
(static_cast<void> (__builtin_expect (!!(SharedInfo && ptr < SharedInfo->last), 1) ? 0 : (__assert_fail ("SharedInfo && ptr < SharedInfo->last", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/util/testsuite_iterators.h", 237, __PRETTY_FUNCTION__), 0))); |
| 89 |
ptr++; |
| 90 |
SharedInfo->first=ptr; |
| 91 |
} |
| 92 |
}; |
| 93 |
template <class T, template<class U> class ItType> struct test_container { |
| 94 |
typename ItType<T>::ContainerType bounds; |
| 95 |
test_container(T* _first, T* _last):bounds(_first, _last) { |
| 96 |
} |
| 97 |
ItType<T> it(T* pos) { |
| 98 |
return ItType<T>(pos, &bounds); |
| 99 |
} |
| 100 |
ItType<T> begin() { |
| 101 |
return it(bounds.first); |
| 102 |
} |
| 103 |
ItType<T> end() { |
| 104 |
} |
| 105 |
}; |
| 106 |
} |
| 107 |
using __gnu_test::test_container; |
| 108 |
using __gnu_test::input_iterator_wrapper; |
| 109 |
typedef test_container<int, input_iterator_wrapper> Container; |
| 110 |
int array1[] = { |
| 111 |
0, 1}; |
| 112 |
int array2[] = { |
| 113 |
1, 0}; |
| 114 |
void test1() { |
| 115 |
Container con1(array1, array1); |
| 116 |
Container con2(array2, array2); |
| 117 |
(static_cast<void> (__builtin_expect (!!(std::equal(con1.begin(), con1.end(), con2.begin())), 1) ? 0 : (__assert_fail ("std::equal(con1.begin(), con1.end(), con2.begin())", "/abuild/rguenther/gcc/libstdc++-v3/testsuite/25_algorithms/equal/1.cc", 35, __PRETTY_FUNCTION__), 0))); |
| 118 |
} |