summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/torture
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/torture')
-rw-r--r--gcc/testsuite/g++.dg/torture/20070621-1.C116
-rw-r--r--gcc/testsuite/g++.dg/torture/20080625-1.C27
-rw-r--r--gcc/testsuite/g++.dg/torture/20090329-1.C59
-rw-r--r--gcc/testsuite/g++.dg/torture/20090706-1.C41
-rw-r--r--gcc/testsuite/g++.dg/torture/20100702-1.C37
-rw-r--r--gcc/testsuite/g++.dg/torture/20100825.C15
-rw-r--r--gcc/testsuite/g++.dg/torture/covariant-1.C33
-rw-r--r--gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C30
-rw-r--r--gcc/testsuite/g++.dg/torture/dg-torture.exp7
-rw-r--r--gcc/testsuite/g++.dg/torture/ipa-cp-1.C18
-rw-r--r--gcc/testsuite/g++.dg/torture/pr27218.C16
-rw-r--r--gcc/testsuite/g++.dg/torture/pr30252.C226
-rw-r--r--gcc/testsuite/g++.dg/torture/pr30567.C32
-rw-r--r--gcc/testsuite/g++.dg/torture/pr31081-1.C23
-rw-r--r--gcc/testsuite/g++.dg/torture/pr31081-2.C48
-rw-r--r--gcc/testsuite/g++.dg/torture/pr31579.C10
-rw-r--r--gcc/testsuite/g++.dg/torture/pr31863.C777
-rw-r--r--gcc/testsuite/g++.dg/torture/pr32304.C9
-rw-r--r--gcc/testsuite/g++.dg/torture/pr32563.C8
-rw-r--r--gcc/testsuite/g++.dg/torture/pr32950.C19
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33134.C21
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33340.C27
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33572.C17
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33589-1.C22
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33589-2.C13
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33627.C57
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33735.C21
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33819.C22
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33887-1.C44
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33887-2.C21
-rw-r--r--gcc/testsuite/g++.dg/torture/pr33887-3.C26
-rw-r--r--gcc/testsuite/g++.dg/torture/pr34099.C25
-rw-r--r--gcc/testsuite/g++.dg/torture/pr34222.C65
-rw-r--r--gcc/testsuite/g++.dg/torture/pr34235.C11
-rw-r--r--gcc/testsuite/g++.dg/torture/pr34241.C18
-rw-r--r--gcc/testsuite/g++.dg/torture/pr34641.C177
-rw-r--r--gcc/testsuite/g++.dg/torture/pr34651.C25
-rw-r--r--gcc/testsuite/g++.dg/torture/pr34850.C75
-rw-r--r--gcc/testsuite/g++.dg/torture/pr34953.C17
-rw-r--r--gcc/testsuite/g++.dg/torture/pr35164-1.C69
-rw-r--r--gcc/testsuite/g++.dg/torture/pr35164-2.C27
-rw-r--r--gcc/testsuite/g++.dg/torture/pr35400.C13
-rw-r--r--gcc/testsuite/g++.dg/torture/pr35526.C18
-rw-r--r--gcc/testsuite/g++.dg/torture/pr36191.C17
-rw-r--r--gcc/testsuite/g++.dg/torture/pr36444.C22
-rw-r--r--gcc/testsuite/g++.dg/torture/pr36445.C23
-rw-r--r--gcc/testsuite/g++.dg/torture/pr36745.C122
-rw-r--r--gcc/testsuite/g++.dg/torture/pr36826.C166
-rw-r--r--gcc/testsuite/g++.dg/torture/pr36960.C22
-rw-r--r--gcc/testsuite/g++.dg/torture/pr37146-1.C83
-rw-r--r--gcc/testsuite/g++.dg/torture/pr37146-2.C67
-rw-r--r--gcc/testsuite/g++.dg/torture/pr37343.C19
-rw-r--r--gcc/testsuite/g++.dg/torture/pr37345.C15
-rw-r--r--gcc/testsuite/g++.dg/torture/pr37354.C14
-rw-r--r--gcc/testsuite/g++.dg/torture/pr37421.C39
-rw-r--r--gcc/testsuite/g++.dg/torture/pr37456.C14
-rw-r--r--gcc/testsuite/g++.dg/torture/pr37716.C56
-rw-r--r--gcc/testsuite/g++.dg/torture/pr37922.C502
-rw-r--r--gcc/testsuite/g++.dg/torture/pr38565.C11
-rw-r--r--gcc/testsuite/g++.dg/torture/pr38705.C27
-rw-r--r--gcc/testsuite/g++.dg/torture/pr38745.C36
-rw-r--r--gcc/testsuite/g++.dg/torture/pr38747.C19
-rw-r--r--gcc/testsuite/g++.dg/torture/pr38811.C73
-rw-r--r--gcc/testsuite/g++.dg/torture/pr39002.C88
-rw-r--r--gcc/testsuite/g++.dg/torture/pr39259.C40
-rw-r--r--gcc/testsuite/g++.dg/torture/pr39362.C105
-rw-r--r--gcc/testsuite/g++.dg/torture/pr39417.C56
-rw-r--r--gcc/testsuite/g++.dg/torture/pr39678.C26
-rw-r--r--gcc/testsuite/g++.dg/torture/pr39713.C25
-rw-r--r--gcc/testsuite/g++.dg/torture/pr39732.C29
-rw-r--r--gcc/testsuite/g++.dg/torture/pr39764.C14
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40081.C16
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40102.C41
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40321.C25
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40323.C68
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40335.C16
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40388.C21
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40389.C84
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40460.C9
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40492.C26
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40642.C26
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40834.C52
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40924.C111
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40991.C113
-rw-r--r--gcc/testsuite/g++.dg/torture/pr41144.C23
-rw-r--r--gcc/testsuite/g++.dg/torture/pr41183.C30
-rw-r--r--gcc/testsuite/g++.dg/torture/pr41186.C29
-rw-r--r--gcc/testsuite/g++.dg/torture/pr41257-2.C16
-rw-r--r--gcc/testsuite/g++.dg/torture/pr41257.C20
-rw-r--r--gcc/testsuite/g++.dg/torture/pr41273.C18
-rw-r--r--gcc/testsuite/g++.dg/torture/pr41680.C23
-rw-r--r--gcc/testsuite/g++.dg/torture/pr41775.C284
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42110.C27
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42183.C51
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42357.C30
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42450.C112
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42462.C47
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42704.C44
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42714.C37
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42739.C16
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42760.C46
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42773.C54
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42871.C40
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42883.C63
-rw-r--r--gcc/testsuite/g++.dg/torture/pr42890.C25
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43068.C10
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43257.C30
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43611.C22
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43784.C24
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43801.C22
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43879-1_0.C11
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43879-1_1.C48
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43880.C16
-rw-r--r--gcc/testsuite/g++.dg/torture/pr43905.C13
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44069.C25
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44148.C60
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44206.C21
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44295.C170
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44357.C228
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44492.C31
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44535.C34
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44809.C6
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44813.C60
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44826.C44
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44900.C76
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44915.C13
-rw-r--r--gcc/testsuite/g++.dg/torture/pr44972.C142
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45393.C38
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45580.C50
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45699.C61
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45709-2.C20
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45709.C19
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45843.C28
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45854.C30
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45874.C58
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45875.C25
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45877.C141
-rw-r--r--gcc/testsuite/g++.dg/torture/pr45934.C23
-rw-r--r--gcc/testsuite/g++.dg/torture/pr46111.C32
-rw-r--r--gcc/testsuite/g++.dg/torture/pr46149.C51
-rw-r--r--gcc/testsuite/g++.dg/torture/pr46154.C17
-rw-r--r--gcc/testsuite/g++.dg/torture/pr46287.C66
-rw-r--r--gcc/testsuite/g++.dg/torture/pr46364.C20
-rw-r--r--gcc/testsuite/g++.dg/torture/pr46367.C11
-rw-r--r--gcc/testsuite/g++.dg/torture/pr46383.C252
-rw-r--r--gcc/testsuite/g++.dg/torture/pr46469.C13
-rw-r--r--gcc/testsuite/g++.dg/torture/pr47290.C19
-rw-r--r--gcc/testsuite/g++.dg/torture/pr47313.C53
-rw-r--r--gcc/testsuite/g++.dg/torture/pr47382.C30
-rw-r--r--gcc/testsuite/g++.dg/torture/pr47541.C27
-rw-r--r--gcc/testsuite/g++.dg/torture/pr47559.C8
-rw-r--r--gcc/testsuite/g++.dg/torture/pr47714.C16
-rw-r--r--gcc/testsuite/g++.dg/torture/pr48165.C38
-rw-r--r--gcc/testsuite/g++.dg/torture/pr48661.C77
-rw-r--r--gcc/testsuite/g++.dg/torture/pr48695.C38
-rw-r--r--gcc/testsuite/g++.dg/torture/pr49039.C76
-rw-r--r--gcc/testsuite/g++.dg/torture/pr49115.C25
-rw-r--r--gcc/testsuite/g++.dg/torture/pr49309.C15
-rw-r--r--gcc/testsuite/g++.dg/torture/pr49615.C29
-rw-r--r--gcc/testsuite/g++.dg/torture/pr49628.C37
-rw-r--r--gcc/testsuite/g++.dg/torture/pr49644.C17
-rw-r--r--gcc/testsuite/g++.dg/torture/pr49720.C8
-rw-r--r--gcc/testsuite/g++.dg/torture/pr50189.C121
-rw-r--r--gcc/testsuite/g++.dg/torture/pr51344.C11
-rw-r--r--gcc/testsuite/g++.dg/torture/pr55355.C23
-rw-r--r--gcc/testsuite/g++.dg/torture/pr56403.C12
-rw-r--r--gcc/testsuite/g++.dg/torture/predcom-1.C29
-rw-r--r--gcc/testsuite/g++.dg/torture/pushpop_macro.C19
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/check.h36
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C57
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C43
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C40
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C40
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C58
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C43
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C73
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C79
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp35
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C17
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h142
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/throw-1.C62
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/throw-2.C53
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/throw-3.C52
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/throw-4.C55
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C12
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C16
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C29
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C35
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C17
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C31
-rw-r--r--gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C31
-rw-r--r--gcc/testsuite/g++.dg/torture/str_empty.C15
-rw-r--r--gcc/testsuite/g++.dg/torture/type-generic-1.C13
193 files changed, 9628 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/torture/20070621-1.C b/gcc/testsuite/g++.dg/torture/20070621-1.C
new file mode 100644
index 000000000..185314a47
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/20070621-1.C
@@ -0,0 +1,116 @@
+/* Reduced from libstdc++-v3/testsuite/25_algorithms/equal/1.cc
+
+1.2.ii: In function 'void test1()':
+1.2.ii:104: error: true/false edge after a non-COND_EXPR in bb 15
+1.2.ii:104: internal compiler error: verify_flow_info failed
+
+*/
+
+__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename, typename> struct __are_same {
+ enum {
+ __value = 0 };
+ };
+ template<typename _Tp> struct __is_integer {
+ enum {
+ __value = 0 };
+ };
+ template<typename _Tp> struct __is_pointer {
+ enum {
+ __value = 0 };
+ };
+ template<typename _Tp> struct __is_normal_iterator {
+ enum {
+ __value = 0 };
+ };
+ struct input_iterator_tag {
+ };
+ template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&> struct iterator {
+ typedef _Tp value_type;
+ };
+ template<typename _Iterator> struct iterator_traits {
+ typedef typename _Iterator::value_type value_type;
+ };
+ template<typename _Iterator, bool _BoolType = __is_normal_iterator<_Iterator>::__value> struct __niter_base {
+ static const _Iterator& __b(const _Iterator& __it) {
+ return __it;
+ }
+ };
+ template<bool _BoolType> struct __equal {
+ template<typename _II1, typename _II2> static bool equal(_II1 __first1, _II1 __last1, _II2 __first2) {
+ for (;
+ __first1 != __last1;
+ ++__first1, ++__first2) if (!(*__first1 == *__first2)) return false;
+ }
+ };
+ template<typename _II1, typename _II2> inline bool __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2) {
+ typedef typename iterator_traits<_II1>::value_type _ValueType1;
+ typedef typename iterator_traits<_II2>::value_type _ValueType2;
+ const bool __simple = (__is_integer<_ValueType1>::__value && __is_pointer<_II1>::__value && __is_pointer<_II2>::__value && __are_same<_ValueType1, _ValueType2>::__value);
+ return std::__equal<__simple>::equal(__first1, __last1, __first2);
+ }
+ template<typename _II1, typename _II2> inline bool equal(_II1 __first1, _II1 __last1, _II2 __first2) {
+ return std::__equal_aux(__niter_base<_II1>::__b(__first1), __niter_base<_II1>::__b(__last1), __niter_base<_II2>::__b(__first2));
+ }
+ }
+extern "C" {
+ extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) throw () __attribute__ ((__noreturn__));
+ }
+namespace __gnu_test {
+ template<typename T> struct BoundsContainer {
+ T* first;
+ T* last;
+ BoundsContainer(T* _first, T* _last) : first(_first), last(_last) {
+ }
+ };
+ template<class T> class input_iterator_wrapper:public std::iterator <std::input_iterator_tag, T, ptrdiff_t, T*, T&> {
+ public:
+ typedef BoundsContainer<T> ContainerType;
+ T* ptr;
+ ContainerType* SharedInfo;
+ input_iterator_wrapper(T* _ptr, ContainerType* SharedInfo_in) : ptr(_ptr), SharedInfo(SharedInfo_in) {
+ }
+ bool operator==(const input_iterator_wrapper& in) const {
+ (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)));
+ (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)));
+ }
+ bool operator!=(const input_iterator_wrapper& in) const {
+ return !(*this == in);
+ }
+ T& operator*() const {
+ (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)));
+ (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)));
+ }
+ input_iterator_wrapper& operator++() {
+ (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)));
+ ptr++;
+ SharedInfo->first=ptr;
+ }
+ };
+ template <class T, template<class T> class ItType> struct test_container {
+ typename ItType<T>::ContainerType bounds;
+ test_container(T* _first, T* _last):bounds(_first, _last) {
+ }
+ ItType<T> it(T* pos) {
+ return ItType<T>(pos, &bounds);
+ }
+ ItType<T> begin() {
+ return it(bounds.first);
+ }
+ ItType<T> end() {
+ }
+ };
+ }
+using __gnu_test::test_container;
+using __gnu_test::input_iterator_wrapper;
+typedef test_container<int, input_iterator_wrapper> Container;
+int array1[] = {
+ 0, 1};
+int array2[] = {
+ 1, 0};
+void test1() {
+ Container con1(array1, array1);
+ Container con2(array2, array2);
+ (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)));
+ }
diff --git a/gcc/testsuite/g++.dg/torture/20080625-1.C b/gcc/testsuite/g++.dg/torture/20080625-1.C
new file mode 100644
index 000000000..b18c28226
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/20080625-1.C
@@ -0,0 +1,27 @@
+extern "C" {
+ typedef unsigned char sal_Bool;
+ typedef struct _rtl_uString {
+ } rtl_uString;
+ void rtl_uString_release( rtl_uString * str ) throw ();
+}
+class OUString {
+ rtl_uString * pData;
+public:
+ OUString() {}
+ ~OUString() {
+ rtl_uString_release( pData );
+ }
+ sal_Bool equalsIgnoreAsciiCase( const OUString & str ) const;
+};
+bool findAndRemove();
+long getAttributeProps()
+{
+ long nAttrs = 0;
+ OUString aValue;
+ if (findAndRemove()
+ && aValue.equalsIgnoreAsciiCase(OUString()))
+ ;
+ else
+ nAttrs |= 1;
+ return nAttrs;
+}
diff --git a/gcc/testsuite/g++.dg/torture/20090329-1.C b/gcc/testsuite/g++.dg/torture/20090329-1.C
new file mode 100644
index 000000000..0274a1944
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/20090329-1.C
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+
+struct input_iterator_tag { };
+template<typename _Category, typename _Tp, typename _Distance = long, typename _Pointer = _Tp*, typename _Reference = _Tp&>
+struct iterator {
+ typedef _Category iterator_category;
+};
+template<typename _Iterator> struct iterator_traits {
+ typedef typename _Iterator::iterator_category iterator_category;
+};
+template<typename, typename> struct __lc_rai {
+ template<typename _II1, typename _II2>
+ static _II1 __newlast1(_II1, _II1 __last1, _II2, _II2) {
+ return __last1;
+ }
+ template<typename _II>
+ static bool __cnd2(_II __first, _II __last) {
+ return __first != __last;
+ }
+};
+template<typename _II1, typename _II2, typename _Compare>
+bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2,
+ _II2 __last2, _Compare __comp) {
+ typedef typename iterator_traits<_II1>::iterator_category _Category1;
+ typedef typename iterator_traits<_II2>::iterator_category _Category2;
+ typedef __lc_rai<_Category1, _Category2> __rai_type;
+ __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
+ for (;
+ __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
+ ++__first1, ++__first2) {
+ if (__comp(*__first1, *__first2)) return true;
+ }
+}
+void __assert_fail () throw () __attribute__ ((__noreturn__));
+template<typename T> struct BoundsContainer { };
+template<class T> class input_iterator_wrapper : public iterator<input_iterator_tag, T, long, T*, T&> {
+public:
+ typedef BoundsContainer<T> ContainerType;
+ T* ptr;
+ ContainerType* SharedInfo;
+ input_iterator_wrapper(const input_iterator_wrapper& in) : ptr(in.ptr), SharedInfo(in.SharedInfo) { }
+ bool operator==(const input_iterator_wrapper& in) const {
+ (static_cast<void> ((SharedInfo != __null
+ && SharedInfo == in.SharedInfo)
+ ? 0 : (__assert_fail (), 0)));
+ }
+ bool operator!=(const input_iterator_wrapper& in) const {
+ return !(*this == in);
+ }
+ T& operator*() const { }
+ input_iterator_wrapper& operator++() { }
+};
+struct X { };
+bool predicate(const X&, const X&) {
+ return true;
+}
+bool test2(input_iterator_wrapper<X>& x) {
+ return lexicographical_compare(x, x, x, x, predicate);
+}
diff --git a/gcc/testsuite/g++.dg/torture/20090706-1.C b/gcc/testsuite/g++.dg/torture/20090706-1.C
new file mode 100644
index 000000000..43a59f0e6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/20090706-1.C
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class new_allocator { };
+ template<typename _Tp> class allocator: public new_allocator<_Tp> { };
+ template<typename _Tp, typename _Alloc> struct _Vector_base { };
+ template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+ class vector : protected _Vector_base<_Tp, _Alloc> { };
+};
+template<int Dim> class Vector { };
+enum CenteringType { VertexType, EdgeType, FaceType, CellType };
+enum ContinuityType { XDim = 1, YDim = XDim << 1, ZDim = YDim << 1 };
+template <int Dim> class Centering {
+public:
+ typedef Vector<Dim> Position;
+ typedef std::vector<Position> Positions;
+ Centering(const Positions &positions);
+ Positions positions_m;
+};
+template <int Dim> class CanonicalCentering {
+ CanonicalCentering();
+ template <class T> static T combine(const T &op1, const T &op2);
+ static Centering<Dim>*** centering_table_m;
+};
+template <int Dim> CanonicalCentering<Dim>::CanonicalCentering()
+{
+ typename Centering<Dim>::Positions positions[Dim][2];
+ enum { x = 0, y, z };
+ int cont = 0;
+ if (Dim > 1)
+ {
+ centering_table_m[EdgeType][cont][YDim] = Centering<Dim>(positions[y][cont]);
+ centering_table_m[EdgeType][cont][XDim|YDim] = Centering<Dim>(combine(positions[x][cont], positions[y][cont]));
+ }
+ if (Dim > 2)
+ {
+ centering_table_m[EdgeType][cont][ZDim] = Centering<Dim>(positions[z][cont]);
+ centering_table_m[EdgeType][cont][XDim|ZDim] = Centering<Dim>(combine(positions[x][cont], positions[z][cont]));
+ }
+}
+template class CanonicalCentering<2>;
diff --git a/gcc/testsuite/g++.dg/torture/20100702-1.C b/gcc/testsuite/g++.dg/torture/20100702-1.C
new file mode 100644
index 000000000..3d223fffb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/20100702-1.C
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-fprefetch-loop-arrays -w" }
+
+class ggPoint3 {
+public:
+ ggPoint3();
+ inline double &x() {
+ return e[0];
+ }
+ inline double &y() {
+ return e[1];
+ }
+ ggPoint3(const ggPoint3 &p);
+ double e[3];
+};
+class ggBox3 {
+public:
+ ggPoint3 min() const;
+};
+class ggHAffineMatrix3;
+ggPoint3 operator*(const ggHAffineMatrix3 &m, const ggPoint3 &v);
+void foo (ggPoint3 *);
+void SetMatrix(ggHAffineMatrix3& toworld, ggBox3& box)
+{
+ ggPoint3 p[2][2][2];
+ int i, j, k;
+ for (i = 0; i < 2; j++)
+ for (k = 0; k < 2; k++)
+ {
+ if (i == 0)
+ p[i][j][k].x() = box.min().x();
+ if (j == 0)
+ p[i][j][k].y() = box.min().y();
+ p[i][j][k] = toworld * p[i][j][k];
+ }
+ foo (&p[0][0][0]);
+}
diff --git a/gcc/testsuite/g++.dg/torture/20100825.C b/gcc/testsuite/g++.dg/torture/20100825.C
new file mode 100644
index 000000000..460c1b608
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/20100825.C
@@ -0,0 +1,15 @@
+// { dg-do run }
+
+typedef enum { zero = 0, one = 1, two = 2, ENUM_MAX = 3 } my_enum;
+my_enum e;
+extern "C" void abort (void);
+int __attribute__((noinline)) foo() { return 10; }
+int main()
+{
+ int r;
+ r = foo();
+ if ((r < 0) || (r >= ENUM_MAX))
+ return 0;
+ e = (my_enum)r;
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/covariant-1.C b/gcc/testsuite/g++.dg/torture/covariant-1.C
new file mode 100644
index 000000000..9f1fd0a52
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/covariant-1.C
@@ -0,0 +1,33 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+class A {
+public:
+ virtual A* getThis() { return this; }
+};
+
+class B {
+int a;
+public:
+ virtual B* getThis() { return this; }
+};
+
+class AB : public A, public B {
+public:
+ virtual AB* getThis() { return this; }
+};
+
+int main ()
+{
+ AB ab;
+
+ A* a = &ab;
+ B* b = &ab;
+
+ if (a->getThis() != a
+ || b->getThis() != b)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C b/gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C
new file mode 100644
index 000000000..2d755ec8d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C
@@ -0,0 +1,30 @@
+/* Test whether the __builtin__CFStringMakeConstantString
+ "function" generates compile-time objects with the correct layout. */
+/* Developed by Ziemowit Laski <zlaski@apple.com>. */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-mconstant-cfstrings" } */
+
+typedef const struct __CFString *CFStringRef;
+
+#ifdef __CONSTANT_CFSTRINGS__
+#define CFSTR(STR) ((CFStringRef) __builtin___CFStringMakeConstantString (STR))
+#else
+#error __CONSTANT_CFSTRINGS__ not defined
+#endif
+
+extern int cond;
+extern const char *func(void);
+
+CFStringRef s0 = CFSTR("Hello" "there");
+
+void foo(void) {
+ const CFStringRef s1 = CFSTR("Str1");
+
+ s0 = s1;
+}
+
+/* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+LC.*\n\[ \\t\]*\\.long\[ \\t\]+4\n" { target { *-*-darwin* && { ! lp64 } } } } } */
+/* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+LC.*\n\[ \\t\]*\\.long\[ \\t\]+10\n" { target { *-*-darwin* && { ! lp64 } } } } } */
+/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t4\n" { target { *-*-darwin* && { lp64 } } } } } */
+/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t10\n" { target { *-*-darwin* && { lp64 } } } } } */
diff --git a/gcc/testsuite/g++.dg/torture/dg-torture.exp b/gcc/testsuite/g++.dg/torture/dg-torture.exp
new file mode 100644
index 000000000..7525e0408
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/dg-torture.exp
@@ -0,0 +1,7 @@
+# This harness is for tests that should be run at all optimisation levels.
+
+load_lib g++-dg.exp
+
+dg-init
+gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C $srcdir/c-c++-common/torture/*.c]] ""
+dg-finish
diff --git a/gcc/testsuite/g++.dg/torture/ipa-cp-1.C b/gcc/testsuite/g++.dg/torture/ipa-cp-1.C
new file mode 100644
index 000000000..37c046d87
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/ipa-cp-1.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+// With IPA-CP, this caused a problem on darwin, where
+// _M_reset is being cloned, it was still being marked
+// as weak and then we had to change the calls to the
+// newly marked function for the non throwing behavior.
+
+int& f(int&);
+inline void _M_reset(int &_M_vbp) throw()
+{
+ f(_M_vbp);
+}
+extern int _S_last_request;
+void _M_allocate_single_object() throw()
+{
+ _M_reset(_S_last_request);
+ _M_reset(_S_last_request);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr27218.C b/gcc/testsuite/g++.dg/torture/pr27218.C
new file mode 100644
index 000000000..b1e18dd33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr27218.C
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+struct Vector
+{
+ double _x, _y;
+};
+typedef Vector Point;
+Vector d;
+static inline Vector f(void)
+{
+ return d;
+}
+void add_duck (void)
+{
+ new Point (f());
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr30252.C b/gcc/testsuite/g++.dg/torture/pr30252.C
new file mode 100644
index 000000000..aabf88f51
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr30252.C
@@ -0,0 +1,226 @@
+/* { dg-do run } */
+/* { dg-options "-fstrict-aliasing" } */
+
+extern "C" void abort (void);
+namespace sigc {
+ template <class T_type>
+ struct type_trait
+ {
+ typedef T_type& pass;
+ typedef const T_type& take;
+ typedef T_type* pointer;
+ };
+ template <class T_base, class T_derived>
+ struct is_base_and_derived
+ {
+ struct big {
+ char memory[64];
+ };
+ static big is_base_class_(...);
+ static char is_base_class_(typename type_trait<T_base>::pointer);
+ static const bool value =
+ sizeof(is_base_class_(reinterpret_cast<typename type_trait<T_derived>::pointer>(0))) ==
+ sizeof(char);
+ };
+ struct nil;
+ struct functor_base {};
+ template <class T_functor, bool I_derives_functor_base=is_base_and_derived<functor_base,T_functor>::value>
+ struct functor_trait
+ {
+ };
+ template <class T_functor>
+ struct functor_trait<T_functor,true>
+ {
+ typedef typename T_functor::result_type result_type;
+ typedef T_functor functor_type;
+ };
+ template <class T_arg1, class T_return>
+ class pointer_functor1 : public functor_base
+ {
+ typedef T_return (*function_type)(T_arg1);
+ function_type func_ptr_;
+ public:
+ typedef T_return result_type;
+ explicit pointer_functor1(function_type _A_func): func_ptr_(_A_func) {}
+ T_return operator()(typename type_trait<T_arg1>::take _A_a1) const
+ { return func_ptr_(_A_a1); }
+ };
+ template <class T_arg1, class T_return>
+ inline pointer_functor1<T_arg1, T_return>
+ ptr_fun1(T_return (*_A_func)(T_arg1))
+ { return pointer_functor1<T_arg1, T_return>(_A_func); }
+ struct adaptor_base : public functor_base {};
+ template <class T_functor,
+ class T_arg1=void,
+ bool I_derives_adaptor_base=is_base_and_derived<adaptor_base,T_functor>::value>
+ struct deduce_result_type
+ { typedef typename functor_trait<T_functor>::result_type type; };
+ template <class T_functor>
+ struct adaptor_functor : public adaptor_base
+ {
+ template <class T_arg1=void>
+ struct deduce_result_type
+ { typedef typename sigc::deduce_result_type<T_functor, T_arg1>::type type; };
+ typedef typename functor_trait<T_functor>::result_type result_type;
+ result_type
+ operator()() const;
+ template <class T_arg1>
+ typename deduce_result_type<T_arg1>::type
+ operator()(T_arg1 _A_arg1) const
+ { return functor_(_A_arg1); }
+ explicit adaptor_functor(const T_functor& _A_functor)
+ : functor_(_A_functor)
+ {}
+ mutable T_functor functor_;
+ };
+ template <class T_functor>
+ typename adaptor_functor<T_functor>::result_type
+ adaptor_functor<T_functor>::operator()() const
+ { return functor_(); }
+ template <class T_functor, bool I_isadaptor = is_base_and_derived<adaptor_base, T_functor>::value> struct adaptor_trait;
+ template <class T_functor>
+ struct adaptor_trait<T_functor, true>
+ {
+ typedef T_functor adaptor_type;
+ };
+ template <class T_functor>
+ struct adaptor_trait<T_functor, false>
+ {
+ typedef typename functor_trait<T_functor>::functor_type functor_type;
+ typedef adaptor_functor<functor_type> adaptor_type;
+ };
+ template <class T_functor>
+ struct adapts : public adaptor_base
+ {
+ typedef typename adaptor_trait<T_functor>::adaptor_type adaptor_type;
+ explicit adapts(const T_functor& _A_functor)
+ : functor_(_A_functor)
+ {}
+ mutable adaptor_type functor_;
+ };
+ template <class T_type>
+ struct reference_wrapper
+ {
+ };
+ template <class T_type>
+ struct unwrap_reference
+ {
+ typedef T_type type;
+ };
+ template <class T_type>
+ class bound_argument
+ {
+ public:
+ bound_argument(const T_type& _A_argument)
+ : visited_(_A_argument)
+ {}
+ inline T_type& invoke()
+ { return visited_; }
+ T_type visited_;
+ };
+ template <class T_wrapped>
+ class bound_argument< reference_wrapper<T_wrapped> >
+ {
+ };
+ template <int I_location, class T_functor, class T_type1=nil>
+ struct bind_functor;
+ template <class T_functor, class T_type1>
+ struct bind_functor<-1, T_functor, T_type1> : public adapts<T_functor>
+ {
+ typedef typename adapts<T_functor>::adaptor_type adaptor_type;
+ typedef typename adaptor_type::result_type result_type;
+ result_type
+ operator()()
+ {
+ return this->functor_.template operator()<typename type_trait<typename unwrap_reference<T_type1>::type>::pass> (bound1_.invoke());
+ }
+ bind_functor(typename type_trait<T_functor>::take _A_func, typename type_trait<T_type1>::take _A_bound1)
+ : adapts<T_functor>(_A_func), bound1_(_A_bound1)
+ {}
+ bound_argument<T_type1> bound1_;
+ };
+ template <class T_type1, class T_functor>
+ inline bind_functor<-1, T_functor,
+ T_type1>
+ bind(const T_functor& _A_func, T_type1 _A_b1)
+ { return bind_functor<-1, T_functor,
+ T_type1>
+ (_A_func, _A_b1);
+ }
+ namespace internal {
+ struct slot_rep;
+ typedef void* (*hook)(slot_rep *);
+ struct slot_rep
+ {
+ hook call_;
+ };
+ }
+ class slot_base : public functor_base
+ {
+ public:
+ typedef internal::slot_rep rep_type;
+ explicit slot_base(rep_type* rep)
+ : rep_(rep)
+ {
+ }
+ mutable rep_type *rep_;
+ };
+ namespace internal {
+ template <class T_functor>
+ struct typed_slot_rep : public slot_rep
+ {
+ typedef typename adaptor_trait<T_functor>::adaptor_type adaptor_type;
+ adaptor_type functor_;
+ inline typed_slot_rep(const T_functor& functor)
+ : functor_(functor)
+ {
+ }
+ };
+ template<class T_functor>
+ struct slot_call0
+ {
+ static void *call_it(slot_rep* rep)
+ {
+ typedef typed_slot_rep<T_functor> typed_slot;
+ typed_slot *typed_rep = static_cast<typed_slot*>(rep);
+ return (typed_rep->functor_)();
+ }
+ static hook address()
+ {
+ return &call_it;
+ }
+ };
+ }
+
+ class slot0 : public slot_base
+ {
+ public:
+ typedef void * (*call_type)(rep_type*);
+ inline void *operator()() const
+ {
+ return slot_base::rep_->call_ (slot_base::rep_);
+ }
+ template <class T_functor>
+ slot0(const T_functor& _A_func)
+ : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
+ {
+ slot_base::rep_->call_ = internal::slot_call0<T_functor>::address();
+ }
+ };
+}
+struct A
+{
+ static void *foo (void *p) { return p; }
+ typedef sigc::slot0 C;
+ C bar();
+};
+A::C A::bar ()
+{
+ return sigc::bind (sigc::ptr_fun1 (&A::foo), (void*)0);
+}
+int main (void)
+{
+ A a;
+ if (a.bar ()() != 0)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr30567.C b/gcc/testsuite/g++.dg/torture/pr30567.C
new file mode 100644
index 000000000..389daf357
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr30567.C
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+
+template <typename T>
+struct const_ref
+{
+ const T* begin;
+ const_ref(const T* b) : begin(b) {}
+};
+
+template <typename T>
+T sum(const_ref<T> const& a)
+{
+ T result = 0;
+ for(unsigned i=0;i<1;i++) result += a.begin[i];
+ return result;
+}
+
+struct tiny_plain
+{
+ int elems[2];
+ tiny_plain() { elems[0]=1; }
+};
+
+struct vec3 : tiny_plain {};
+
+struct mat3
+{
+ int type() const { return sum(const_ref<int>(vec3().elems)) == 1; }
+};
+
+int main() { return mat3().type() ? 0 : 1; }
+
diff --git a/gcc/testsuite/g++.dg/torture/pr31081-1.C b/gcc/testsuite/g++.dg/torture/pr31081-1.C
new file mode 100644
index 000000000..cb11b2148
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr31081-1.C
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+static int get_record (void);
+void f(void);
+int g(void);
+static int get_record (void)
+{
+ int result;
+ try
+ {
+ result = g();
+ f();
+ }
+ catch (const int &) { }
+ return result;
+}
+int NAV_get_record ( )
+{
+ int result;
+ for (;;)
+ if (get_record ())
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr31081-2.C b/gcc/testsuite/g++.dg/torture/pr31081-2.C
new file mode 100644
index 000000000..a14ef3798
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr31081-2.C
@@ -0,0 +1,48 @@
+/* { dg-do compile } */
+
+class CString
+{
+public:
+ CString();
+ ~CString() { operator delete(_rep); }
+ operator const char*() const { return _rep; }
+private:
+ CString(char* cstr);
+ char* _rep;
+};
+
+class String
+{
+public:
+
+ String();
+ String(const char* str);
+ ~String();
+ CString getCString() const;
+};
+
+int is_absolute_path(const char *path);
+
+inline void getAbsolutePath(
+ const char* path,
+ const String& filename)
+{
+ (!is_absolute_path(filename.getCString()) && path);
+ return;
+}
+
+int foo(int &value);
+
+int main(int argc, char** argv)
+{
+ int repeatTestCount = 0;
+ if (foo(repeatTestCount))
+ {
+ repeatTestCount = 1;
+ }
+ for (int numTests = 1; numTests <= repeatTestCount; numTests++)
+ {
+ getAbsolutePath("blah", "blah");
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr31579.C b/gcc/testsuite/g++.dg/torture/pr31579.C
new file mode 100644
index 000000000..131532e63
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr31579.C
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+// middle-end/31579
+// Expand was crashing while expanding the tree for the initializer
+
+struct Industry {
+ unsigned char produced_cargo[2];
+};
+unsigned int a = (((__SIZE_TYPE__)&reinterpret_cast<const volatile
+char&>((((Industry*)(char*)8)->produced_cargo[0]))) - 8);
+
diff --git a/gcc/testsuite/g++.dg/torture/pr31863.C b/gcc/testsuite/g++.dg/torture/pr31863.C
new file mode 100644
index 000000000..8d8ccc43a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr31863.C
@@ -0,0 +1,777 @@
+/* { dg-do link } */
+/* { dg-timeout-factor 2.0 } */
+
+namespace Loki
+{
+ class NullType {};
+ template <class T, class U>
+ struct Typelist
+ {
+ typedef T Head;
+ typedef U Tail;
+ };
+
+
+
+ namespace TL
+ {
+ template
+ <
+ typename T1 = NullType, typename T2 = NullType, typename T3 =
+NullType,
+ typename T4 = NullType, typename T5 = NullType, typename T6 =
+NullType,
+ typename T7 = NullType, typename T8 = NullType, typename T9 =
+NullType,
+ typename T10 = NullType, typename T11 = NullType, typename T12
+= NullType,
+ typename T13 = NullType, typename T14 = NullType, typename T15
+= NullType,
+ typename T16 = NullType, typename T17 = NullType, typename T18
+= NullType,
+ typename T19 = NullType, typename T20 = NullType, typename T21
+= NullType,
+ typename T22 = NullType, typename T23 = NullType, typename T24
+= NullType,
+ typename T25 = NullType, typename T26 = NullType, typename T27
+= NullType,
+ typename T28 = NullType, typename T29 = NullType, typename T30
+= NullType,
+ typename T31 = NullType, typename T32 = NullType, typename T33
+= NullType,
+ typename T34 = NullType, typename T35 = NullType, typename T36
+= NullType,
+ typename T37 = NullType, typename T38 = NullType, typename T39
+= NullType,
+ typename T40 = NullType
+ >
+ struct MakeTypelist
+ {
+ private:
+ typedef typename MakeTypelist
+ <
+ T2 , T3 , T4 ,
+ T5 , T6 , T7 ,
+ T8 , T9 , T10,
+ T11, T12, T13,
+ T14, T15, T16,
+ T17, T18, T19,
+ T20, T21, T22,
+ T23, T24, T25,
+ T26, T27, T28,
+ T29, T30, T31,
+ T32, T33, T34,
+ T35, T36, T37,
+ T38, T39, T40
+ >
+ ::Result TailResult;
+
+ public:
+ typedef Typelist<T1, TailResult> Result;
+ };
+
+ template<>
+ struct MakeTypelist<>
+ {
+ typedef NullType Result;
+ };
+
+ }
+}
+template <class Key>
+class Factory;
+
+template <class Key, bool iW>
+struct Context
+{
+ typedef Key KeyType;
+ enum
+ {
+ isWrite = iW
+ };
+};
+
+namespace detail
+{
+
+template <class Key, bool isWrite>
+class CreatorUnitBaseImpl
+{
+public:
+ typedef Context<Key, isWrite> Context_;
+private:
+ typedef void*(CreatorUnitBaseImpl::*CreateFun)(Context_&, unsigned&, const
+Key&);
+ CreateFun createFun_;
+
+protected:
+ virtual void* createUninitialized () = 0;
+ template <class Value>
+ void* createImpl (Context_& ctx, unsigned& ver, const Key& k)
+ {
+ return createUninitialized();
+ }
+private:
+ CreatorUnitBaseImpl();
+public:
+ template <class Value>
+ CreatorUnitBaseImpl (Value*) :
+ createFun_( &CreatorUnitBaseImpl::template createImpl<Value> )
+ {
+ }
+
+ virtual ~CreatorUnitBaseImpl () {}
+
+ CreatorUnitBaseImpl(const CreatorUnitBaseImpl& s)
+ : createFun_(s.createFun_)
+ {
+ }
+
+ CreatorUnitBaseImpl& operator=(const CreatorUnitBaseImpl& s)
+ {
+ createFun_ = s.createFun_;
+ return *this;
+ }
+ void* create (Context_& ctx, unsigned& ver, const Key& k)
+ {
+ return (this->*createFun_)(ctx, ver, k);
+ }
+};
+
+template <class Key>
+class Creator : protected CreatorUnitBaseImpl<Key, true>, protected
+CreatorUnitBaseImpl<Key, false>
+{
+public:
+ typedef void* (*CreatorFun) ();
+
+private:
+ CreatorFun fun_;
+protected:
+ virtual void* createUninitialized ()
+ {
+ if (fun_)
+ return (*fun_)();
+ return 0;
+ }
+private:
+ Creator ();
+public:
+ template <class Value>
+ Creator (CreatorFun f, Value*) :
+ CreatorUnitBaseImpl<Key, true>((Value*)0),
+ CreatorUnitBaseImpl<Key, false>((Value*)0),
+ fun_(f)
+ {
+ }
+
+ Creator(const Creator& s) :
+ CreatorUnitBaseImpl<Key, true>(s),
+ CreatorUnitBaseImpl<Key, false>(s),
+ fun_(s.fun_)
+ {
+
+ }
+
+ Creator& operator=(const Creator& s)
+ {
+ CreatorUnitBaseImpl<Key, true>::operator=(s);
+ CreatorUnitBaseImpl<Key, false>::operator=(s);
+ fun_ = s.fun_;
+ return *this;
+ }
+
+ virtual ~Creator ()
+ {
+ }
+
+ template <class Context>
+ void* createObject (Context& ctx, unsigned& ver, const Key& k)
+ {
+ void* r = CreatorUnitBaseImpl<Key, Context::isWrite>::create(ctx, ver,
+k);
+ return r;
+ }
+};
+
+}
+
+template <class Key>
+class Factory
+{
+public:
+ typedef Key KeyType;
+ typedef void* (*CreatorFun) ();
+ typedef detail::Creator<Key> Creator;
+public:
+ Factory () {}
+ ~Factory () {}
+
+ template <class Value>
+ bool registerCreator (const Key& k, CreatorFun fun)
+ {
+ return true;
+ }
+ template <class Context>
+ void* createObject (const Key& k, Context& ctx, unsigned& ver)
+ {
+ return 0;
+ }
+};
+
+template <class Key, class Base, Key key>
+struct ClassSpec
+{
+ typedef Key KeyType;
+ typedef Base BaseType;
+ enum {KeyValue = key};
+};
+
+template <class Key, class T>
+class Serializer;
+
+template <class Key, class Base, Key key>
+class Serializer<Key, ClassSpec <Key, Base, key> >
+ : public virtual Factory<Key>
+{
+ typedef Key KeyType;
+ typedef Base BaseType;
+ enum {KeyValue = key};
+ typedef Factory<Key> Inherited;
+ typedef Serializer<Key, ClassSpec< Key, Base, key > > SelfType;
+
+ static void* create ()
+ {
+ return (void*) (new BaseType);
+ }
+public:
+ Serializer()
+ {
+ Inherited::template registerCreator<BaseType>(
+ KeyValue,
+ &SelfType::create);
+ }
+};
+
+template <class Key, class Head>
+class Serializer<Key, Loki::Typelist<Head, Loki::NullType> >:
+ public Serializer<Key, Head>
+{
+};
+
+template <class Key, class Head, class Tail>
+class Serializer<Key, Loki::Typelist<Head, Tail> >:
+ public virtual Serializer<Key, Head>,
+ public virtual Serializer<Key, Tail>
+{
+};
+
+template <class Key>
+class Serializer<Key, Loki::NullType> : public virtual Factory<Key>
+{
+};
+
+
+
+
+typedef unsigned KeyType;
+
+
+
+typedef Factory<KeyType> FactoryType;
+
+typedef KeyType Key;
+
+struct A001
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 1; }
+ static const char* className () {return "A001";}
+};
+
+struct A002
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 2; }
+ static const char* className () {return "A002";}
+};
+
+struct A003
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 3; }
+ static const char* className () {return "A003";}
+};
+
+struct A004
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 4; }
+ static const char* className () {return "A004";}
+};
+
+struct A005
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 5; }
+ static const char* className () {return "A005";}
+};
+
+struct A006
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 6; }
+ static const char* className () {return "A006";}
+};
+
+struct A007
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 7; }
+ static const char* className () {return "A007";}
+};
+
+struct A008
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 8; }
+ static const char* className () {return "A008";}
+};
+
+struct A009
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 9; }
+ static const char* className () {return "A009";}
+};
+
+struct A010
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 10; }
+ static const char* className () {return "A010";}
+};
+
+struct A011
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 11; }
+ static const char* className () {return "A011";}
+};
+
+struct A012
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 12; }
+ static const char* className () {return "A012";}
+};
+
+struct A013
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 13; }
+ static const char* className () {return "A013";}
+};
+
+struct A014
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 14; }
+ static const char* className () {return "A014";}
+};
+
+struct A015
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 15; }
+ static const char* className () {return "A015";}
+};
+
+struct A016
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 16; }
+ static const char* className () {return "A016";}
+};
+
+struct A017
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 17; }
+ static const char* className () {return "A017";}
+};
+
+struct A018
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 18; }
+ static const char* className () {return "A018";}
+};
+
+struct A019
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 19; }
+ static const char* className () {return "A019";}
+};
+
+struct A020
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 20; }
+ static const char* className () {return "A020";}
+};
+
+struct A021
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 21; }
+ static const char* className () {return "A021";}
+};
+
+struct A022
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 22; }
+ static const char* className () {return "A022";}
+};
+
+struct A023
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 23; }
+ static const char* className () {return "A023";}
+};
+
+struct A024
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 24; }
+ static const char* className () {return "A024";}
+};
+
+struct A025
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 25; }
+ static const char* className () {return "A025";}
+};
+
+struct A026
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 26; }
+ static const char* className () {return "A026";}
+};
+
+struct A027
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 27; }
+ static const char* className () {return "A027";}
+};
+
+struct A028
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 28; }
+ static const char* className () {return "A028";}
+};
+
+struct A029
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 29; }
+ static const char* className () {return "A029";}
+};
+
+struct A030
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 30; }
+ static const char* className () {return "A030";}
+};
+
+struct A031
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 31; }
+ static const char* className () {return "A031";}
+};
+
+struct A032
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 32; }
+ static const char* className () {return "A032";}
+};
+
+struct A033
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 33; }
+ static const char* className () {return "A033";}
+};
+
+struct A034
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 34; }
+ static const char* className () {return "A034";}
+};
+
+struct A035
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 35; }
+ static const char* className () {return "A035";}
+};
+
+struct A036
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 36; }
+ static const char* className () {return "A036";}
+};
+
+struct A037
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 37; }
+ static const char* className () {return "A037";}
+};
+
+struct A038
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 38; }
+ static const char* className () {return "A038";}
+};
+
+struct A039
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 39; }
+ static const char* className () {return "A039";}
+};
+
+struct A040
+{
+ template <class Context>
+ bool serialize(Context& ctx, unsigned& ver)
+ {
+ return true;
+ }
+ static Key classId() { return 40; }
+ static const char* className () {return "A040";}
+};
+
+Factory<Key>& getInstance()
+{
+ static Serializer<Key,
+ Loki::TL::MakeTypelist<
+ ClassSpec<Key, A001, 1>,
+ ClassSpec<Key, A002, 2>,
+ ClassSpec<Key, A003, 3>,
+ ClassSpec<Key, A004, 4>,
+ ClassSpec<Key, A005, 5>,
+ ClassSpec<Key, A006, 6>,
+ ClassSpec<Key, A007, 7>,
+ ClassSpec<Key, A008, 8>,
+ ClassSpec<Key, A009, 9>,
+ ClassSpec<Key, A010, 10>,
+ ClassSpec<Key, A011, 11>,
+ ClassSpec<Key, A012, 12>,
+ ClassSpec<Key, A013, 13>,
+ ClassSpec<Key, A014, 14>,
+ ClassSpec<Key, A015, 15>,
+ ClassSpec<Key, A016, 16>,
+ ClassSpec<Key, A017, 17>,
+ ClassSpec<Key, A018, 18>,
+ ClassSpec<Key, A019, 19>,
+ ClassSpec<Key, A020, 20>,
+ ClassSpec<Key, A021, 21>,
+ ClassSpec<Key, A022, 22>,
+ ClassSpec<Key, A023, 23>,
+ ClassSpec<Key, A024, 24>,
+ ClassSpec<Key, A025, 25>,
+ ClassSpec<Key, A026, 26>,
+ ClassSpec<Key, A027, 27>,
+ ClassSpec<Key, A028, 28>,
+ ClassSpec<Key, A029, 29>,
+ ClassSpec<Key, A030, 30>,
+ ClassSpec<Key, A031, 31>,
+ ClassSpec<Key, A032, 32>,
+ ClassSpec<Key, A033, 33>,
+ ClassSpec<Key, A034, 34>,
+ ClassSpec<Key, A035, 35>,
+ ClassSpec<Key, A036, 36>,
+ ClassSpec<Key, A037, 37>,
+ ClassSpec<Key, A038, 38>,
+ ClassSpec<Key, A039, 39>,
+ ClassSpec<Key, A040, 40>
+ >::Result
+ > instance;
+ return instance;
+}
+
+int main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr32304.C b/gcc/testsuite/g++.dg/torture/pr32304.C
new file mode 100644
index 000000000..236d00b97
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr32304.C
@@ -0,0 +1,9 @@
+// { dg-do compile }
+
+struct S {
+ S() {}
+};
+S f() {
+ static S s;
+ return s;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr32563.C b/gcc/testsuite/g++.dg/torture/pr32563.C
new file mode 100644
index 000000000..d536b3faa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr32563.C
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+struct A
+{
+ char c[1];
+} a;
+
+const __SIZE_TYPE__ i = (__SIZE_TYPE__)&a.c[0] - 1;
diff --git a/gcc/testsuite/g++.dg/torture/pr32950.C b/gcc/testsuite/g++.dg/torture/pr32950.C
new file mode 100644
index 000000000..8d64296e4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr32950.C
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+struct A
+{
+ __complex__ double c;
+};
+
+struct B
+{
+ A a;
+ B(A x) : a(x) {}
+ void foo();
+};
+
+void bar()
+{
+ B b = A();
+ B(b).foo();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr33134.C b/gcc/testsuite/g++.dg/torture/pr33134.C
new file mode 100644
index 000000000..43482c7fc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33134.C
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* Used to crash in VRP. */
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+
+class FXObject;
+class FXStream
+{
+ public:FXStream (const FXObject *cont = __null);
+ FXStream & operator<< (const unsigned char &v);
+};
+
+bool fxsaveGIF (FXStream &store)
+{
+ int bitsperpixel;
+ unsigned char c1;
+ c1 = 0x80;
+ c1 |= (bitsperpixel - 1) << 4;
+ store << c1;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr33340.C b/gcc/testsuite/g++.dg/torture/pr33340.C
new file mode 100644
index 000000000..bac882156
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33340.C
@@ -0,0 +1,27 @@
+void* operator new(__SIZE_TYPE__, void* __p) { }
+
+struct auto_ptr {
+ int* p;
+ ~auto_ptr() { delete p; }
+};
+
+typedef void* T;
+struct vector {
+ void push_back(const T& __x) {
+ ::new(0) T(__x);
+ insert(__x);
+ }
+ void insert(const T& __x);
+} v;
+
+void g();
+void f() {
+ auto_ptr ap;
+ if (ap.p) {
+ ap.p = new int();
+ }
+ g();
+ int* tmp = ap.p;
+ ap.p = 0;
+ v.push_back(tmp);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr33572.C b/gcc/testsuite/g++.dg/torture/pr33572.C
new file mode 100644
index 000000000..91cd073fd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33572.C
@@ -0,0 +1,17 @@
+// { dg-do run }
+#include <vector>
+#include <memory>
+
+struct Foo { virtual void f() {} };
+
+int main(int argc, char**)
+{
+ std::auto_ptr<Foo> foo;
+ if (argc >= 0) {
+ foo.reset(new Foo());
+ } else {
+ std::vector<int> v;
+ }
+ Foo* p = foo.release();
+ p->f();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr33589-1.C b/gcc/testsuite/g++.dg/torture/pr33589-1.C
new file mode 100644
index 000000000..eea89f421
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33589-1.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+struct base { void somemethod() {} };
+struct derived : public base { };
+
+struct smartpointer
+{
+ ~smartpointer() { }
+ operator derived*() const
+ {
+ return 0;
+ }
+};
+typedef void ( derived::* methodptr_type )();
+methodptr_type getmemberptr()
+{
+ return &derived::somemethod;
+}
+void somefunction()
+{
+ smartpointer pObj;
+ ( pObj->*getmemberptr() )();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr33589-2.C b/gcc/testsuite/g++.dg/torture/pr33589-2.C
new file mode 100644
index 000000000..325892bc6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33589-2.C
@@ -0,0 +1,13 @@
+// { dg-do compile }
+
+void f(void*) throw();
+
+void somefunction()
+{
+try {
+ void (*g)(void*) = (void (*)(void*))f;
+ void (*g2)(int*) = (void (*)(int*))g;
+ g2(0);
+} catch (...)
+{throw;}
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr33627.C b/gcc/testsuite/g++.dg/torture/pr33627.C
new file mode 100644
index 000000000..a14e34551
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33627.C
@@ -0,0 +1,57 @@
+/* { dg-do compile } */
+
+typedef unsigned int UT_uint32;
+typedef UT_uint32 PT_DocPosition;
+typedef UT_uint32 PT_BlockOffset;
+typedef enum _PTStruxType { PTX_Block } PTStruxType;
+typedef UT_uint32 PL_ListenerId;
+typedef const void * PL_StruxFmtHandle;
+class PX_ChangeRecord;
+class pf_Frag {
+ public:
+ typedef enum _PFType { PFT_Object } PFType;
+ inline PFType getType(void) const { }
+ inline pf_Frag * getNext(void) const { }
+ PT_DocPosition getPos(void) const { }
+};
+class pf_Fragments {
+ public:
+ pf_Frag * getFirst() const;
+};
+class pt_PieceTable {
+ bool getStruxOfTypeFromPosition(PL_ListenerId listenerId, PT_DocPosition docPos, PTStruxType pts, PL_StruxFmtHandle * psfh) const;
+ bool _tellAndMaybeAddListener(PL_ListenerId listenerId, bool bAdd);
+ pf_Fragments m_fragments;
+};
+class pf_Frag_Object : public pf_Frag
+{
+ public:
+ virtual bool createSpecialChangeRecord(PX_ChangeRecord ** ppcr, PT_DocPosition dpos, PT_BlockOffset blockOffset) const;
+};
+bool pt_PieceTable::_tellAndMaybeAddListener(PL_ListenerId listenerId, bool bAdd)
+{
+ PL_StruxFmtHandle sfh = 0;
+ PT_DocPosition sum = 0;
+ UT_uint32 blockOffset = 0;
+ for (pf_Frag * pf = m_fragments.getFirst(); (pf); pf=pf->getNext())
+ {
+ pf_Frag_Object * pfo = static_cast<pf_Frag_Object *> (pf);
+ PX_ChangeRecord * pcr = __null;
+ bool bStatus1 = false;
+ if(sfh != __null) {
+ bStatus1 = pfo->createSpecialChangeRecord(&pcr,sum,blockOffset);
+ if (!(bStatus1))
+ return (false);
+ }
+ else
+ {
+ PT_DocPosition pos = pf->getPos();
+ getStruxOfTypeFromPosition(listenerId,pos,PTX_Block,&sfh);
+ bStatus1 = pfo->createSpecialChangeRecord(&pcr,pos,blockOffset);
+ if (!(bStatus1))
+ return (false);
+ }
+ if (!(bStatus1))
+ return (false);
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr33735.C b/gcc/testsuite/g++.dg/torture/pr33735.C
new file mode 100644
index 000000000..0a90745b9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33735.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+#include <string>
+typedef struct _ts { } PyThreadState;
+PyThreadState * Py_NewInterpreter(void);
+void Py_EndInterpreter(PyThreadState *);
+class ApplicationError {
+public:
+ ApplicationError(std::string errormsg) : errormsg(errormsg) { }
+ std::string errormsg;
+};
+void run()
+{
+ PyThreadState *py_state=__null;
+ try {
+ if (!(py_state=Py_NewInterpreter()))
+ throw ApplicationError("error");
+ }
+ catch(ApplicationError e) {
+ Py_EndInterpreter(py_state);
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr33819.C b/gcc/testsuite/g++.dg/torture/pr33819.C
new file mode 100644
index 000000000..a2f868dae
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33819.C
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+
+class s
+{
+public:
+ s(long long aa) : a(aa), i1(0) { }
+ long long id() const { return (this->a << 16) >> 16; }
+ bool operator< (s sv) { return this->a < sv.id(); }
+private:
+ long long a : 48;
+ int i1 : 16;
+};
+s g(1);
+extern "C" void abort (void);
+int
+main(int, char**)
+{
+ if (g < (1LL << 38) - 1)
+ return 0;
+ abort ();
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr33887-1.C b/gcc/testsuite/g++.dg/torture/pr33887-1.C
new file mode 100644
index 000000000..2f17d9583
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33887-1.C
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+struct S { unsigned int i : 24; } x;
+void __attribute__((noinline)) test1()
+{
+ if (--x.i != 0x00ffffff)
+ abort ();
+ if (x.i != 0x00ffffff)
+ abort ();
+}
+void __attribute__((noinline)) test2()
+{
+ if (x.i-- != 0)
+ abort ();
+ if (x.i != 0x00ffffff)
+ abort ();
+}
+void __attribute__((noinline)) test3()
+{
+ if (++x.i != 0)
+ abort ();
+ if (x.i != 0)
+ abort ();
+}
+void __attribute__((noinline)) test4()
+{
+ if (x.i++ != 0x00ffffff)
+ abort ();
+ if (x.i != 0)
+ abort ();
+}
+int main()
+{
+ x.i = 0;
+ test1();
+ x.i = 0;
+ test2();
+ x.i = 0x00ffffff;
+ test3();
+ x.i = 0x00ffffff;
+ test4();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr33887-2.C b/gcc/testsuite/g++.dg/torture/pr33887-2.C
new file mode 100644
index 000000000..f64cfad96
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33887-2.C
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+extern "C" void abort() __attribute__ ((noreturn));
+
+struct s
+{
+ unsigned long long f1 : 40;
+ unsigned int f2 : 24;
+} sv;
+
+int main()
+{
+ int f2;
+ sv.f2 = (1 << 24) - 1;
+ __asm__ volatile ("" : : : "memory");
+ ++sv.f2;
+ f2 = sv.f2;
+ if (f2 != 0)
+ abort();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr33887-3.C b/gcc/testsuite/g++.dg/torture/pr33887-3.C
new file mode 100644
index 000000000..b4b883fba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr33887-3.C
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+
+struct s
+{
+ unsigned long long f1 : 40;
+ unsigned int f2 : 24;
+};
+
+s sv;
+
+void __attribute__((noinline)) foo(unsigned int i)
+{
+ unsigned int tmp;
+ sv.f2 = i;
+ tmp = sv.f2;
+ if (tmp != 0)
+ abort ();
+}
+
+int main()
+{
+ foo (0xff000000u);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr34099.C b/gcc/testsuite/g++.dg/torture/pr34099.C
new file mode 100644
index 000000000..49fa9cac1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr34099.C
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+#include <complex>
+
+typedef std::complex<double> NumType;
+
+void
+multiply(NumType a, NumType b, unsigned ac, NumType &ab)
+{
+ NumType s;
+ for (unsigned j=0; j<ac; j++)
+ s = a * b;
+ ab = s;
+}
+extern "C" void abort (void);
+int main()
+{
+ NumType a(1,2), b(3,-2), c;
+ multiply(a, b, 1, c);
+ if (c.real() != 7
+ || c.imag() != 4)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr34222.C b/gcc/testsuite/g++.dg/torture/pr34222.C
new file mode 100644
index 000000000..130896dc9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr34222.C
@@ -0,0 +1,65 @@
+/* { dg-do compile } */
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<class _CharT> struct char_traits;
+ }
+__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ typedef ptrdiff_t streamsize;
+ template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ifstream;
+ typedef basic_ifstream<char> ifstream;
+ class ios_base {
+ };
+ }
+template<class T> class Vector4 {
+ public:
+ inline Vector4();
+ inline Vector4(T, T, T, T);
+ T x, y, z, w;
+ };
+template<class T> class Matrix4 {
+ public:
+ Matrix4(const Vector4<T>&, const Vector4<T>&, const Vector4<T>&, const Vector4<T>&);
+ Matrix4(const Matrix4<T>& m);
+ Vector4<T> r[4];
+ };
+typedef Vector4<float> Vec4f;
+typedef Matrix4<float> Mat4f;
+template<class T> Vector4<T>::Vector4() : x(0), y(0), z(0), w(0) {
+ }
+template<class T> Vector4<T>::Vector4(T _x, T _y, T _z, T _w) : x(_x), y(_y), z(_z), w(_w) {
+ }
+template<class T> Matrix4<T>::Matrix4(const Vector4<T>& v0, const Vector4<T>& v1, const Vector4<T>& v2, const Vector4<T>& v3) {
+ }
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _CharT, typename _Traits> class basic_ios : public ios_base {
+ };
+ template<typename _CharT, typename _Traits> class basic_istream : virtual public basic_ios<_CharT, _Traits> {
+ public:
+ typedef _CharT char_type;
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ __istream_type& read(char_type* __s, streamsize __n);
+ };
+ template<typename _CharT, typename _Traits> class basic_ifstream : public basic_istream<_CharT, _Traits> {
+ };
+ }
+using namespace std;
+static float readFloat(ifstream& in) {
+ float f;
+ in.read((char*) &f, sizeof(float));
+ }
+Mat4f readMeshMatrix(ifstream& in, int nBytes) {
+ float m00 = readFloat(in);
+ float m01 = readFloat(in);
+ float m02 = readFloat(in);
+ float m10 = readFloat(in);
+ float m11 = readFloat(in);
+ float m12 = readFloat(in);
+ float m20 = readFloat(in);
+ float m21 = readFloat(in);
+ float m22 = readFloat(in);
+ float m30 = readFloat(in);
+ float m31 = readFloat(in);
+ float m32 = readFloat(in);
+ return Mat4f(Vec4f(m00, m01, m02, 0), Vec4f(m10, m11, m12, 0), Vec4f(m20, m21, m22, 0), Vec4f(m30, m31, m32, 1));
+ }
diff --git a/gcc/testsuite/g++.dg/torture/pr34235.C b/gcc/testsuite/g++.dg/torture/pr34235.C
new file mode 100644
index 000000000..5f05841c5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr34235.C
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+int main()
+{
+ short x = -1;
+ unsigned int c = ((unsigned int)x) >> 1;
+ if (c != 0x7fffffff)
+ abort();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr34241.C b/gcc/testsuite/g++.dg/torture/pr34241.C
new file mode 100644
index 000000000..70f186c5b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr34241.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+inline void *operator new (__SIZE_TYPE__, void *__p) throw ()
+{
+ return __p;
+}
+struct A
+{
+ A(int, double);
+ inline explicit A (int pattern, bool cs)
+ {
+ new (this) A (pattern, double(cs));
+ }
+};
+A test ()
+{
+ const A a (42, true);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr34641.C b/gcc/testsuite/g++.dg/torture/pr34641.C
new file mode 100644
index 000000000..0cf507762
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr34641.C
@@ -0,0 +1,177 @@
+// { dg-do compile }
+// { dg-require-effective-target fpic }
+// { dg-require-visibility "" }
+// { dg-options "-fPIC" }
+
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" void *
+malloc (size_t __size)
+throw () __attribute__ ((__malloc__));
+ namespace std __attribute__ ((__visibility__ ("default")))
+{
+ using::size_t;
+}
+inline void *operator
+new (std::size_t, void *__p)
+throw ()
+{
+ return __p;
+}
+template < class _T1, class _T2 > struct pair
+{
+ _T1 first;
+ _T2 second;
+ pair (const _T1 & __a, const _T2 & __b):first (__a), second (__b)
+ {
+ }
+ template < class _U1, class _U2 >
+ pair (const pair < _U1, _U2 > &__p):first (__p.first), second (__p.second)
+ {
+ }
+};
+
+template < class _T1, class _T2 >
+ inline pair < _T1, _T2 > make_pair (_T1 __x, _T2 __y)
+{
+ return pair < _T1, _T2 > (__x, __y);
+}
+template < typename _Tp > inline const _Tp &
+max (const _Tp & __a, const _Tp & __b)
+{
+}
+typedef unsigned short int uint16_t;
+typedef unsigned long int uintptr_t;
+typedef uint16_t UChar;
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ struct __numeric_limits_base
+ {
+ };
+ template < typename _Tp > struct numeric_limits:public __numeric_limits_base
+ {
+ static _Tp max () throw ()
+ {
+ }
+ };
+}
+
+template < typename T > class VectorBufferBase
+{
+public:
+ void allocateBuffer (size_t newCapacity)
+ {
+ if (newCapacity > std::numeric_limits < size_t >::max () / sizeof (T))
+ *(int *) (uintptr_t) 0xbbadbeef = 0;
+ }
+};
+
+template < typename T, size_t inlineCapacity > class VectorBuffer;
+template < typename T > class VectorBuffer < T, 0 >:private VectorBufferBase <
+ T >
+{
+public:
+ typedef VectorBufferBase < T > Base;
+ using Base::allocateBuffer;
+};
+
+template < typename T, size_t inlineCapacity = 0 > class Vector
+{
+ typedef VectorBuffer < T, inlineCapacity > Impl;
+public:
+ typedef T *iterator;
+ size_t size () const
+ {
+ return m_size;
+ }
+ size_t capacity () const
+ {
+ }
+ iterator begin ()
+ {
+ }
+ iterator end ()
+ {
+ return begin () + m_size;
+ }
+ void shrink (size_t size);
+ void reserveCapacity (size_t newCapacity);
+ void clear ()
+ {
+ shrink (0);
+ }
+ template < typename U > void append (const U &);
+ void expandCapacity (size_t newMinCapacity);
+ template < typename U > U * expandCapacity (size_t newMinCapacity, U *);
+ size_t m_size;
+ Impl m_impl;
+};
+template < typename T, size_t inlineCapacity >
+ void Vector < T, inlineCapacity >::expandCapacity (size_t newMinCapacity)
+{
+ reserveCapacity (max
+ (newMinCapacity,
+ max (static_cast < size_t > (16),
+ capacity () + capacity () / 4 + 1)));
+}
+
+template < typename T, size_t inlineCapacity >
+ template < typename U >
+ inline U * Vector < T,
+ inlineCapacity >::expandCapacity (size_t newMinCapacity, U * ptr)
+{
+ expandCapacity (newMinCapacity);
+}
+template < typename T, size_t inlineCapacity >
+ void Vector < T, inlineCapacity >::reserveCapacity (size_t newCapacity)
+{
+ m_impl.allocateBuffer (newCapacity);
+}
+template < typename T, size_t inlineCapacity >
+ template < typename U >
+ inline void Vector < T, inlineCapacity >::append (const U & val)
+{
+ const U *ptr = &val;
+ if (size () == capacity ())
+ ptr = expandCapacity (size () + 1, ptr);
+ new (end ())T (*ptr);
+}
+
+class Range;
+class TextIterator
+{
+public:
+ explicit TextIterator (const Range *,
+ bool emitCharactersBetweenAllVisiblePositions =
+ false);
+ bool atEnd () const
+ {
+ }
+ void advance ();
+ int length () const
+ {
+ }
+};
+UChar *
+plainTextToMallocAllocatedBuffer (const Range * r, unsigned &bufferLength)
+{
+ static const unsigned cMaxSegmentSize = 1 << 16;
+ typedef pair < UChar *, unsigned >TextSegment;
+ Vector < TextSegment > *textSegments = 0;
+ Vector < UChar > textBuffer;
+ for (TextIterator it (r); !it.atEnd (); it.advance ())
+ {
+ if (textBuffer.size ()
+ && textBuffer.size () + it.length () > cMaxSegmentSize)
+ {
+ UChar *newSegmentBuffer =
+ static_cast <
+ UChar * >(malloc (textBuffer.size () * sizeof (UChar)));
+ if (!textSegments)
+ textSegments = new Vector < TextSegment >;
+ textSegments->
+ append (make_pair (newSegmentBuffer, textBuffer.size ()));
+ textBuffer.clear ();
+ }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr34651.C b/gcc/testsuite/g++.dg/torture/pr34651.C
new file mode 100644
index 000000000..2fce4d7a1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr34651.C
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+
+typedef bool Bool;
+struct CString {
+ CString (const char * =__null);
+ CString & operator += (const CString &);
+};
+struct THotKey {
+ short Key;
+ Bool Control;
+ Bool Shift;
+ Bool Alt;
+};
+THotKey m_HotKey;
+THotKey GetHotKey () { return m_HotKey; }
+void Serialize ()
+{
+ THotKey inHotKey (GetHotKey());
+ CString outCombinaison (inHotKey.Control
+ ? ((inHotKey.Alt || inHotKey.Shift)
+ ? "ctrl+" : "ctrl")
+ : __null);
+ outCombinaison += inHotKey.Alt ? inHotKey.Shift ? "alt+" : "alt" : "";
+ outCombinaison += inHotKey.Shift ? "shift" : "";
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr34850.C b/gcc/testsuite/g++.dg/torture/pr34850.C
new file mode 100644
index 000000000..4f630f837
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr34850.C
@@ -0,0 +1,75 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+
+typedef unsigned char uint8_t;
+typedef unsigned int uint32_t;
+typedef uint8_t byte;
+typedef uint32_t u32bit;
+__extension__ typedef __SIZE_TYPE__ size_t;
+extern "C" {
+ extern void __warn_memset_zero_len (void) __attribute__((__warning__ ("")));
+ extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
+ void * memset (void *__dest, int __ch, size_t __len) throw () {
+ if (__builtin_constant_p (__len) && __len == 0)
+ __warn_memset_zero_len (); /* { dg-warning "declared with attribute warning" } */
+ }
+}
+inline void clear_mem(void* ptr, u32bit n) {
+ memset(ptr, 0, n);
+}
+template<typename T> class MemoryRegion {
+public:
+ u32bit size() const {
+ }
+ const T* begin() const {
+ }
+ void set(const T in[], u32bit n) {
+ create(n);
+ }
+ void set(const MemoryRegion<T>& in) {
+ set(in.begin(), in.size());
+ }
+ void clear() {
+ clear_mem(buf, allocated);
+ }
+ void create(u32bit);
+ MemoryRegion() {
+ used = allocated = 0;
+ }
+ mutable T* buf;
+ mutable u32bit used;
+ mutable u32bit allocated;
+};
+template<typename T> void MemoryRegion<T>::create(u32bit n) {
+ if(n <= allocated) {
+ clear();
+ }
+}
+template<typename T> class SecureVector : public MemoryRegion<T> {
+public:
+ SecureVector<T>& operator=(const MemoryRegion<T>& in) {
+ if(this != &in) set(in);
+ }
+};
+class OctetString {
+public:
+ SecureVector<byte> bits_of() const {
+ }
+ OctetString& operator^=(const OctetString&);
+ void change(const MemoryRegion<byte>& in) {
+ bits = in;
+ }
+ OctetString(const MemoryRegion<byte>& in) {
+ change(in);
+ }
+ SecureVector<byte> bits;
+};
+OctetString& OctetString::operator^=(const OctetString& k) {
+ if(&k == this) {
+ bits.clear();
+ }
+}
+bool __attribute__((flatten))
+operator==(const OctetString& s1, const OctetString& s2) {
+ return (s1.bits_of() == s2.bits_of());
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr34953.C b/gcc/testsuite/g++.dg/torture/pr34953.C
new file mode 100644
index 000000000..5d7b38c92
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr34953.C
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+void B_CLEAR(void* ret);
+void B_NeverReturns(void* ret) __attribute__((noreturn));
+
+int main()
+{
+ const struct AutoErrPop { ~AutoErrPop() { } } AutoErrPopper = { };
+ B_NeverReturns(0);
+}
+
+void B_NeverReturns(void* ret)
+{
+ B_CLEAR(ret); /* Never returns (does a setjmp/goto) */
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr35164-1.C b/gcc/testsuite/g++.dg/torture/pr35164-1.C
new file mode 100644
index 000000000..1704c2226
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr35164-1.C
@@ -0,0 +1,69 @@
+typedef __SIZE_TYPE__ size_t;
+template<typename _Iterator, typename _Container> class __normal_iterator {
+public:
+ const _Iterator& base() const;
+};
+template<typename _BI1, typename _BI2> inline
+void copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) {
+ while (__first != __last) *--__result = *--__last;
+}
+template<typename _Tp> struct _Vector_base {
+ struct _Vector_impl { _Tp* _M_finish; };
+ _Vector_impl _M_impl;
+};
+template<typename _Tp > class vector : protected _Vector_base<_Tp> {
+ typedef vector<_Tp> vector_type;
+ typedef _Tp * pointer;
+ typedef _Tp & reference;
+ typedef __normal_iterator<pointer, vector_type> iterator;
+ typedef size_t size_type;
+public:
+ iterator end();
+ void resize(size_type __new_size) { insert(end(), __new_size); }
+ reference operator[](size_type __n);
+ void insert(iterator __position, size_type __n)
+ {
+ pointer __old_finish(this->_M_impl._M_finish);
+ copy_backward(__position.base(), __old_finish - __n, __old_finish);
+ }
+};
+struct A {
+ virtual ~A ();
+ void incRef ();
+ void decRef ();
+};
+struct C : public A {
+ static C *alloc ();
+};
+template <class T> struct B {
+ B () : ptr (T::alloc ()) { }
+ B (T *a_ptr) : ptr (a_ptr) { }
+ ~B () { decRef (); }
+ B& operator= (const B<T>& a) { if (a.get () != this->get ()) { decRef ();
+incRef (); } }
+ template<class U> operator B<U> () const { return B<U> (ptr); }
+ T* operator-> () const { }
+ T* get () const { return ptr; }
+ void decRef () const { if (ptr != 0) ptr->decRef (); }
+ void incRef () const { if (ptr != 0) ptr->incRef (); }
+ T *ptr;
+};
+struct D : public C {
+ template <class T> inline void foo (const B<T> & x) { d.resize (1); d[0] = x;
+}
+ vector<B <C> > d;
+};
+struct E : public C {
+ static E *alloc ();
+};
+struct F : public D {
+ static F *alloc ();
+};
+void foo (vector<B<D> > & x) {
+ for (int i = 0; i < 2; ++i)
+ {
+ B<F> l;
+ B<E> m;
+ l->foo (m);
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr35164-2.C b/gcc/testsuite/g++.dg/torture/pr35164-2.C
new file mode 100644
index 000000000..463cad7f7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr35164-2.C
@@ -0,0 +1,27 @@
+struct __shared_count {
+ __shared_count() { _M_pi = new int; }
+ int * _M_pi;
+};
+template<typename _Tp>
+class __shared_ptr {
+public:
+ __shared_ptr(_Tp* __p);
+ void reset(int * __p) {
+ __shared_ptr(__p).swap(*this);
+ }
+ void swap(__shared_ptr<_Tp>& __other) {
+ __other._M_refcount._M_pi = _M_refcount._M_pi;
+ }
+ __shared_count _M_refcount;
+};
+template<typename _Tp> class shared_ptr : public __shared_ptr<_Tp> {};
+int main() {
+ for (shared_ptr<int> *iter;;)
+ {
+ try {
+ (iter++)->reset(new int);
+ }
+ catch (...) {
+ }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr35400.C b/gcc/testsuite/g++.dg/torture/pr35400.C
new file mode 100644
index 000000000..021135df8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr35400.C
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-Wtype-limits" } */
+
+struct A
+{
+ A();
+ ~A();
+};
+
+void foo()
+{
+ A x[1];
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr35526.C b/gcc/testsuite/g++.dg/torture/pr35526.C
new file mode 100644
index 000000000..d0a8e6d2c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr35526.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+extern void *memcpy (void *__dest, __const void *__src, __SIZE_TYPE__ __n);
+
+char internal_crash_read_ip[] = { 0xb8 };
+
+struct u_internal_crash_read_t
+{
+ char ip[sizeof (internal_crash_read_ip)];
+}
+u_internal_crash_read;
+
+void
+gSignalHandler (int psignalNr, int pinfo, int pctx)
+{
+ memcpy (u_internal_crash_read.ip, internal_crash_read_ip,
+ sizeof (internal_crash_read_ip));
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr36191.C b/gcc/testsuite/g++.dg/torture/pr36191.C
new file mode 100644
index 000000000..175707d1b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr36191.C
@@ -0,0 +1,17 @@
+// PR c++/36191
+// { dg-do compile }
+// { dg-options "-fnon-call-exceptions" }
+// { dg-skip-if "Frame pointer required for unwind tables" { m68k*-*-* fido*-*-* } "-fomit-frame-pointer" "" }
+
+__complex__ double
+foo (__complex__ double x, double y)
+{
+ try
+ {
+ return x / y;
+ }
+ catch (char *s)
+ {
+ return x;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr36444.C b/gcc/testsuite/g++.dg/torture/pr36444.C
new file mode 100644
index 000000000..ae639e25d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr36444.C
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
+#define vector __attribute__((vector_size(16) ))
+struct struct1 {
+ union {} vmx;
+ struct struct2 {
+ struct2(const struct2& r) {}
+ } w;
+} __attribute__((aligned(16)));
+struct struct3 {
+ vector float vmx;
+ operator const struct1& () const{
+ return *reinterpret_cast<const struct1*>(this);
+ }
+};
+struct3 func3( struct3 V1);
+struct3 func2( void );
+void func1( ) {
+ struct1 vVec = func2() ;
+ func3 ( (struct3&)vVec );
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr36445.C b/gcc/testsuite/g++.dg/torture/pr36445.C
new file mode 100644
index 000000000..56642e9ec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr36445.C
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
+// This used to fail as we would try to expand a VCE where one side had
+// a mode of BLKmode and the other side was a vector mode.
+#define vector __attribute__((vector_size(16) ))
+struct struct1 {
+ union { float a[3]; } vmx;
+ struct struct2 {
+ struct2(const struct2& r) {}
+ } w;
+} __attribute__((aligned(16)));
+struct struct3 {
+ vector float vmx;
+ operator const struct1& () const{
+ return *reinterpret_cast<const struct1*>(this);
+ }
+};
+struct3 func3( struct3 V1);
+struct3 func2( void );
+void func1( ) {
+ struct1 vVec = func2() ;
+ func3 ( (struct3&)vVec );
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr36745.C b/gcc/testsuite/g++.dg/torture/pr36745.C
new file mode 100644
index 000000000..53845aaa7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr36745.C
@@ -0,0 +1,122 @@
+/* PR target/36745 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-require-effective-target fpic } */
+
+typedef __SIZE_TYPE__ size_t;
+class QBasicAtomicInt
+{
+public:
+ int _q_value;
+ inline bool operator== (int value) const
+ {
+ }
+ bool ref ();
+ bool deref ();
+};
+inline bool
+QBasicAtomicInt::ref ()
+{
+ __asm__ ("": "=m" (_q_value): :);
+ return true;
+}
+
+namespace std
+{
+ using::size_t;
+}
+extern "C++"
+{
+ inline void *operator new (std::size_t, void *__p)
+ {
+ return __p;
+ }
+}
+struct QMapData
+{
+ QBasicAtomicInt ref;
+ static QMapData shared_null;
+};
+template < class Key, class T > class QMap
+{
+ QMapData *d;
+public: inline QMap ():d (&QMapData::shared_null)
+ {
+ }
+ inline ~ QMap ()
+ {
+ if (!d->ref.deref ())
+ freeData (d);
+ }
+ void freeData (QMapData * d);
+};
+struct QVectorData
+{
+ QBasicAtomicInt ref;
+ static QVectorData shared_null;
+};
+template < typename T > struct QVectorTypedData
+{
+ QBasicAtomicInt ref;
+};
+template < typename T > class QVector
+{
+ union
+ {
+ QVectorData *p;
+ QVectorTypedData < T > *d;
+ };
+public: inline QVector ():p (&QVectorData::shared_null)
+ {
+ d->ref.ref ();
+ }
+ inline void detach ()
+ {
+ if (d->ref == 1)
+ detach_helper ();
+ }
+ inline T *data ()
+ {
+ detach ();
+ }
+ T & operator[](int i);
+ void detach_helper ();
+ void realloc ();
+};
+template < typename T > void QVector < T >::detach_helper ()
+{
+ realloc ();
+}
+
+template < typename T > inline T & QVector < T >::operator[](int i)
+{
+ return data ()[i];
+}
+template < typename T > void QVector < T >::realloc ()
+{
+ T *j, *i;
+ i->~T ();
+ while (j-- == i)
+ new (j) T;
+}
+
+void
+mergeInto (QVector < int >*a)
+{
+};
+struct QRegExpAutomatonState
+{
+ QVector < int >outs;
+ QMap < int, int >reenter;
+ QMap < int, int >anchors;
+};
+class QRegExpEngine
+{
+ void addCatTransitions ();
+ QVector < QRegExpAutomatonState > s;
+};
+void
+QRegExpEngine::addCatTransitions ()
+{
+ mergeInto (&s[2].outs);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr36826.C b/gcc/testsuite/g++.dg/torture/pr36826.C
new file mode 100644
index 000000000..436220ba8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr36826.C
@@ -0,0 +1,166 @@
+template <class T> T CoinMax(register const T x1, register const T x2);
+template <class T> T CoinMin(register const T x1, register const T x2);
+class CoinIndexedVector;
+class ClpModel {
+protected:
+ double objectiveScale_;
+ double rhsScale_;
+ int numberRows_;
+ int numberColumns_;
+ double * rowActivity_;
+ double * columnActivity_;
+ double * dual_;
+ double * reducedCost_;
+ double* rowLower_;
+ double* rowUpper_;
+ double * rowObjective_;
+ double * columnLower_;
+ double * columnUpper_;
+ double * rowScale_;
+ double * columnScale_;
+ double * inverseRowScale_;
+ double * inverseColumnScale_;
+ int problemStatus_;
+ int secondaryStatus_;
+};
+class ClpSimplex : public ClpModel {
+ void deleteRim(int getRidOfFactorizationData=2);
+ double upperOut_;
+ double dualTolerance_;
+ double primalTolerance_;
+ double * rowLowerWork_;
+ double * columnLowerWork_;
+ double * rowUpperWork_;
+ double * columnUpperWork_;
+ double * rowObjectiveWork_;
+ CoinIndexedVector * columnArray_[6];
+ double * reducedCostWork_;
+ double * rowActivityWork_;
+ double * columnActivityWork_;
+ ClpSimplex * auxiliaryModel_;
+};
+class CoinIndexedVector {
+public:
+ void clear();
+};
+void ClpSimplex::deleteRim(int getRidOfFactorizationData)
+{
+ int numberRows=numberRows_;
+ int numberColumns=numberColumns_;
+ int i;
+ int numberPrimalScaled=0;
+ int numberPrimalUnscaled=0;
+ int numberDualScaled=0;
+ int numberDualUnscaled=0;
+ double scaleC = 1.0/objectiveScale_;
+ double scaleR = 1.0/rhsScale_;
+ if (!inverseColumnScale_) {
+ for (i=0; i<numberColumns; i++)
+ {
+ double scaleFactor = columnScale_[i];
+ double valueScaled = columnActivityWork_[i];
+ double lowerScaled = columnLowerWork_[i];
+ double upperScaled = columnUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) {
+ if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_)
+ numberPrimalScaled++;
+ else
+ upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled));
+ }
+ columnActivity_[i] = valueScaled*scaleFactor*scaleR;
+ double value = columnActivity_[i];
+ if (value<columnLower_[i]-primalTolerance_)
+ numberPrimalUnscaled++;
+ else if (value>columnUpper_[i]+primalTolerance_)
+ numberPrimalUnscaled++;
+ double valueScaledDual = reducedCostWork_[i];
+ if (valueScaled>columnLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_)
+ numberDualScaled++;
+ if (valueScaled<columnUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_)
+ numberDualScaled++;
+ reducedCost_[i] = (valueScaledDual*scaleC)/scaleFactor;
+ double valueDual = reducedCost_[i];
+ if (value>columnLower_[i]+primalTolerance_&&valueDual>dualTolerance_)
+ numberDualUnscaled++;
+ if (value<columnUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_)
+ numberDualUnscaled++;
+ }
+ for (i=0; i<numberRows; i++)
+ {
+ double scaleFactor = rowScale_[i];
+ double valueScaled = rowActivityWork_[i];
+ double lowerScaled = rowLowerWork_[i];
+ double upperScaled = rowUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) { if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled)); }
+ rowActivity_[i] = (valueScaled*scaleR)/scaleFactor;
+ double value = rowActivity_[i];
+ if (value<rowLower_[i]-primalTolerance_) numberPrimalUnscaled++;
+ else if (value>rowUpper_[i]+primalTolerance_) numberPrimalUnscaled++;
+ double valueScaledDual = dual_[i]+rowObjectiveWork_[i];
+ ;
+ if (valueScaled>rowLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_) numberDualScaled++;
+ if (valueScaled<rowUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_) numberDualScaled++;
+ dual_[i] *= scaleFactor*scaleC;
+ double valueDual = dual_[i];
+ if (rowObjective_) valueDual += rowObjective_[i];
+ if (value>rowLower_[i]+primalTolerance_&&valueDual>dualTolerance_) numberDualUnscaled++;
+ if (value<rowUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_) numberDualUnscaled++;
+ }
+ }
+ const double * inverseScale = inverseColumnScale_;
+ for (i=0; i<numberColumns; i++)
+ {
+ double scaleFactor = columnScale_[i];
+ double valueScaled = columnActivityWork_[i];
+ double lowerScaled = columnLowerWork_[i];
+ double upperScaled = columnUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) { if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled)); }
+ columnActivity_[i] = valueScaled*scaleFactor*scaleR;
+ double value = columnActivity_[i];
+ if (value<columnLower_[i]-primalTolerance_) numberPrimalUnscaled++;
+ else if (value>columnUpper_[i]+primalTolerance_) numberPrimalUnscaled++;
+ double valueScaledDual = reducedCostWork_[i];
+ if (valueScaled>columnLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_) numberDualScaled++;
+ if (valueScaled<columnUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_) numberDualScaled++;
+ reducedCost_[i] = (valueScaledDual*scaleC)*inverseScale[i];
+ double valueDual = reducedCost_[i];
+ if (value>columnLower_[i]+primalTolerance_&&valueDual>dualTolerance_) numberDualUnscaled++;
+ if (value<columnUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_) numberDualUnscaled++;
+ }
+ inverseScale = inverseRowScale_;
+ for (i=0; i<numberRows; i++)
+ {
+ double scaleFactor = rowScale_[i];
+ double valueScaled = rowActivityWork_[i];
+ double lowerScaled = rowLowerWork_[i];
+ double upperScaled = rowUpperWork_[i];
+ if (lowerScaled>-1.0e20||upperScaled<1.0e20) { if (valueScaled<lowerScaled-primalTolerance_|| valueScaled>upperScaled+primalTolerance_) numberPrimalScaled++; else upperOut_ = CoinMax(upperOut_,CoinMin(valueScaled-lowerScaled,upperScaled-valueScaled)); }
+ rowActivity_[i] = (valueScaled*scaleR)*inverseScale[i];
+ double value = rowActivity_[i];
+ if (value<rowLower_[i]-primalTolerance_) numberPrimalUnscaled++;
+ else if (value>rowUpper_[i]+primalTolerance_) numberPrimalUnscaled++;
+ double valueScaledDual = dual_[i]+rowObjectiveWork_[i];
+ ;
+ if (valueScaled>rowLowerWork_[i]+primalTolerance_&&valueScaledDual>dualTolerance_) numberDualScaled++;
+ if (valueScaled<rowUpperWork_[i]-primalTolerance_&&valueScaledDual<-dualTolerance_) numberDualScaled++;
+ dual_[i] *= scaleFactor*scaleC;
+ double valueDual = dual_[i];
+ if (rowObjective_) valueDual += rowObjective_[i];
+ if (value>rowLower_[i]+primalTolerance_&&valueDual>dualTolerance_) numberDualUnscaled++;
+ if (value<rowUpper_[i]-primalTolerance_&&valueDual<-dualTolerance_) numberDualUnscaled++;
+ }
+ if (numberPrimalUnscaled) {
+ if (numberDualUnscaled)
+ secondaryStatus_=4;
+ else
+ secondaryStatus_=2;
+ }
+ if (numberDualUnscaled)
+ secondaryStatus_=3;
+ int iRow,iColumn;
+ for (iRow=0; iRow<4; iRow++)
+ ;
+ for (iColumn=0; iColumn<2; iColumn++)
+ if (columnArray_[iColumn])
+ columnArray_[iColumn]->clear();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr36960.C b/gcc/testsuite/g++.dg/torture/pr36960.C
new file mode 100644
index 000000000..280a6755d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr36960.C
@@ -0,0 +1,22 @@
+// { dg-do run }
+
+struct Lower {
+ const int& ref;
+ Lower(const int& ref) : ref(ref) { }
+};
+struct Middle : public virtual Lower {
+ Middle(const int& ref) : Lower(ref) { }
+};
+struct Upper : public Middle {
+ Upper(const int& ref) : Lower(ref), Middle(ref) { }
+ int get() { return ref; }
+};
+extern "C" void abort (void);
+int main()
+{
+ int i = 0;
+ Upper upper(i);
+ if (upper.get() != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr37146-1.C b/gcc/testsuite/g++.dg/torture/pr37146-1.C
new file mode 100644
index 000000000..ea65226f1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr37146-1.C
@@ -0,0 +1,83 @@
+// PR c++/37146
+// { dg-do run }
+
+extern "C" void abort ();
+int a, b;
+struct A { int i:8; int j:8; int k:16; int l:32; } c;
+
+void
+f1 (int x, int y)
+{
+ (x ? a : b) = y;
+}
+
+void
+f2 (int x, int y)
+{
+ (x ? c.i : c.j) = y;
+}
+
+void
+f3 (int x, int y)
+{
+ (x ? c.i : a) = y;
+}
+
+void
+f4 (int x, int y)
+{
+ (x ? c.i : c.k) = y;
+}
+
+void
+f5 (int x, int y)
+{
+ (x ? c.l : b) = y;
+}
+
+#define CHECK(var, exp) \
+ do \
+ { \
+ if (var != exp) \
+ abort (); \
+ var = -1; \
+ if (a != -1 \
+ || b != -1 \
+ || c.i != -1 \
+ || c.j != -1 \
+ || c.k != -1 \
+ || c.l != -1) \
+ abort (); \
+ } \
+ while (0)
+
+int
+main ()
+{
+ a = -1;
+ b = -1;
+ c.i = -1;
+ c.j = -1;
+ c.k = -1;
+ c.l = -1;
+ f1 (1, 264);
+ CHECK (a, 264);
+ f1 (0, 264);
+ CHECK (b, 264);
+ f2 (1, 112);
+ CHECK (c.i, 112);
+ f2 (0, 112);
+ CHECK (c.j, 112);
+ f3 (1, 26);
+ CHECK (c.i, 26);
+ f3 (0, 26);
+ CHECK (a, 26);
+ f4 (1, 107);
+ CHECK (c.i, 107);
+ f4 (0, 107);
+ CHECK (c.k, 107);
+ f5 (1, 95);
+ CHECK (c.l, 95);
+ f5 (0, 95);
+ CHECK (b, 95);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr37146-2.C b/gcc/testsuite/g++.dg/torture/pr37146-2.C
new file mode 100644
index 000000000..2a5417694
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr37146-2.C
@@ -0,0 +1,67 @@
+// PR c++/37146
+// { dg-do run }
+
+extern "C" void abort ();
+int a, b;
+struct A { int i:8; int j:8; int k:16; int l:32; } c;
+
+int
+f1 (int x)
+{
+ return x ? a : b;
+}
+
+int
+f2 (int x)
+{
+ return x ? c.i : c.j;
+}
+
+int
+f3 (int x)
+{
+ return x ? c.i : a;
+}
+
+int
+f4 (int x)
+{
+ return x ? c.i : c.k;
+}
+
+int
+f5 (int x)
+{
+ return x ? c.l : b;
+}
+
+int
+main ()
+{
+ a = 17;
+ b = 18;
+ c.i = 19;
+ c.j = 20;
+ c.k = 21;
+ c.l = 22;
+ if (f1 (1) != a)
+ abort ();
+ if (f1 (0) != b)
+ abort ();
+ if (f2 (1) != c.i)
+ abort ();
+ if (f2 (0) != c.j)
+ abort ();
+ if (f3 (1) != c.i)
+ abort ();
+ if (f3 (0) != a)
+ abort ();
+ if (f4 (1) != c.i)
+ abort ();
+ if (f4 (0) != c.k)
+ abort ();
+ if (f5 (1) != c.l)
+ abort ();
+ if (f5 (0) != b)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr37343.C b/gcc/testsuite/g++.dg/torture/pr37343.C
new file mode 100644
index 000000000..c4614f39f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr37343.C
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+typedef enum RW { rwBitmapGrey, rwBitmapGrey16 } RW;
+void FindDepth(RW);
+void ParseDumpBitmap(RW kind, int maxfiles)
+{
+ static const RW normalTypes[] = { };
+ const RW *bitmapTypes;
+ int i;
+ switch (kind) {
+ case rwBitmapGrey:
+ case rwBitmapGrey16:
+ bitmapTypes = &kind;
+ break;
+ default:
+ bitmapTypes = normalTypes;
+ }
+ for (i = 0; i < maxfiles; i++)
+ FindDepth(bitmapTypes[i]);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr37345.C b/gcc/testsuite/g++.dg/torture/pr37345.C
new file mode 100644
index 000000000..5b49f5306
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr37345.C
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+class EbmlElement {
+ virtual EbmlElement * Clone() const;
+};
+class KaxTracks : public EbmlElement {
+public:
+ EbmlElement * Clone() const {
+ return new KaxTracks(*this);
+ }
+};
+KaxTracks kax_tracks;
+void finish_file(void)
+{
+ kax_tracks.Clone();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr37354.C b/gcc/testsuite/g++.dg/torture/pr37354.C
new file mode 100644
index 000000000..acdf29110
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr37354.C
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+class GenericClass;
+struct AlsaDriver
+{
+ virtual int _read (unsigned nframes);
+};
+typedef void (GenericClass::*GenericMemFuncType) ();
+GenericMemFuncType m_pFunction;
+void AlsaDriver1 ()
+{
+ m_pFunction = reinterpret_cast < GenericMemFuncType > (&AlsaDriver::_read);
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr37421.C b/gcc/testsuite/g++.dg/torture/pr37421.C
new file mode 100644
index 000000000..4b8447eac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr37421.C
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+
+#include <stdio.h>
+#include <string.h>
+
+inline int
+bci (const float &source)
+{
+ int dest;
+ memcpy (&dest, &source, sizeof (dest));
+ return dest;
+}
+
+inline float
+bcf (const int &source)
+{
+ float dest;
+ memcpy (&dest, &source, sizeof (dest));
+ return dest;
+}
+
+float
+Foo ()
+{
+ const int foo = bci (0.0f);
+ int bar = foo;
+ const int baz = foo & 1;
+ if (!baz && (foo & 2))
+ bar = 0;
+ return bcf (bar);
+}
+
+int
+main ()
+{
+ printf ("Foo() = %f\n", Foo());
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr37456.C b/gcc/testsuite/g++.dg/torture/pr37456.C
new file mode 100644
index 000000000..cf2021be2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr37456.C
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+int zot(int);
+struct bar {
+ ~bar() { }
+};
+int x;
+void doit(int a, int b, int c)
+{
+ bar pn;
+ int b1 = zot(a) * c;
+ int b2 = zot(b) * c;
+ x = b1 + b2;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr37716.C b/gcc/testsuite/g++.dg/torture/pr37716.C
new file mode 100644
index 000000000..13b98d68a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr37716.C
@@ -0,0 +1,56 @@
+// PR tree-optimization/37716
+// { dg-do compile }
+
+struct A
+{
+ struct B
+ {
+ int a, b, c, d;
+ void *e[1];
+ };
+ B *d;
+ inline void **f1 (int i) const
+ {
+ return d->e + d->c + i;
+ }
+};
+
+template <typename T>
+struct C
+{
+ struct D
+ {
+ void *v;
+ inline T & f3 ()
+ {
+ return *reinterpret_cast <T *> (this);
+ }
+ };
+ union
+ {
+ A p;
+ A::B *d;
+ };
+ T & operator[](int i)
+ {
+ if (d->a != 1)
+ f2 ();
+ return reinterpret_cast <D *> (p.f1 (i))->f3 ();
+ }
+ void f2 ();
+ void f3 (int i, const T & t);
+};
+
+class E
+{
+ int e, f;
+};
+
+C <E> c;
+
+void
+foo (int x)
+{
+ E e = c[x];
+ c.f3 (x, e);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr37922.C b/gcc/testsuite/g++.dg/torture/pr37922.C
new file mode 100644
index 000000000..a7d05ab0f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr37922.C
@@ -0,0 +1,502 @@
+// { dg-do run }
+// { dg-options "-fpic" { target fpic } }
+
+typedef __SIZE_TYPE__ size_t;
+
+template <typename NumType>
+inline
+NumType
+absolute(NumType const& x)
+{
+ if (x < NumType(0)) return -x;
+ return x;
+}
+
+class trivial_accessor
+{
+ public:
+ typedef size_t index_type;
+ struct index_value_type {};
+
+ trivial_accessor() : size_(0) {}
+
+ trivial_accessor(size_t const& n) : size_(n) {}
+
+ size_t size_1d() const { return size_; }
+
+ protected:
+ size_t size_;
+};
+
+namespace N0
+{
+ template <typename ElementType,
+ typename AccessorType = trivial_accessor>
+ class const_ref
+ {
+ public:
+ typedef ElementType value_type;
+ typedef size_t size_type;
+
+ typedef AccessorType accessor_type;
+ typedef typename accessor_type::index_type index_type;
+ typedef typename accessor_type::index_value_type index_value_type;
+
+ const_ref() {}
+
+ const_ref(const ElementType* begin, accessor_type const& accessor)
+ : begin_(begin), accessor_(accessor)
+ {
+ init();
+ }
+
+ const_ref(const ElementType* begin, index_value_type const& n0)
+ : begin_(begin), accessor_(n0)
+ {
+ init();
+ }
+
+ const_ref(const ElementType* begin, index_value_type const& n0,
+ index_value_type const& n1)
+ : begin_(begin), accessor_(n0, n1)
+ {
+ init();
+ }
+
+ const_ref(const ElementType* begin, index_value_type const& n0,
+ index_value_type const& n1,
+ index_value_type const& n2)
+ : begin_(begin), accessor_(n0, n1, n2)
+ {
+ init();
+ }
+
+ accessor_type const& accessor() const { return accessor_; }
+ size_type size() const { return size_; }
+
+ const ElementType* begin() const { return begin_; }
+ const ElementType* end() const { return end_; }
+
+ ElementType const&
+ operator[](size_type i) const { return begin_[i]; }
+
+ const_ref<ElementType>
+ as_1d() const
+ {
+ return const_ref<ElementType>(begin_, size_);
+ }
+
+ protected:
+ void
+ init()
+ {
+ size_ = accessor_.size_1d();
+ end_ = begin_ + size_;
+ }
+
+ const ElementType* begin_;
+ accessor_type accessor_;
+ size_type size_;
+ const ElementType* end_;
+ };
+}
+
+template <typename ElementType,
+ typename AccessorType = trivial_accessor>
+class ref : public N0::const_ref<ElementType, AccessorType>
+{
+ public:
+ typedef ElementType value_type;
+ typedef size_t size_type;
+
+ typedef N0::const_ref<ElementType, AccessorType> base_class;
+ typedef AccessorType accessor_type;
+ typedef typename accessor_type::index_type index_type;
+
+ ref() {}
+
+ ElementType*
+ begin() const { return const_cast<ElementType*>(this->begin_); }
+
+ ElementType*
+ end() const { return const_cast<ElementType*>(this->end_); }
+
+ ElementType&
+ operator[](size_type i) const { return begin()[i]; }
+};
+
+namespace N1 {
+ template <typename ElementType, size_t N>
+ class tiny_plain
+ {
+ public:
+ typedef ElementType value_type;
+ typedef size_t size_type;
+
+ static const size_t fixed_size=N;
+
+ ElementType elems[N];
+
+ tiny_plain() {}
+
+ static size_type size() { return N; }
+
+ ElementType* begin() { return elems; }
+ const ElementType* begin() const { return elems; }
+ ElementType* end() { return elems+N; }
+ const ElementType* end() const { return elems+N; }
+ ElementType& operator[](size_type i) { return elems[i]; }
+ ElementType const& operator[](size_type i) const { return elems[i]; }
+ };
+
+ template <typename ElementType, size_t N>
+ class tiny : public tiny_plain<ElementType, N>
+ {
+ public:
+ typedef ElementType value_type;
+ typedef size_t size_type;
+
+ typedef tiny_plain<ElementType, N> base_class;
+
+ tiny() {}
+ };
+}
+
+template <typename NumType>
+class mat3 : public N1::tiny_plain<NumType, 9>
+{
+ public:
+ typedef typename N1::tiny_plain<NumType, 9> base_type;
+
+ mat3() {}
+ mat3(NumType const& e00, NumType const& e01, NumType const& e02,
+ NumType const& e10, NumType const& e11, NumType const& e12,
+ NumType const& e20, NumType const& e21, NumType const& e22)
+ : base_type(e00, e01, e02, e10, e11, e12, e20, e21, e22)
+ {}
+ mat3(base_type const& a)
+ : base_type(a)
+ {}
+
+ NumType const&
+ operator()(size_t r, size_t c) const
+ {
+ return this->elems[r * 3 + c];
+ }
+ NumType&
+ operator()(size_t r, size_t c)
+ {
+ return this->elems[r * 3 + c];
+ }
+
+ NumType
+ trace() const
+ {
+ mat3 const& m = *this;
+ return m[0] + m[4] + m[8];
+ }
+
+ NumType
+ determinant() const
+ {
+ mat3 const& m = *this;
+ return m[0] * (m[4] * m[8] - m[5] * m[7])
+ - m[1] * (m[3] * m[8] - m[5] * m[6])
+ + m[2] * (m[3] * m[7] - m[4] * m[6]);
+ }
+};
+
+template <typename NumType>
+inline
+mat3<NumType>
+operator-(mat3<NumType> const& v)
+{
+ mat3<NumType> result;
+ for(size_t i=0;i<9;i++) {
+ result[i] = -v[i];
+ }
+ return result;
+}
+
+class mat_grid : public N1::tiny<size_t, 2>
+{
+ public:
+ typedef N1::tiny<size_t, 2> index_type;
+ typedef index_type::value_type index_value_type;
+
+ mat_grid() { this->elems[0]=0; this->elems[1]=0; }
+
+ mat_grid(index_type const& n) : index_type(n) {}
+
+ mat_grid(index_value_type const& n0, index_value_type const& n1)
+ { this->elems[0]=n0; this->elems[1]=n1; }
+
+ size_t size_1d() const { return elems[0] * elems[1]; }
+
+ size_t
+ operator()(index_value_type const& r, index_value_type const& c) const
+ {
+ return r * elems[1] + c;
+ }
+};
+
+template <typename NumType, typename AccessorType = mat_grid>
+class mat_const_ref : public N0::const_ref<NumType, AccessorType>
+{
+ public:
+ typedef AccessorType accessor_type;
+ typedef typename N0::const_ref<NumType, AccessorType> base_type;
+ typedef typename accessor_type::index_value_type index_value_type;
+
+ mat_const_ref() {}
+
+ mat_const_ref(const NumType* begin, accessor_type const& grid)
+ : base_type(begin, grid)
+ {}
+
+ mat_const_ref(const NumType* begin, index_value_type const& n_rows,
+ index_value_type const& n_columns)
+ : base_type(begin, accessor_type(n_rows, n_columns))
+ {}
+
+ accessor_type
+ grid() const { return this->accessor(); }
+
+ index_value_type const&
+ n_rows() const { return this->accessor()[0]; }
+
+ index_value_type const&
+ n_columns() const { return this->accessor()[1]; }
+
+ NumType const&
+ operator()(index_value_type const& r, index_value_type const& c) const
+ {
+ return this->begin()[this->accessor()(r, c)];
+ }
+};
+
+template <typename NumType, typename AccessorType = mat_grid>
+class mat_ref : public mat_const_ref<NumType, AccessorType>
+{
+ public:
+ typedef AccessorType accessor_type;
+ typedef mat_const_ref<NumType, AccessorType> base_type;
+ typedef typename accessor_type::index_value_type index_value_type;
+
+ mat_ref() {}
+
+ mat_ref(NumType* begin, accessor_type const& grid)
+ : base_type(begin, grid)
+ {}
+
+ mat_ref(NumType* begin, index_value_type n_rows,
+ index_value_type n_columns)
+ : base_type(begin, accessor_type(n_rows, n_columns))
+ {}
+
+ NumType*
+ begin() const { return const_cast<NumType*>(this->begin_); }
+
+ NumType*
+ end() const { return const_cast<NumType*>(this->end_); }
+
+ NumType&
+ operator[](index_value_type const& i) const { return begin()[i]; }
+
+ NumType&
+ operator()(index_value_type const& r, index_value_type const& c) const
+ {
+ return this->begin()[this->accessor()(r, c)];
+ }
+};
+
+ template <typename AnyType>
+ inline void
+ swap(AnyType* a, AnyType* b, size_t n)
+ {
+ for(size_t i=0;i<n;i++) {
+ AnyType t = a[i]; a[i] = b[i]; b[i] = t;
+ }
+ }
+
+template <typename IntType>
+size_t
+form_t(mat_ref<IntType>& m,
+ mat_ref<IntType> const& t)
+{
+ typedef size_t size_t;
+ size_t mr = m.n_rows();
+ size_t mc = m.n_columns();
+ size_t tc = t.n_columns();
+ if (tc) {
+ }
+ size_t i, j;
+ for (i = j = 0; i < mr && j < mc;) {
+ size_t k = i; while (k < mr && m(k,j) == 0) k++;
+ if (k == mr)
+ j++;
+ else {
+ if (i != k) {
+ swap(&m(i,0), &m(k,0), mc);
+ if (tc) swap(&t(i,0), &t(k,0), tc);
+ }
+ for (k++; k < mr; k++) {
+ IntType a = absolute(m(k, j));
+ if (a != 0 && a < absolute(m(i,j))) {
+ swap(&m(i,0), &m(k,0), mc);
+ if (tc) swap(&t(i,0), &t(k,0), tc);
+ }
+ }
+ if (m(i,j) < 0) {
+ for(size_t ic=0;ic<mc;ic++) m(i,ic) *= -1;
+ if (tc) for(size_t ic=0;ic<tc;ic++) t(i,ic) *= -1;
+ }
+ bool cleared = true;
+ for (k = i+1; k < mr; k++) {
+ IntType a = m(k,j) / m(i,j);
+ if (a != 0) {
+ for(size_t ic=0;ic<mc;ic++) m(k,ic) -= a * m(i,ic);
+ if (tc) for(size_t ic=0;ic<tc;ic++) t(k,ic) -= a * t(i,ic);
+ }
+ if (m(k,j) != 0) cleared = false;
+ }
+ if (cleared) { i++; j++; }
+ }
+ }
+ m = mat_ref<IntType>(m.begin(), i, mc);
+ return i;
+}
+
+template <typename IntType>
+size_t
+form(mat_ref<IntType>& m)
+{
+ mat_ref<IntType> t(0,0,0);
+ return form_t(m, t);
+}
+
+typedef mat3<int> sg_mat3;
+
+class rot_mx
+{
+ public:
+ explicit
+ rot_mx(sg_mat3 const& m, int denominator=1)
+ : num_(m), den_(denominator)
+ {}
+
+ sg_mat3 const&
+ num() const { return num_; }
+ sg_mat3&
+ num() { return num_; }
+
+ int const&
+ operator[](size_t i) const { return num_[i]; }
+ int&
+ operator[](size_t i) { return num_[i]; }
+
+ int
+ const& operator()(int r, int c) const { return num_(r, c); }
+ int&
+ operator()(int r, int c) { return num_(r, c); }
+
+ int const&
+ den() const { return den_; }
+ int&
+ den() { return den_; }
+
+ rot_mx
+ minus_unit_mx() const
+ {
+ rot_mx result(*this);
+ for (size_t i=0;i<9;i+=4) result[i] -= den_;
+ return result;
+ }
+
+ rot_mx
+ operator-() const { return rot_mx(-num_, den_); }
+
+ int
+ type() const;
+
+ int
+ order(int type=0) const;
+
+ private:
+ sg_mat3 num_;
+ int den_;
+};
+
+class rot_mx_info
+{
+ public:
+ rot_mx_info(rot_mx const& r);
+
+ int type() const { return type_; }
+
+ private:
+ int type_;
+};
+
+int rot_mx::type() const
+{
+ int det = num_.determinant();
+ if (det == -1 || det == 1) {
+ switch (num_.trace()) {
+ case -3: return -1;
+ case -2: return -6;
+ case -1: if (det == -1) return -4;
+ else return 2;
+ case 0: if (det == -1) return -3;
+ else return 3;
+ case 1: if (det == -1) return -2;
+ else return 4;
+ case 2: return 6;
+ case 3: return 1;
+ }
+ }
+ return 0;
+}
+
+int rot_mx::order(int type) const
+{
+ if (type == 0) type = rot_mx::type();
+ if (type > 0) return type;
+ if (type % 2) return -type * 2;
+ return -type;
+}
+
+rot_mx_info::rot_mx_info(rot_mx const& r)
+: type_(r.type())
+{
+ if (type_ == 0) {
+ return;
+ }
+ rot_mx proper_r = r;
+ int proper_order = type_;
+ // THE PROBLEM IS AROUND HERE
+ if (proper_order < 0) {
+ proper_order *= -1;
+ proper_r = -proper_r; // THIS FAILS ...
+ }
+ if (proper_order > 1) {
+ rot_mx rmi = proper_r.minus_unit_mx(); // ... THEREFORE WRONG HERE
+ mat_ref<int> re_mx(rmi.num().begin(), 3, 3);
+ if (form(re_mx) != 2) {
+ type_ = 0;
+ }
+ }
+}
+
+int main()
+{
+ N1::tiny<int, 9> e;
+ e[0] = 1; e[1] = 0; e[2] = 0;
+ e[3] = 0; e[4] = -1; e[5] = 0;
+ e[6] = 0; e[7] = 0; e[8] = 1;
+ rot_mx r(e);
+ rot_mx_info ri(r);
+ if (ri.type() != -2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr38565.C b/gcc/testsuite/g++.dg/torture/pr38565.C
new file mode 100644
index 000000000..8cd1e1d4b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr38565.C
@@ -0,0 +1,11 @@
+// { dg-do compile }
+// Ignore warning on some powerpc-linux configurations.
+// { dg-prune-output "non-standard ABI extension" }
+#define vector __attribute__((vector_size(16) ))
+vector unsigned int f(int a)
+{
+ vector unsigned int mask = a ? (vector unsigned int){ 0x80000000, 0x80000000,
+0x80000000, 0x80000000 } : (vector unsigned int){0};
+ return mask;
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr38705.C b/gcc/testsuite/g++.dg/torture/pr38705.C
new file mode 100644
index 000000000..8058d3a39
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr38705.C
@@ -0,0 +1,27 @@
+// PR c++/38705
+// { dg-do compile }
+
+typedef int T;
+typedef __SIZE_TYPE__ size_t;
+extern "C" void *memcpy (void *, const void *, size_t);
+
+void
+foo (char *p, const int q)
+{
+ memcpy (p, &q, sizeof (int));
+}
+
+struct S
+{
+ T t;
+ int u;
+ int bar () const;
+ template <class T> void foo (const T &x) const {}
+};
+
+int
+S::bar () const
+{
+ foo (u);
+ foo (t);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr38745.C b/gcc/testsuite/g++.dg/torture/pr38745.C
new file mode 100644
index 000000000..4ad9d85fe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr38745.C
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+
+union u_u16
+{
+ unsigned short v;
+ struct
+ {
+ unsigned char lo8, hi8;
+ } __attribute__ ((__may_alias__)) u;
+} __attribute__ ((__may_alias__));
+union u_u32
+{
+ unsigned int v;
+ struct
+ {
+ u_u16 lo16, hi16;
+ } u;
+} __attribute__ ((__may_alias__));
+union u_u64
+{
+ struct
+ {
+ u_u32 lo32, hi32;
+ } u;
+};
+struct Record
+{
+};
+long long
+UnpackFullKey (Record & rec, const char *&p)
+{
+ long long c64 = 0;
+ (*(u_u16 *) & (*(u_u32 *) & ( *(u_u64*)&c64).u.lo32.v).u.lo16.v).u.hi8 = 1;
+ return c64;
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr38747.C b/gcc/testsuite/g++.dg/torture/pr38747.C
new file mode 100644
index 000000000..0f18a2f22
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr38747.C
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+inline void *operator new (__SIZE_TYPE__, void *__p) throw () { return __p; }
+
+int __attribute__((noinline))
+foo(void)
+{
+ float f = 0;
+ int *i = new (&f) int (1);
+ return *(int *)&f;
+}
+
+int main()
+{
+ if (foo() != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr38811.C b/gcc/testsuite/g++.dg/torture/pr38811.C
new file mode 100644
index 000000000..e9b304da6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr38811.C
@@ -0,0 +1,73 @@
+/* { dg-do compile } */
+
+typedef unsigned long ULONG;
+void iwos_ErrorMessage(long error, const char * const file_name,
+ ULONG line_num, const char * const message);
+class AbcA2d {
+public:
+ double x;
+ double y;
+ ~AbcA2d() { }
+};
+enum AbcZyParamType { ABC_SP_1 };
+class AbcExtent2d {
+ AbcA2d m_vMin;
+ AbcA2d m_vMax;
+public:
+ AbcExtent2d(const AbcA2d & rMin, const AbcA2d & rMax);
+ AbcA2d ClampPoint2d(const AbcA2d & rPoint) const;
+ AbcA2d GetMax() const { return m_vMax; }
+ AbcA2d GetMin() const { }
+ AbcA2d Evaluate(double dNormalizedX, double dNormalizedY) const;
+};
+inline AbcExtent2d::AbcExtent2d(const AbcA2d & rMin, const AbcA2d & rMax)
+{
+ if (rMin.x > rMax.x || rMin.y > rMax.y)
+ {
+ long sErr = (1007);
+ if (sErr != 1000)
+ iwos_ErrorMessage(sErr,(const char * const)__null,
+ 0,(const char * const)__null);
+ }
+ else
+ {
+ m_vMin = rMin;
+ m_vMax = rMax;
+ }
+}
+inline AbcA2d AbcExtent2d::ClampPoint2d(const AbcA2d & rPoint) const
+{
+ AbcA2d sRet = rPoint;
+ if (rPoint.x < m_vMin.x)
+ sRet.x = m_vMin.x;
+ return sRet;
+}
+inline AbcA2d AbcExtent2d::Evaluate(double dNormalizedX, double dNormalizedY)
+const
+{
+ AbcA2d sRet;
+ sRet.x = m_vMin.x + dNormalizedX * (m_vMax.x - m_vMin.x);
+ sRet.y = m_vMin.y + dNormalizedY * (m_vMax.y - m_vMin.y);
+ return ClampPoint2d(sRet);
+}
+class AbcAbcdTracer {
+ AbcExtent2d m_vUVDomain;
+ virtual long TestIsoAbcde(AbcZyParamType eZyParam, double dParam,
+ int & rbZyxIsSolution);
+ virtual int DoesPointLieOnAbcde(AbcA2d & rUV, int bRefinePoint) const;
+};
+long AbcAbcdTracer::TestIsoAbcde(AbcZyParamType eZyParam, double dParam,
+ int & rbZyxIsSolution)
+{
+ AbcA2d sUV1(m_vUVDomain.GetMin());
+ AbcA2d sUV2(m_vUVDomain.GetMax());
+ AbcExtent2d sUVIso(sUV1,sUV2);
+ for (ULONG i=0; i<10; i++)
+ {
+ double dT = i / (10 -1.0);
+ AbcA2d sUV = sUVIso.Evaluate(dT,dT);
+ if (!DoesPointLieOnAbcde(sUV,0))
+ ;
+ }
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr39002.C b/gcc/testsuite/g++.dg/torture/pr39002.C
new file mode 100644
index 000000000..534d91dfa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr39002.C
@@ -0,0 +1,88 @@
+// PR target/39002
+// { dg-do run }
+
+struct S
+{
+ double x;
+ double y;
+ double z;
+};
+
+double foo (S *, S *);
+void bar (S *, S *, S *, double &, double &, double &);
+
+double
+foo (S *a1, S *a2)
+{
+ return __builtin_sqrt ((a1->x - a2->x) * (a1->x - a2->x)
+ + (a1->y - a2->y) * (a1->y - a2->y)
+ + (a1->z - a2->z) * (a1->z - a2->z));
+}
+
+void
+bar (S *p, S *q, S *r, double &x, double &y, double &z)
+{
+ if (foo (p, q) == 0.0)
+ {
+ x = r->x;
+ y = r->y;
+ z = r->z;
+ return;
+ }
+ if (foo (p, r) == 0.0)
+ {
+ x = r->x;
+ y = r->y;
+ z = r->z;
+ return;
+ }
+ if (foo (q, r) == 0.0)
+ {
+ x = r->x;
+ y = r->y;
+ z = r->z;
+ return;
+ }
+
+ double a1, b1, c1, d1, e1;
+ double dx, dy, dz, dw, dv;
+
+ a1 = q->x - p->x;
+ b1 = q->y - p->y;
+ c1 = q->z - p->z;
+ e1 = __builtin_sqrt (a1 * a1 + b1 * b1 + c1 * c1);
+ a1 = a1 / e1;
+ b1 = b1 / e1;
+ c1 = c1 / e1;
+ dx = p->x - r->x;
+ dy = p->y - r->y;
+ dz = p->z - r->z;
+ dw = dx * dx + dy * dy + dz * dz;
+ dv = 2.0 * dx * a1 + 2.0 * dy * b1 + 2.0 * dz * c1;
+ d1 = -dv / 2.0;
+ x = p->x + (a1 * d1);
+ y = p->y + (b1 * d1);
+ z = p->z + (c1 * d1);
+ return;
+}
+
+int
+main (void)
+{
+ S a, b, c, d, *p, *q, *r;
+
+ p = &a;
+ q = &b;
+ r = &c;
+ a.x = 0.0;
+ a.y = 0.0;
+ a.z = 0.0;
+ b.x = 1.0;
+ b.y = 0.0;
+ b.z = 0.0;
+ c.x = 0.0;
+ c.y = 1.0;
+ c.z = 0.0;
+ bar (p, q, r, d.x, d.y, d.z);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr39259.C b/gcc/testsuite/g++.dg/torture/pr39259.C
new file mode 100644
index 000000000..256181fa6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr39259.C
@@ -0,0 +1,40 @@
+// PR tree-optimization/39259
+// { dg-do compile }
+// { dg-options "-O2" }
+
+
+extern "C" int __mysetjmp () __attribute__ ((__returns_twice__));
+
+class TContStatus {};
+
+class TContEvent
+{
+public:
+ inline void Execute () throw();
+};
+
+class TCont
+{
+public:
+ TContStatus ReadD (void* buf, int deadline)
+ {
+ TContEvent event;
+ event.Execute ();
+ return TContStatus();
+ }
+ TContStatus ReadI (void *buf)
+ {
+ return ReadD (buf, 1);
+ }
+};
+
+void TContEvent::Execute () throw ()
+{
+ __mysetjmp();
+}
+
+void Broken (TCont *mCont)
+{
+ mCont->ReadI(0);
+ mCont->ReadI(0);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr39362.C b/gcc/testsuite/g++.dg/torture/pr39362.C
new file mode 100644
index 000000000..fb23439f5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr39362.C
@@ -0,0 +1,105 @@
+/* { dg-do compile } */
+
+void *fastMalloc (int n);
+void fastFree (void *p);
+template <class T> struct C
+{
+ void deref () { delete static_cast <T *>(this); }
+};
+template <typename T>
+struct D
+{
+ D (T *ptr) : m_ptr (ptr) { }
+ ~D () { if (T * ptr = m_ptr) ptr->deref (); }
+ T *operator-> () const;
+ T *m_ptr;
+ typedef T *UnspecifiedBoolType;
+ operator UnspecifiedBoolType () const;
+};
+template <typename T> struct E
+{
+ static void destruct (T * begin, T * end)
+ {
+ for (T * cur = begin; cur != end; ++cur)
+ cur->~T ();
+ }
+};
+template <typename T> class F;
+template <typename T> struct G
+{
+ static void destruct (T * begin, T * end)
+ {
+ E <T>::destruct (begin, end);
+ }
+ static void uninitializedFill (T * dst, T * dstEnd, const T & val)
+ {
+ F<T>::uninitializedFill (dst, dstEnd, val);
+ }
+};
+template <typename T> struct H
+{
+ void allocateBuffer (int newCapacity)
+ {
+ m_buffer = static_cast <T *>(fastMalloc (newCapacity * sizeof (T)));
+ }
+ void deallocateBuffer (T * bufferToDeallocate)
+ {
+ if (m_buffer == bufferToDeallocate)
+ fastFree (bufferToDeallocate);
+ }
+ T *buffer () { }
+ int capacity () const { }
+ T *m_buffer;
+};
+template <typename T, int cap> class I;
+template <typename T> struct I <T, 0> : H <T>
+{
+ I (int capacity) { allocateBuffer (capacity); }
+ ~I () { deallocateBuffer (buffer ()); }
+ using H <T>::allocateBuffer;
+ H <T>::buffer;
+};
+template <typename T, int cap = 0> struct J
+{
+ typedef T *iterator;
+ ~J () { if (m_size) shrink (0); }
+ J (const J &);
+ int capacity () const { m_buffer.capacity (); }
+ T & operator[](int i) { }
+ iterator begin () { }
+ iterator end () { return begin () + m_size; }
+ void shrink (int size);
+ template <typename U> void append (const U &);
+ int m_size;
+ I <T, cap> m_buffer;
+};
+template <typename T, int cap>
+J <T, cap>::J (const J & other) : m_buffer (other.capacity ())
+{
+}
+template <typename T, int cap>
+void J <T, cap>::shrink (int size)
+{
+ G <T>::destruct (begin () + size, end ());
+ m_size = size;
+}
+struct A : public C <A>
+{
+ virtual ~A ();
+ typedef J <D <A> > B;
+ virtual A *firstChild () const;
+ virtual A *nextSibling () const;
+ virtual const B & children (int length);
+ B m_children;
+};
+const A::B &
+A::children (int length)
+{
+ for (D <A> obj = firstChild (); obj; obj = obj->nextSibling ())
+ {
+ B children = obj->children (2);
+ for (unsigned i = 0; i <length; ++i)
+ m_children.append (children[i]);
+ }
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr39417.C b/gcc/testsuite/g++.dg/torture/pr39417.C
new file mode 100644
index 000000000..b7bbb88b7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr39417.C
@@ -0,0 +1,56 @@
+// { dg-do run }
+
+#include <vector>
+
+std::vector <int>
+sequence(int l, int n)
+{
+ std::vector <int> ret;
+ for(int i=n;i<=100;i++)
+ {
+ if(i%2==0)
+ {
+ if(l%i==i/2)
+ {
+ int init =l/i-i/2+1;
+ if(init>=0)
+ {
+ for(int j=0;j<i;j++)
+ {
+ ret.push_back(init);
+ init ++;
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ if(l%i==0)
+ {
+ int init =l/i-i/2;
+ if(init>=0)
+ {
+ for(int j=0;j<i;j++)
+ {
+ ret.push_back(init);
+ init ++;
+ }
+ break;
+ }
+ }
+ }
+ }
+ return ret;
+}
+extern "C" void abort (void);
+int main()
+{
+ std::vector<int> res = sequence(18, 2);
+ if (res.size () != 3
+ || res[0] != 5
+ || res[1] != 6
+ || res[2] != 7)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr39678.C b/gcc/testsuite/g++.dg/torture/pr39678.C
new file mode 100644
index 000000000..a7c120ad4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr39678.C
@@ -0,0 +1,26 @@
+/* PR target/39678 */
+/* { dg-do run } */
+/* { dg-options "-Wno-psabi" } */
+struct Y {};
+struct X {
+ struct Y y;
+ __complex__ float val;
+};
+
+struct X __attribute__((noinline))
+foo (float *p)
+{
+ struct X x;
+ __real x.val = p[0];
+ __imag x.val = p[1];
+ return x;
+}
+extern "C" void abort (void);
+float a[2] = { 3., -2. };
+int main()
+{
+ struct X x = foo(a);
+ if (__real x.val != 3. || __imag x.val != -2.)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr39713.C b/gcc/testsuite/g++.dg/torture/pr39713.C
new file mode 100644
index 000000000..4ff72d1a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr39713.C
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+
+template <typename To, typename From>
+static inline To
+bitwise_cast (From from)
+{
+ union
+ {
+ From f;
+ To t;
+ } u;
+ u.f = from;
+ return u.t;
+}
+
+extern void foo (unsigned char *);
+
+double
+bar ()
+{
+ unsigned char b[sizeof (unsigned long long)];
+ foo (b);
+ return bitwise_cast<double> (*(unsigned long long *) b);
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr39732.C b/gcc/testsuite/g++.dg/torture/pr39732.C
new file mode 100644
index 000000000..418417587
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr39732.C
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-fprofile-generate" } */
+
+template<class _CharT> struct char_traits;
+template<typename _OI>
+_OI __copy_move_a2(_OI __result);
+template<typename _OI> inline _OI
+copy(_OI __result)
+{
+ return __copy_move_a2 (__result);
+}
+template<typename _CharT, typename _Traits>
+class basic_ostream { };
+template<typename _Tp, typename _CharT = char, typename _Traits = char_traits<_CharT> >
+class ostream_iterator {
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+ ostream_type* _M_stream;
+ const _CharT* _M_string;
+public:
+ ostream_iterator(ostream_type& __s, const _CharT* __c)
+ : _M_stream(&__s), _M_string(__c) { }
+ ostream_iterator(const ostream_iterator& __obj)
+ : _M_stream(__obj._M_stream), _M_string(__obj._M_string) { }
+};
+int f(void)
+{
+ basic_ostream<char, char_traits<char> > os;
+ copy(ostream_iterator<const int>(os, ","));
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr39764.C b/gcc/testsuite/g++.dg/torture/pr39764.C
new file mode 100644
index 000000000..a89013313
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr39764.C
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+class A;
+class B { };
+extern const double NaN;
+B foo(A* exec, double d);
+inline B baz(A* a) {
+ return foo(a, NaN);
+}
+B bar(A* a) {
+ return baz(a);
+}
+extern const double NaN = (__builtin_nanf(""));
+
diff --git a/gcc/testsuite/g++.dg/torture/pr40081.C b/gcc/testsuite/g++.dg/torture/pr40081.C
new file mode 100644
index 000000000..e65c5a843
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40081.C
@@ -0,0 +1,16 @@
+struct Atomic_t {
+ Atomic_t(int i) : val(i) { }
+ volatile int val;
+};
+class RefCount {
+public:
+ RefCount(Atomic_t c) : m_count(c) { }
+ Atomic_t m_count;
+};
+class IntrusiveCountableBase {
+ RefCount m_useCount;
+protected:
+ IntrusiveCountableBase();
+};
+IntrusiveCountableBase::IntrusiveCountableBase() : m_useCount(0) { }
+
diff --git a/gcc/testsuite/g++.dg/torture/pr40102.C b/gcc/testsuite/g++.dg/torture/pr40102.C
new file mode 100644
index 000000000..49f56b5bc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40102.C
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+bool foo0(int) { return true; }
+
+bool foo1();
+
+struct A
+{
+ A();
+ ~A();
+
+ template<typename T> void bar1(T f)
+ {
+ if (f(0))
+ foo1();
+ }
+
+ template<typename T> void bar2(T);
+};
+
+template<typename T> void A::bar2(T f)
+{
+ A a, b[1], *p;
+
+ while (foo1())
+ {
+ if (p)
+ ++p;
+ if (p && foo1())
+ bar1(f);
+ if (p)
+ ++p;
+ }
+
+ if (foo1())
+ bar1(f);
+}
+
+void baz()
+{
+ A().bar2(foo0);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr40321.C b/gcc/testsuite/g++.dg/torture/pr40321.C
new file mode 100644
index 000000000..917743109
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40321.C
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+
+struct VectorD2
+{
+ VectorD2() : x(0), y(0) { }
+ VectorD2(int _x, int _y) : x(_x), y(_y) { }
+ int x, y;
+ int GetLength2() const { return x*x + y*y; };
+ VectorD2 operator+(const VectorD2 vec) const {
+ return VectorD2(x+vec.x,y+vec.y);
+ }
+};
+struct Shape
+{
+ enum Type { ST_RECT, ST_CIRCLE } type;
+ VectorD2 pos;
+ VectorD2 radius;
+ bool CollisionWith(const Shape& s) const;
+};
+bool Shape::CollisionWith(const Shape& s) const
+{
+ if(type == ST_CIRCLE && s.type == ST_RECT)
+ return s.CollisionWith(*this);
+ return (pos + s.pos).GetLength2() < (radius + s.radius).GetLength2();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr40323.C b/gcc/testsuite/g++.dg/torture/pr40323.C
new file mode 100644
index 000000000..c7ffcb5d3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40323.C
@@ -0,0 +1,68 @@
+/* Testcase for PR 40323. */
+/* { dg-do compile } */
+/* { dg-options "-fno-early-inlining" } */
+/* { dg-add-options bind_pic_locally } */
+
+extern void do_something (const char *, int);
+
+class Parent
+{
+private:
+ const char *data;
+
+public:
+ Parent (const char *d) : data(d)
+ {}
+
+ int funcOne (int delim) const;
+};
+
+class AnotherParent
+{
+private:
+ double d;
+public:
+ AnotherParent (void) : d(0)
+ {}
+};
+
+
+class Child : public AnotherParent, Parent
+{
+private:
+ int zzz;
+public:
+ Child (const char *d) : Parent(d)
+ {}
+};
+
+
+int Parent::funcOne (int delim) const
+{
+ int i;
+ for (i = 0; i < delim; i++)
+ do_something(data, i);
+
+ return 1;
+}
+
+int docalling (int (Child::* f)(int delim) const)
+{
+ Child S ("muhehehe");
+
+ return (S.*f)(4);
+}
+
+typedef int (Parent::* my_mp_type)(int delim);
+
+int main (int argc, char *argv[])
+{
+ int i;
+ int (Parent::* f)(int ) const;
+ int (Child::* g)(int ) const;
+
+ f = &Parent::funcOne;
+ g = (int (Child::* )(int) const) f;
+ i = docalling (g);
+ return i;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr40335.C b/gcc/testsuite/g++.dg/torture/pr40335.C
new file mode 100644
index 000000000..14ea95d40
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40335.C
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+int
+main (void)
+{
+ int i = -1;
+ switch ((signed char) i)
+ {
+ case 255: /* { dg-bogus "exceeds maximum value" "" { xfail *-*-* } } */
+ abort ();
+ default:
+ break;
+ }
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr40388.C b/gcc/testsuite/g++.dg/torture/pr40388.C
new file mode 100644
index 000000000..63fbbfba5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40388.C
@@ -0,0 +1,21 @@
+void foo();
+
+struct A
+{
+ ~A()
+ {
+ try
+ {
+ foo();
+ foo();
+ }
+ catch (...)
+ {
+ }
+ }
+};
+
+void bar()
+{
+ A a1, a2;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr40389.C b/gcc/testsuite/g++.dg/torture/pr40389.C
new file mode 100644
index 000000000..e3ceb1238
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40389.C
@@ -0,0 +1,84 @@
+/* { dg-do run } */
+
+template <typename V> struct S
+{
+ V *f, *l;
+ __attribute__ ((noinline)) S (void) { f = 0, l = 0; }
+ void foo (V *x)
+ {
+ if (x->p != 0)
+ x->p->n = x->n;
+ else
+ f = x->n;
+ if (x->n != 0)
+ x->n->p = x->p;
+ else
+ l = x->p;
+ }
+ __attribute__ ((noinline)) void bar (V *x)
+ {
+ x->n = 0;
+ x->p = l;
+ if (l != 0)
+ l->n = x;
+ else
+ f = x;
+ l = x;
+ }
+};
+
+struct H;
+
+struct A
+{
+ S <H> k;
+};
+
+struct H
+{
+ A *a;
+ H *p, *n;
+ __attribute__ ((noinline)) H (void) { p = 0, n = 0, a = 0; }
+ __attribute__ ((noinline)) H (A *b) : a (b)
+ {
+ p = 0;
+ n = 0;
+ if (a != 0)
+ a->k.bar (this);
+ }
+ __attribute__ ((noinline)) H (const H &h) : a (h.a)
+ {
+ p = 0;
+ n = 0;
+ if (a != 0)
+ a->k.bar (this);
+ }
+ ~H (void) { if (a != 0) a->k.foo (this); }
+ H &operator= (const H &o)
+ {
+ if (a != 0 || &o == this)
+ __builtin_abort ();
+ a = o.a;
+ if (a != 0)
+ a->k.bar (this);
+ return *this;
+ }
+};
+
+__attribute__ ((noinline))
+H baz (void)
+{
+ return H (new A);
+}
+
+H g;
+
+int
+main (void)
+{
+ g = baz ();
+ if (g.a->k.f != &g)
+ __builtin_abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr40460.C b/gcc/testsuite/g++.dg/torture/pr40460.C
new file mode 100644
index 000000000..1d54df72b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40460.C
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+void bar(int);
+void foo(void)
+{
+ for (int i = 0; i<1; ++i)
+ bar (i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i);
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr40492.C b/gcc/testsuite/g++.dg/torture/pr40492.C
new file mode 100644
index 000000000..cab9426d0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40492.C
@@ -0,0 +1,26 @@
+typedef unsigned short ushort;
+class QChar {
+public:
+ QChar( const QChar& c );
+ ushort ucs;
+};
+inline QChar::QChar( const QChar& c ) : ucs( c.ucs ) { };
+class QString { };
+class KoAutoFormat {
+public:
+ struct TypographicQuotes { QChar begin, end; };
+ TypographicQuotes getConfigTypographicDoubleQuotes() const {
+ return m_typographicDoubleQuotes;
+ }
+ TypographicQuotes m_typographicDoubleQuotes;
+};
+class KoAutoFormatDia {
+ QChar oDoubleBegin, oDoubleEnd;
+ KoAutoFormat * m_docAutoFormat;
+ bool noSignal;
+ void changeAutoformatLanguage(void);
+};
+void KoAutoFormatDia::changeAutoformatLanguage(void)
+{
+ oDoubleEnd= m_docAutoFormat->getConfigTypographicDoubleQuotes().end;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr40642.C b/gcc/testsuite/g++.dg/torture/pr40642.C
new file mode 100644
index 000000000..3f545a890
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40642.C
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// { dg-options "-fprofile-generate" }
+
+// GCC used to ICE with some EH edge missing.
+
+inline void* operator new(__SIZE_TYPE__, void* p) throw() { return p; }
+inline void operator delete (void*, void*) throw() { }
+
+template<typename T> void foo(void* p, T t)
+{
+ new(p) T(t);
+}
+
+void bar();
+
+template<typename T> struct A
+{
+ T* p;
+
+ A() { try { foo(p, T()); } catch(...) {} }
+
+ A(const A&) { try { bar(); } catch(...) { throw; } }
+};
+
+A<A<int> > a;
+
diff --git a/gcc/testsuite/g++.dg/torture/pr40834.C b/gcc/testsuite/g++.dg/torture/pr40834.C
new file mode 100644
index 000000000..67d302853
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40834.C
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+extern "C" void abort (void);
+class XalanDOMString
+{
+public:
+ int y;
+};
+
+class XObject
+{
+public:
+ const XalanDOMString& str() const { return x; }
+ XalanDOMString x;
+};
+
+class XObjectPtr
+{
+public:
+ XObjectPtr(const XObjectPtr& theSource)
+ {
+ m_xobjectPtr = theSource.m_xobjectPtr;
+ }
+ const XObject* operator->() const
+ {
+ return m_xobjectPtr;
+ };
+ XObjectPtr(XObject *p) { m_xobjectPtr = p; }
+ XObject* m_xobjectPtr;
+};
+
+class FunctionSubstringBefore
+{
+public:
+ int execute( const XObjectPtr arg1) const
+ {
+ const XalanDOMString& theFirstString = arg1->str();
+ return theFirstString.y;
+ }
+};
+
+int
+main ()
+{
+ XObject x;
+ XObjectPtr y (&x);
+ x.x.y = -1;
+ FunctionSubstringBefore z;
+ if (z.execute (y) != -1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr40924.C b/gcc/testsuite/g++.dg/torture/pr40924.C
new file mode 100644
index 000000000..9140da3ba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40924.C
@@ -0,0 +1,111 @@
+// PR rtl-optimization/40924
+// { dg-do run }
+
+extern "C" void abort (void);
+
+#define MAY_ALIAS __attribute__((__may_alias__))
+
+typedef struct { float v[2]; } floata;
+typedef struct { int v[2]; } inta;
+
+typedef unsigned int uint MAY_ALIAS;
+typedef signed int sint MAY_ALIAS;
+typedef float flt MAY_ALIAS;
+
+static inline unsigned short
+less_than (inta a, inta b)
+{
+ unsigned short r = 0;
+ const uint *p1 = (const uint *) &a;
+ const uint *p2 = (const uint *) &b;
+ for (int i=0; i < 2; i++)
+ if (p1[i] < p2[i]) r |= (1 << i);
+ return r;
+}
+
+static inline inta
+multiply (inta b, inta c)
+{
+ inta r;
+ sint *p3 = (sint *) &c;
+ for (int i=0; i < 2; i++)
+ r.v[i] = (int) (b.v[i] * p3[i] & 0xFFFFFFFF);
+ return r;
+}
+
+static inline floata
+gather (inta indexes, const void *baseAddr)
+{
+ floata r;
+
+ sint *idx = (sint *) &indexes;
+ flt *src = (flt *) baseAddr;
+ for (int i=0; i < 2; i++)
+ r.v[i] = *(src + idx[i]);
+ return r;
+}
+
+static inline inta
+add (const inta &b, const inta &c)
+{
+ inta result;
+ sint *r = (sint *) &result;
+
+ for (int i=0; i < 2; i++)
+ r[i] = b.v[i] + c.v[i];
+ return result;
+}
+
+struct uintv
+{
+ inta data;
+ inline uintv () { data.v[0] = 0; data.v[1] = 1; }
+ inline uintv (unsigned int a)
+ {
+ for (int i=0; i < 2; i++)
+ *(uint *) &data.v[i] = a;
+ }
+ inline uintv (inta x) : data (x) {}
+ inline uintv operator* (const uintv &x) const
+ { return multiply (data, x.data); }
+ inline uintv operator+ (const uintv &x) const
+ { return uintv (add (data, x.data)); }
+ inline unsigned short operator< (const uintv &x) const
+ { return less_than (data, x.data); }
+};
+
+struct floatv
+{
+ floata data;
+ explicit inline floatv (const uintv &x)
+ {
+ uint *p2 = (uint *) &x.data;
+ for (int i=0; i < 2; i++)
+ data.v[i] = p2[i];
+ }
+ inline floatv (const float *array, const uintv &indexes)
+ {
+ const uintv &offsets = indexes * uintv (1);
+ data = gather (offsets.data, array);
+ }
+ unsigned short operator== (const floatv &x) const
+ {
+ unsigned short r = 0;
+ for (int i=0; i < 2; i++)
+ if (data.v[i] == x.data.v[i]) r |= (1 << i);
+ return r;
+ }
+};
+
+int
+main ()
+{
+ const float array[2] = { 2, 3 };
+ for (uintv i; (i < 2) == 3; i = i + 2)
+ {
+ const floatv ii (i + 2);
+ floatv a (array, i);
+ if ((a == ii) != 3)
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr40991.C b/gcc/testsuite/g++.dg/torture/pr40991.C
new file mode 100644
index 000000000..c08124024
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40991.C
@@ -0,0 +1,113 @@
+/* { dg-options "-std=gnu++0x" } */
+
+typedef __SIZE_TYPE__ size_t;
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ using ::size_t;
+ void __throw_bad_function_call() __attribute__((__noreturn__));
+}
+inline void* operator new(std::size_t, void* __p) throw() {
+ return __p;
+}
+namespace std {
+ class type_info {
+ public:
+ bool operator==(const type_info& __arg) const { }
+ };
+ namespace tr1 {
+ template<typename _Tp, _Tp __v> struct integral_constant { };
+ typedef integral_constant<bool, true> true_type;
+ template<typename _Res, typename... _ArgTypes>
+ struct _Maybe_unary_or_binary_function { };
+ class _Undefined_class;
+ union _Nocopy_types {
+ void (_Undefined_class::*_M_member_pointer)();
+ };
+ union _Any_data {
+ void* _M_access() {
+ return &_M_pod_data[0];
+ }
+ char _M_pod_data[sizeof(_Nocopy_types)];
+ };
+ enum _Manager_operation { __get_type_info, __get_functor_ptr, __clone_functor, __destroy_functor };
+ template<typename _Tp> struct _Simple_type_wrapper {
+ _Simple_type_wrapper(_Tp __value) : __value(__value) { }
+ _Tp __value;
+ };
+ template<typename _Signature> class function;
+ class _Function_base {
+ public:
+ static const std::size_t _M_max_size = sizeof(_Nocopy_types);
+ static const std::size_t _M_max_align = __alignof__(_Nocopy_types);
+ template<typename _Functor> class _Base_manager {
+ static const bool __stored_locally = (sizeof(_Functor) <= _M_max_size && __alignof__(_Functor) <= _M_max_align && (_M_max_align % __alignof__(_Functor) == 0));
+ typedef integral_constant<bool, __stored_locally> _Local_storage;
+ public:
+ static bool _M_manager(_Any_data& __dest, const _Any_data& __source, _Manager_operation __op) { }
+ static void _M_init_functor(_Any_data& __functor, const _Functor& __f) {
+ _M_init_functor(__functor, __f, _Local_storage());
+ }
+ template<typename _Class, typename _Tp> static bool _M_not_empty_function(_Tp _Class::* const& __mp) {
+ return __mp;
+ }
+ static void _M_init_functor(_Any_data& __functor, const _Functor& __f, true_type) {
+ new (__functor._M_access()) _Functor(__f);
+ }
+ };
+ ~_Function_base() {
+ if (_M_manager) _M_manager(_M_functor, _M_functor, __destroy_functor);
+ }
+ bool _M_empty() const {
+ return !_M_manager;
+ }
+ typedef bool (*_Manager_type)(_Any_data&, const _Any_data&, _Manager_operation);
+ _Any_data _M_functor;
+ _Manager_type _M_manager;
+ };
+ template<typename _Signature, typename _Functor> class _Function_handler;
+ template<typename _Class, typename _Member, typename _Res, typename... _ArgTypes> class _Function_handler<_Res(_ArgTypes...), _Member _Class::*> : public _Function_handler<void(_ArgTypes...), _Member _Class::*> {
+ public:
+ static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { }
+ };
+ template<typename _Class, typename _Member, typename... _ArgTypes> class _Function_handler<void(_ArgTypes...), _Member _Class::*> : public _Function_base::_Base_manager< _Simple_type_wrapper< _Member _Class::* > > { };
+ template<typename _Res, typename... _ArgTypes> class function<_Res(_ArgTypes...)> : public _Maybe_unary_or_binary_function<_Res, _ArgTypes...>, private _Function_base {
+ typedef _Res _Signature_type(_ArgTypes...);
+ struct _Useless { };
+ public:
+ template<typename _Functor> function(_Functor __f, _Useless = _Useless());
+ _Res operator()(_ArgTypes... __args) const;
+ const type_info& target_type() const;
+ typedef _Res (*_Invoker_type)(const _Any_data&, _ArgTypes...);
+ _Invoker_type _M_invoker;
+ };
+ template<typename _Res, typename... _ArgTypes> template<typename _Functor> function<_Res(_ArgTypes...)>:: function(_Functor __f, _Useless) : _Function_base() {
+ typedef _Function_handler<_Signature_type, _Functor> _My_handler;
+ if (_My_handler::_M_not_empty_function(__f)) {
+ _M_invoker = &_My_handler::_M_invoke;
+ _M_manager = &_My_handler::_M_manager;
+ _My_handler::_M_init_functor(_M_functor, __f);
+ }
+ }
+ template<typename _Res, typename... _ArgTypes> _Res function<_Res(_ArgTypes...)>:: operator()(_ArgTypes... __args) const {
+ if (_M_empty()) {
+ __throw_bad_function_call();
+ }
+ return _M_invoker(_M_functor, __args...);
+ }
+ template<typename _Res, typename... _ArgTypes> const type_info& function<_Res(_ArgTypes...)>:: target_type() const {
+ if (_M_manager) {
+ _Any_data __typeinfo_result;
+ _M_manager(__typeinfo_result, _M_functor, __get_type_info);
+ }
+ }
+ }
+}
+struct X {
+ int bar;
+};
+void test05() {
+ using std::tr1::function;
+ X x;
+ function<int(X&)> frm(&X::bar);
+ frm(x) == 17;
+ typeid(int X::*) == frm.target_type();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr41144.C b/gcc/testsuite/g++.dg/torture/pr41144.C
new file mode 100644
index 000000000..64dc117d7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr41144.C
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+struct rgba8;
+template<class ColorT> class span_gouraud {
+public:
+ struct coord_type { };
+ coord_type m_coord[3];
+};
+template<class ColorT> class span_gouraud_rgba : public span_gouraud<ColorT>
+{
+ typedef ColorT color_type;
+ typedef span_gouraud<color_type> base_type;
+ typedef typename base_type::coord_type coord_type;
+public:
+ void prepare() {
+ coord_type coord[3];
+ }
+};
+void the_application() {
+ typedef span_gouraud_rgba<rgba8> gouraud_span_gen_type;
+ gouraud_span_gen_type span_gouraud;
+ span_gouraud.prepare();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr41183.C b/gcc/testsuite/g++.dg/torture/pr41183.C
new file mode 100644
index 000000000..df3e30341
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr41183.C
@@ -0,0 +1,30 @@
+// PR c++/41183
+// { dg-do compile }
+
+void foo (const char *);
+
+template <int *>
+struct A
+{
+ template <typename T> A (const int &, T);
+ int i;
+};
+
+template <int *X>
+template <typename T>
+A<X>::A (const int &j, T) : i(j)
+{
+ foo (0);
+ foo (0);
+ foo (__PRETTY_FUNCTION__);
+}
+
+int N;
+
+struct B
+{
+ B ();
+ A<&N> a;
+};
+
+B::B() : a(N, 0) {}
diff --git a/gcc/testsuite/g++.dg/torture/pr41186.C b/gcc/testsuite/g++.dg/torture/pr41186.C
new file mode 100644
index 000000000..fdfee2cd3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr41186.C
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+
+struct Foo {
+ Foo() {};
+ int i;
+ short f;
+};
+struct Bar : public Foo {
+ Bar() {};
+ short b;
+};
+
+extern "C" void abort(void);
+
+int main()
+{
+ Bar b1, b2;
+ b2.i = 0;
+ b1.f = 0;
+ b1.b = 1;
+ b2.f = 1;
+ b2.b = 2;
+ static_cast<Foo&>(b1) = static_cast<Foo&>(b2);
+ if (b1.i != 0 || b1.b != 1)
+ abort ();
+ if (b1.f != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr41257-2.C b/gcc/testsuite/g++.dg/torture/pr41257-2.C
new file mode 100644
index 000000000..230fa5dde
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr41257-2.C
@@ -0,0 +1,16 @@
+/* { dg-do link } */
+
+struct A
+{
+ virtual ~A();
+};
+
+struct B : virtual A
+{
+ virtual ~B() {}
+};
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr41257.C b/gcc/testsuite/g++.dg/torture/pr41257.C
new file mode 100644
index 000000000..60cfc5339
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr41257.C
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+struct A
+{
+ virtual void foo();
+ virtual ~A();
+ int i;
+};
+
+struct B : virtual A {};
+
+struct C : B
+{
+ virtual void foo();
+};
+
+void bar()
+{
+ C().foo();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr41273.C b/gcc/testsuite/g++.dg/torture/pr41273.C
new file mode 100644
index 000000000..bdce05355
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr41273.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-g" } */
+
+long *H2_ipX_ener_sort;
+double H2_old_populations[2];
+double H2_total;
+
+void H2_LevelPops()
+{
+ double sum_pop = 0.;
+ long nEner = 0;
+ while( nEner < 3 && sum_pop/H2_total < 0.99999 )
+ {
+ long ip = H2_ipX_ener_sort[nEner];
+ sum_pop += H2_old_populations[ip];
+ ++nEner;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr41680.C b/gcc/testsuite/g++.dg/torture/pr41680.C
new file mode 100644
index 000000000..7faab0d5f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr41680.C
@@ -0,0 +1,23 @@
+// PR target/41680
+// { dg-do compile }
+
+extern void baz (float);
+
+inline bool
+bar (float x)
+{
+ union { float f; int i; } u;
+ u.f = x;
+ return (u.i & 1);
+}
+
+void
+foo (float *x)
+{
+ for (int i = 0; i < 10; i++)
+ {
+ float f = x[i];
+ if (!bar (f))
+ baz (f);
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr41775.C b/gcc/testsuite/g++.dg/torture/pr41775.C
new file mode 100644
index 000000000..3d8548e3f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr41775.C
@@ -0,0 +1,284 @@
+/* { dg-do compile } */
+/* { dg-require-visibility "" } */
+
+typedef unsigned int size_t;
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Iterator > struct iterator_traits
+ {
+ };
+ template < typename _Tp > struct iterator_traits <_Tp * >
+ {
+ typedef _Tp & reference;
+ };
+}
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+{
+ using std::iterator_traits;
+ template < typename _Iterator, typename _Container > class __normal_iterator
+ {
+ public:typedef _Iterator iterator_type;
+ typedef typename iterator_traits < _Iterator >::reference reference;
+ reference operator* () const
+ {
+ }
+ __normal_iterator operator++ (int)
+ {
+ }
+ };
+ template < typename _IteratorL, typename _IteratorR,
+ typename _Container > inline bool operator!= (const __normal_iterator <
+ _IteratorL,
+ _Container > &__lhs,
+ const __normal_iterator <
+ _IteratorR,
+ _Container > &__rhs)
+ {
+ }
+}
+
+extern "C"
+{
+ extern "C"
+ {
+ __extension__ typedef __SIZE_TYPE__ __intptr_t;
+ }
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Tp > class new_allocator
+ {
+ public:typedef size_t size_type;
+ typedef _Tp *pointer;
+ template < typename _Tp1 > struct rebind
+ {
+ typedef new_allocator < _Tp1 > other;
+ };
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
+ _Tp >
+ {
+ };
+}
+
+extern "C"
+{
+ typedef __intptr_t intptr_t;
+}
+namespace llvm
+{
+ template < typename NodeTy > class ilist_half_node
+ {
+ };
+template < typename NodeTy > class ilist_node:private ilist_half_node <
+ NodeTy >
+ {
+ };
+ class MachineBasicBlock;
+ class MachineOperand
+ {
+ public:enum MachineOperandType
+ {
+ }
+ Contents;
+ unsigned getReg () const
+ {
+ }
+ };
+ class TargetRegisterInfo;
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Tp, typename _Alloc > struct _Vector_base
+ {
+ typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
+ };
+template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:protected _Vector_base < _Tp,
+ _Alloc
+ >
+ {
+ typedef _Vector_base < _Tp, _Alloc > _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+ public:typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::pointer pointer;
+ typedef __gnu_cxx::__normal_iterator < pointer, vector > iterator;
+ iterator begin ()
+ {
+ }
+ iterator end ()
+ {
+ }
+ };
+}
+
+namespace llvm
+{
+ class MachineFunction;
+ class MachineInstr:public ilist_node < MachineInstr >
+ {
+ public:const MachineBasicBlock *getParent () const
+ {
+ }
+ const MachineOperand & getOperand (unsigned i) const
+ {
+ }
+ bool registerDefIsDead (unsigned Reg, const TargetRegisterInfo * TRI =
+ __null) const
+ {
+ }
+ };
+ class AnalysisResolver;
+ class Pass
+ {
+ AnalysisResolver *Resolver;
+ intptr_t PassID;
+ public: explicit Pass (intptr_t pid):Resolver (0), PassID (pid)
+ {
+ }
+ explicit Pass (const void *pid):Resolver (0), PassID ((intptr_t) pid)
+ {
+ }
+ template < typename AnalysisType > AnalysisType & getAnalysis () const;
+ };
+ class FunctionPass:public Pass
+ {
+ public:explicit FunctionPass (intptr_t pid):Pass (pid)
+ {
+ }
+ explicit FunctionPass (const void *pid):Pass (pid)
+ {
+ }
+ };
+ class PassInfo
+ {
+ public:typedef Pass *(*NormalCtor_t) ();
+ private:const char *const PassName;
+ const char *const PassArgument;
+ const intptr_t PassID;
+ const bool IsCFGOnlyPass;
+ const bool IsAnalysis;
+ const bool IsAnalysisGroup;
+ NormalCtor_t NormalCtor;
+ public: PassInfo (const char *name, const char *arg, intptr_t pi, NormalCtor_t normal = 0, bool isCFGOnly = false, bool is_analysis = false):PassName (name), PassArgument (arg), PassID (pi),
+ IsCFGOnlyPass (isCFGOnly), IsAnalysis (is_analysis),
+ IsAnalysisGroup (false), NormalCtor (normal)
+ {
+ }
+ };
+ template < typename PassName > Pass * callDefaultCtor ()
+ {
+ return new PassName ();
+ }
+ template < typename passName > struct RegisterPass:public PassInfo
+ {
+ RegisterPass (const char *PassArg, const char *Name, bool CFGOnly = false, bool is_analysis = false):PassInfo (Name, PassArg, intptr_t (&passName::ID),
+ PassInfo::NormalCtor_t (callDefaultCtor < passName >), CFGOnly,
+ is_analysis)
+ {
+ }
+ };
+ template < typename T > class SmallVectorImpl
+ {
+ };
+ template < typename T,
+ unsigned N > class SmallVector:public SmallVectorImpl < T >
+ {
+ };
+ class MachineFunctionPass:public FunctionPass
+ {
+ protected:explicit MachineFunctionPass (intptr_t ID):FunctionPass (ID)
+ {
+ }
+ explicit MachineFunctionPass (void *ID):FunctionPass (ID)
+ {
+ }
+ virtual bool runOnMachineFunction (MachineFunction & MF) = 0;
+ };
+ class LiveIndex
+ {
+ private:unsigned index;
+ };
+ class VNInfo
+ {
+ };
+ struct LiveRange
+ {
+ LiveIndex start;
+ LiveIndex end;
+ VNInfo *valno;
+ };
+ class LiveInterval
+ {
+ public:typedef SmallVector < LiveRange, 4 > Ranges;
+ bool containsOneValue () const
+ {
+ }
+ LiveRange *getLiveRangeContaining (LiveIndex Idx)
+ {
+ }
+ void removeRange (LiveIndex Start, LiveIndex End, bool RemoveDeadValNo =
+ false);
+ void removeRange (LiveRange LR, bool RemoveDeadValNo = false)
+ {
+ removeRange (LR.start, LR.end, RemoveDeadValNo);
+ }
+ };
+ class LiveIntervals:public MachineFunctionPass
+ {
+ public:static char ID;
+ LiveIndex getDefIndex (LiveIndex index)
+ {
+ }
+ LiveInterval & getInterval (unsigned reg)
+ {
+ }
+ LiveIndex getInstructionIndex (const MachineInstr * instr) const
+ {
+ }
+ };
+}
+
+using namespace llvm;
+namespace
+{
+struct __attribute__ ((visibility ("hidden"))) StrongPHIElimination:public
+ MachineFunctionPass
+ {
+ static char ID;
+ StrongPHIElimination ():MachineFunctionPass (&ID)
+ {
+ }
+ bool runOnMachineFunction (MachineFunction & Fn);
+ };
+}
+
+static RegisterPass < StrongPHIElimination > X ("strong-phi-node-elimination",
+ "Eliminate PHI nodes for register allocation, intelligently");
+bool
+StrongPHIElimination::runOnMachineFunction (MachineFunction & Fn)
+{
+ LiveIntervals & LI = getAnalysis < LiveIntervals > ();
+ std::vector < MachineInstr * >phis;
+ for (std::vector < MachineInstr * >::iterator I = phis.begin (), E =
+ phis.end (); I != E;)
+ {
+ MachineInstr *PInstr = *(I++);
+ unsigned DestReg = PInstr->getOperand (0).getReg ();
+ LiveInterval & PI = LI.getInterval (DestReg);
+ if (PInstr->registerDefIsDead (DestReg))
+ {
+ if (PI.containsOneValue ())
+ {
+ LiveIndex idx =
+ LI.getDefIndex (LI.getInstructionIndex (PInstr));
+ PI.removeRange (*PI.getLiveRangeContaining (idx), true);
+ }
+ }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr42110.C b/gcc/testsuite/g++.dg/torture/pr42110.C
new file mode 100644
index 000000000..c778b4f2f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42110.C
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+bool foo();
+
+struct A
+{
+ A* fooA() { if (foo()) foo(); return this; }
+
+ virtual void barA(char);
+};
+
+template<int> struct B
+{
+ A *p, *q;
+
+ void fooB(char c) { p->fooA()->barA(c); }
+};
+
+template<int N> inline void bar(B<N> b) { b.fooB(0); }
+
+extern template void bar(B<0>);
+
+void (*f)(B<0>) = bar;
+
+void baz()
+{
+ B<0>().fooB(0);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr42183.C b/gcc/testsuite/g++.dg/torture/pr42183.C
new file mode 100644
index 000000000..375b37f0c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42183.C
@@ -0,0 +1,51 @@
+// { dg-do compile }
+
+class IntSize {
+public:
+ IntSize(int width, int height) : m_width(width), m_height(height) { }
+ int m_width, m_height;
+};
+class IntPoint {
+public:
+ IntPoint(int x, int y) : m_x(x), m_y(y) { }
+ int m_x, m_y;
+};
+class IntRect {
+public:
+ IntRect(int x, int y, int width, int height)
+ : m_location(IntPoint(x, y)), m_size(IntSize(width, height)) { }
+ void intersect(const IntRect&);
+ IntPoint m_location;
+ IntSize m_size;
+};
+inline IntRect intersection(const IntRect& a, const IntRect& b) {
+ IntRect c = a;
+ c.intersect(b);
+ return c;
+}
+class RenderObject {
+public:
+ int contentWidth() const { }
+ int contentHeight() const { }
+ virtual int xPos() const { }
+ virtual int yPos() const { }
+ virtual int paddingTop() const;
+ virtual int paddingLeft() const;
+ virtual int borderTop() const { }
+ virtual int borderLeft() const { }
+};
+class RenderMenuList : public RenderObject {
+ virtual IntRect controlClipRect(int tx, int ty) const;
+ RenderObject* m_innerBlock;
+};
+IntRect RenderMenuList::controlClipRect(int tx, int ty) const {
+ IntRect outerBox(tx + borderLeft() + paddingLeft(),
+ ty + borderTop() + paddingTop(),
+ contentWidth(), contentHeight());
+ IntRect innerBox(tx + m_innerBlock->xPos() + m_innerBlock->paddingLeft(),
+ ty + m_innerBlock->yPos() + m_innerBlock->paddingTop(),
+ m_innerBlock->contentWidth(),
+ m_innerBlock->contentHeight());
+ return intersection(outerBox, innerBox);
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr42357.C b/gcc/testsuite/g++.dg/torture/pr42357.C
new file mode 100644
index 000000000..1a1d64e4f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42357.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+typedef unsigned char uint8;
+typedef unsigned int uint32;
+class PixelARGB {
+public:
+ ~PixelARGB() throw() { }
+ PixelARGB (const uint32 argb_) throw() : argb (argb_) { }
+ inline __attribute__((always_inline)) uint8 getRed() const throw() {
+ return components.r;
+ }
+ union {
+ uint32 argb;
+ struct {
+ uint8 b, g, r, a;
+ } components;
+ };
+};
+class Colour {
+public:
+ Colour() throw() : argb (0) {};
+ uint8 getRed() const throw() {
+ return argb.getRed();
+ }
+ PixelARGB argb;
+};
+uint8 writeImage (void) {
+ Colour pixel;
+ pixel = Colour ();
+ return pixel.getRed();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr42450.C b/gcc/testsuite/g++.dg/torture/pr42450.C
new file mode 100644
index 000000000..f630fa2b7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42450.C
@@ -0,0 +1,112 @@
+/* { dg-do compile } */
+
+template < typename > class basic_stringstream;
+
+struct basic_string {
+ basic_string();
+};
+
+struct ios_base {
+ virtual ~ios_base();
+};
+
+class ostream:ios_base {};
+class istream:virtual ios_base {};
+
+template < typename > struct basic_iostream:public istream, ostream {
+ ~basic_iostream () {}
+};
+extern template class basic_iostream < char >;
+
+template < typename > struct basic_stringstream:public basic_iostream < char > {
+ basic_string _M_stringbuf;
+ ~basic_stringstream () {}
+};
+extern template class basic_stringstream < char >;
+
+template < typename > struct AnyMatrixBase;
+template < typename, int _Rows, int _Cols, int = _Rows, int = _Cols > class Matrix;
+template < typename > class CwiseNullaryOp;
+
+template < typename Derived > struct MatrixBase:public AnyMatrixBase < Derived > {
+ typedef CwiseNullaryOp < Derived > ConstantReturnType;
+ ConstantReturnType Constant ();
+ template < typename > Derived cast ();
+ static CwiseNullaryOp < Derived > Random (int);
+};
+
+template < typename Derived > struct AnyMatrixBase {
+ Derived derived () {}
+ Derived & derived () const {}
+};
+
+template < typename, int > struct ei_matrix_storage {};
+
+template < typename _Scalar, int, int, int _MaxRows, int _MaxCols > struct Matrix:MatrixBase < Matrix < _Scalar, _MaxRows, _MaxCols > > {
+ typedef MatrixBase < Matrix > Base;
+ ei_matrix_storage < int, _MaxCols > m_storage;
+ Matrix operator= (const Matrix other) {
+ _resize_to_match (other);
+ lazyAssign (other.derived ());
+ }
+ template < typename OtherDerived > Matrix lazyAssign (MatrixBase < OtherDerived > other) {
+ _resize_to_match (other);
+ return Base (other.derived ());
+ }
+ Matrix ();
+ template < typename OtherDerived > Matrix (const MatrixBase < OtherDerived > &other) {
+ *this = other;
+ }
+ template < typename OtherDerived > void _resize_to_match (const MatrixBase < OtherDerived > &) {
+ throw 1;
+ }
+};
+
+template < typename MatrixType > class CwiseNullaryOp:
+public MatrixBase < CwiseNullaryOp < MatrixType > > {};
+
+int f()
+{
+ bool align_cols;
+ if (align_cols) {
+ basic_stringstream<char> sstr;
+ f();
+ }
+}
+
+template < typename > struct AutoDiffScalar;
+template < typename Functor > struct AutoDiffJacobian:Functor {
+ AutoDiffJacobian (Functor);
+ typedef typename Functor::InputType InputType;
+ typedef typename Functor::ValueType ValueType;
+ typedef Matrix < int, Functor::InputsAtCompileTime, 1 > DerivativeType;
+ typedef AutoDiffScalar < DerivativeType > ActiveScalar;
+ typedef Matrix < ActiveScalar, Functor::InputsAtCompileTime, 1 > ActiveInput;
+ void operator () (InputType x, ValueType *) {
+ ActiveInput ax = x.template cast < ActiveScalar > ();
+ }
+};
+
+template < int NX, int NY > struct TestFunc1 {
+ enum {
+ InputsAtCompileTime = NX
+ };
+ typedef Matrix < float, NX, 1 > InputType;
+ typedef Matrix < float, NY, 1 > ValueType;
+ typedef Matrix < float, NY, NX > JacobianType;
+ int inputs ();
+};
+
+template < typename Func > void forward_jacobian (Func f) {
+ typename Func::InputType x = Func::InputType::Random (f.inputs ());
+ typename Func::ValueType y;
+ typename Func::JacobianType jref = jref.Constant ();
+ AutoDiffJacobian < Func > autoj (f);
+ autoj (x, &y);
+}
+
+void test_autodiff_scalar ()
+{
+ forward_jacobian (TestFunc1 < 2, 2 > ());
+ forward_jacobian (TestFunc1 < 3, 2 > ());
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr42462.C b/gcc/testsuite/g++.dg/torture/pr42462.C
new file mode 100644
index 000000000..947fa388f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42462.C
@@ -0,0 +1,47 @@
+/* { dg-do run } */
+
+#define INLINE inline __attribute__((always_inline))
+extern "C" void abort (void);
+
+template<class> struct Foo {
+ inline bool isFalse() { return false; }
+ template <bool> void f1() {}
+ template <bool> INLINE void f2() { f1<false>(); }
+ template <bool> void f3() { f2<false>(); }
+ template <bool> INLINE void f4() { f3<false>(); }
+ int exec2();
+ void execute();
+ inline void unused();
+};
+
+template<class T> inline void Foo<T>::unused() {
+ f4<true>();
+}
+
+static int counter = 0;
+
+template<class T> int Foo<T>::exec2() {
+ static void* table[2] = { &&begin, &&end };
+ if (counter++ > 10)
+ return 0;
+ goto *(table[0]);
+begin:
+ if (isFalse()) f1<false>();
+end:
+ return 1;
+}
+
+template<class T> void Foo<T>::execute() {
+ int r = 1;
+ while (r) { r = exec2(); }
+}
+
+template class Foo<int>;
+
+int main() {
+ Foo<int> c;
+ c.execute();
+ if (counter < 10)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr42704.C b/gcc/testsuite/g++.dg/torture/pr42704.C
new file mode 100644
index 000000000..735b1e7bd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42704.C
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+
+typedef int PRInt32;
+class nsTreeRows {
+ class Subtree { };
+ enum { kMaxDepth = 32 };
+ struct Link {
+ Subtree* mParent;
+ PRInt32 mChildIndex;
+ Link& operator=(const Link& aLink) {
+ mParent = aLink.mParent;
+ mChildIndex = aLink.mChildIndex;
+ }
+ };
+ class iterator {
+ PRInt32 mTop;
+ PRInt32 mRowIndex;
+ Link mLink[kMaxDepth];
+ public:
+ iterator() : mTop(-1), mRowIndex(-1) { }
+ iterator& operator=(const iterator& aIterator);
+ };
+ Subtree* EnsureSubtreeFor(Subtree* aParent, PRInt32 aChildIndex);
+ Subtree* GetSubtreeFor(const Subtree* aParent,
+PRInt32 aChildIndex, PRInt32* aSubtreeSize = 0);
+ void InvalidateCachedRow() {
+ mLastRow = iterator();
+ }
+ iterator mLastRow;
+};
+nsTreeRows::Subtree* nsTreeRows::EnsureSubtreeFor(Subtree* aParent,
+ PRInt32 aChildIndex) {
+ Subtree* subtree = GetSubtreeFor(aParent, aChildIndex);
+ if (! subtree) {
+ InvalidateCachedRow();
+ }
+}
+nsTreeRows::iterator& nsTreeRows::iterator::operator=(const iterator&
+aIterator) {
+ mTop = aIterator.mTop;
+ for (PRInt32 i = mTop;
+ i >= 0;
+ --i) mLink[i] = aIterator.mLink[i];
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr42714.C b/gcc/testsuite/g++.dg/torture/pr42714.C
new file mode 100644
index 000000000..b1b2d856e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42714.C
@@ -0,0 +1,37 @@
+struct QVectorData {
+ static QVectorData shared_null;
+};
+template <typename T> class QVector {
+ union {
+ QVectorData *d;
+ };
+public:
+ inline QVector() : d(&QVectorData::shared_null) { }
+ inline QVector(const QVector<T> &v) : d(v.d) { }
+};
+class QXmlStreamAttribute { };
+class QXmlStreamAttributes : public QVector<QXmlStreamAttribute> { };
+class __attribute__ ((visibility("default"))) Smoke {
+public:
+ union StackItem;
+ typedef StackItem* Stack;
+ typedef short Index;
+};
+class SmokeBinding { };
+namespace __smokeqt {
+ class x_QXmlStreamAttributes : public QXmlStreamAttributes {
+ SmokeBinding* _binding;
+ public:
+ static void x_11(Smoke::Stack x) {
+ x_QXmlStreamAttributes* xret = new x_QXmlStreamAttributes();
+ }
+ explicit x_QXmlStreamAttributes() : QXmlStreamAttributes() { }
+ };
+ void xcall_QXmlStreamAttributes(Smoke::Index xi, void *obj,
+ Smoke::Stack args)
+ {
+ switch(xi) {
+ case 11: x_QXmlStreamAttributes::x_11(args);
+ }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr42739.C b/gcc/testsuite/g++.dg/torture/pr42739.C
new file mode 100644
index 000000000..ccc05f836
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42739.C
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+struct s { ~s() { s(); } };
+
+int f()
+{
+ M:
+ s o = s();
+ f();
+ f();
+
+ L:
+ goto *(f() ? &&L : &&M);
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr42760.C b/gcc/testsuite/g++.dg/torture/pr42760.C
new file mode 100644
index 000000000..be85f7fc4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42760.C
@@ -0,0 +1,46 @@
+// PR middle-end/42760
+// { dg-do compile }
+
+template <typename T>
+struct A
+{
+ static T b (T it) { return it; }
+};
+
+template <typename T, typename U>
+static U
+baz (T x, T y, U z)
+{
+ for (long n = y - x; n > 0; --n)
+ {
+ *z = *x;
+ ++z;
+ }
+};
+
+template <typename T, typename U>
+U
+bar (T x, T y, U z)
+{
+ baz (A <T>::b (x), A <T>::b (y), A <U>::b (z));
+}
+
+struct C
+{
+ __complex__ float v;
+};
+
+template <class T>
+struct B
+{
+ B (T y[]) { bar (y, y + 1, x); }
+ operator T *() { return x; }
+ T x[1];
+};
+
+B <C>
+foo ()
+{
+ C y[1];
+ return B <C> (y);
+};
diff --git a/gcc/testsuite/g++.dg/torture/pr42773.C b/gcc/testsuite/g++.dg/torture/pr42773.C
new file mode 100644
index 000000000..478ad278a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42773.C
@@ -0,0 +1,54 @@
+// { dg-do compile }
+// { dg-options "-fno-exceptions" }
+
+typedef unsigned int uint;
+struct QShared {
+ bool deref() {
+ return !--count;
+ }
+ uint count;
+};
+template <class T> class QValueListNode {
+public:
+ QValueListNode<T>* next;
+ QValueListNode<T>* prev;
+};
+template <class T> class QValueListPrivate : public QShared {
+public:
+ typedef QValueListNode<T> Node;
+ typedef QValueListNode<T>* NodePtr;
+ QValueListPrivate();
+ void derefAndDelete() {
+ if ( deref() ) delete this;
+ }
+ ~QValueListPrivate();
+ NodePtr node;
+};
+template <class T> QValueListPrivate<T>::QValueListPrivate() {
+ node = new Node;
+ node->next = node->prev = node;
+}
+template <class T> QValueListPrivate<T>::~QValueListPrivate() {
+ NodePtr p = node->next;
+ while( p != node ) {
+ NodePtr x = p->next;
+ delete p;
+ p = x;
+ }
+}
+template <class T> class QValueList {
+public:
+ QValueList() {
+ sh = new QValueListPrivate<T>;
+ }
+ ~QValueList() {
+ sh->derefAndDelete();
+ }
+ QValueListPrivate<T>* sh;
+};
+class Cell {
+ QValueList<Cell*> obscuringCells() const;
+};
+QValueList<Cell*> Cell::obscuringCells() const {
+ QValueList<Cell*> empty;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr42871.C b/gcc/testsuite/g++.dg/torture/pr42871.C
new file mode 100644
index 000000000..452ad9319
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42871.C
@@ -0,0 +1,40 @@
+struct C
+{
+ ~C ();
+ int c3;
+};
+
+C *b2;
+
+static void
+b1 (const C &x, unsigned b3, unsigned b4)
+{
+ unsigned i = 0;
+ for (; i < b3; i++)
+ if (i < b4)
+ {
+ b2[0].c3 = x.c3;
+ return;
+ }
+}
+
+int a ();
+
+void
+bar (unsigned b3, unsigned b4)
+{
+ C c[100];
+ for (int i = 0; i < 100; i++)
+ {
+ c[i].c3 = i;
+ for (int j = 0; j < b3; j++)
+ if (j < b4)
+ {
+ b2[0].c3 = 0;
+ break;
+ }
+ b1 (c[i], b3, b4);
+ a ();
+ }
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr42883.C b/gcc/testsuite/g++.dg/torture/pr42883.C
new file mode 100644
index 000000000..f164c3781
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42883.C
@@ -0,0 +1,63 @@
+// { dg-do compile }
+
+typedef __SIZE_TYPE__ size_t;
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class new_allocator {
+ public:
+ typedef size_t size_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+ void deallocate(pointer __p, size_type) {
+ ::operator delete(__p);
+ }
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
+ public:
+ template<typename _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+ };
+ template<typename _Tp, typename _Alloc> struct _Vector_base {
+ typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
+ struct _Vector_impl : public _Tp_alloc_type {
+ typename _Tp_alloc_type::pointer _M_start;
+ typename _Tp_alloc_type::pointer _M_end_of_storage;
+ };
+ ~_Vector_base() {
+ _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start);
+ }
+ _Vector_impl _M_impl;
+ void _M_deallocate(typename _Tp_alloc_type::pointer __p, size_t __n) {
+ if (__p) _M_impl.deallocate(__p, __n);
+ }
+ };
+ template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> {
+ typedef _Vector_base<_Tp, _Alloc> _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+ public:
+ typedef typename _Tp_alloc_type::reference reference;
+ typedef size_t size_type;
+ size_type size() const {
+ }
+ reference operator[](size_type __n) {
+ }
+ };
+};
+class vtkConvexPointSet {
+public:
+ static vtkConvexPointSet *New();
+};
+void MakeInternalMesh() {
+ std::vector< int > tempFaces[2];
+ std::vector< int > firstFace;
+ int i, j, k;
+ for(i = 0; i < 1000; i++) {
+ for(int pointCount = 0; pointCount < 1000; pointCount++) {
+ for(j = 0; j < (int)tempFaces[0].size(); k++)
+ if(tempFaces[0][j] == tempFaces[1][k]) break;
+ }
+ vtkConvexPointSet::New();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr42890.C b/gcc/testsuite/g++.dg/torture/pr42890.C
new file mode 100644
index 000000000..937367665
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr42890.C
@@ -0,0 +1,25 @@
+// PR tree-optimization/42890
+// { dg-do compile }
+
+extern "C" int puts (const char *) throw ();
+
+struct S
+{
+ const char *a;
+ const char **b;
+ S (const char *s) { a = s; b = &a; }
+ ~S () { puts (a); }
+};
+
+void
+foo (int (*fn) (const char *))
+{
+ S a ("foo");
+ fn ("bar");
+}
+
+int
+main ()
+{
+ foo (puts);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr43068.C b/gcc/testsuite/g++.dg/torture/pr43068.C
new file mode 100644
index 000000000..524fd23ee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43068.C
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-freorder-blocks -ftracer} */
+
+struct A {
+ virtual A *f();
+};
+struct B : virtual A {
+ virtual B *f();
+};
+B *B::f() { return 0; }
diff --git a/gcc/testsuite/g++.dg/torture/pr43257.C b/gcc/testsuite/g++.dg/torture/pr43257.C
new file mode 100644
index 000000000..a3e75574a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43257.C
@@ -0,0 +1,30 @@
+/* { dg-do assemble } */
+
+class A {};
+class B {};
+
+static void *func (int n)
+{
+ void *p;
+ if (p == 0) throw ::A ();
+}
+
+static void *func (int n, B const &)
+{
+ try {
+ return func (n);
+ }
+ catch (::A const &) {
+ }
+ return func (n);
+}
+
+void *f1 (int n)
+{
+ return func (n, B());
+}
+
+void *f2 (int n)
+{
+ return func (n, B());
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr43611.C b/gcc/testsuite/g++.dg/torture/pr43611.C
new file mode 100644
index 000000000..6899a6ea4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43611.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-fkeep-inline-functions" }
+
+template < typename >
+struct A {
+ void init (int);
+ A ()
+ {
+ this->init (0);
+ }
+};
+
+template < typename >
+struct B : A < int > {
+ A < int > a;
+ B () {}
+};
+
+extern template struct A < int >;
+extern template struct B < int >;
+
+B < int > b;
diff --git a/gcc/testsuite/g++.dg/torture/pr43784.C b/gcc/testsuite/g++.dg/torture/pr43784.C
new file mode 100644
index 000000000..a83a6f374
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43784.C
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-fno-tree-sra" } */
+
+struct S {int x, y, makemelarge[5];};
+S __attribute__((noinline)) f (S &s) {
+ S r;
+ r.x = s.y;
+ r.y = s.x;
+ return r;
+}
+int __attribute__((noinline)) glob (int a, int b)
+{
+ S local = { a, b };
+ local = f (local);
+ return local.y;
+}
+extern "C" void abort (void);
+int main (void)
+{
+ if (glob (1, 3) != 1)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr43801.C b/gcc/testsuite/g++.dg/torture/pr43801.C
new file mode 100644
index 000000000..3b52d4abc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43801.C
@@ -0,0 +1,22 @@
+// PR tree-optimization/43801
+// { dg-do compile }
+// { dg-options "-fipa-cp -fipa-cp-clone" }
+
+struct A
+{
+ virtual void f (int);
+};
+struct B : virtual A
+{
+ virtual void f (int i) { if (i) A::f(0); }
+};
+struct C : virtual B
+{
+ virtual void f (int) { B::f(0); }
+};
+
+void
+foo ()
+{
+ C ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr43879-1_0.C b/gcc/testsuite/g++.dg/torture/pr43879-1_0.C
new file mode 100644
index 000000000..710f6adfe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43879-1_0.C
@@ -0,0 +1,11 @@
+struct A {
+ int *i;
+ A();
+ ~A();
+};
+
+static int x = 0;
+
+A::A() : i(&x) {}
+A::~A() {}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr43879-1_1.C b/gcc/testsuite/g++.dg/torture/pr43879-1_1.C
new file mode 100644
index 000000000..0c943381f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43879-1_1.C
@@ -0,0 +1,48 @@
+/* { dg-do run } */
+/* { dg-options "-fipa-pta" } */
+/* { dg-additional-sources "pr43879-1_0.C" } */
+
+struct A {
+ int *i;
+ A();
+ ~A();
+};
+
+static inline int
+aa(int *a, int *b)
+{
+ (void)b;
+ return *a;
+}
+
+struct B {
+ B() : i(0) {}
+ int i;
+ B(const A &a) : i(0)
+ {
+ f(*a.i);
+ }
+ void __attribute__((noinline, noclone))
+ f(int j)
+ {
+ aa(&i, &j);
+ i = 1;
+ }
+};
+
+int
+test()
+{
+ B b1;
+ B b2 = B(A());
+ b1 = B(A());
+ if (b1.i != b2.i) __builtin_abort();
+ return 0;
+}
+
+int
+main()
+{
+ return test();
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr43880.C b/gcc/testsuite/g++.dg/torture/pr43880.C
new file mode 100644
index 000000000..bf82bc54b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43880.C
@@ -0,0 +1,16 @@
+// { dg-do compile }
+
+extern void xread(void *);
+class test
+{
+public:
+ test(void);
+};
+test::test(void)
+{
+ union {
+ char pngpal[1];
+ };
+ xread(pngpal);
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr43905.C b/gcc/testsuite/g++.dg/torture/pr43905.C
new file mode 100644
index 000000000..0e49a32a1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr43905.C
@@ -0,0 +1,13 @@
+extern void sf ( __const char *);
+struct Matrix{
+ int operator[](int n){
+ sf ( __PRETTY_FUNCTION__);
+ }
+ int operator[](int n)const{
+ sf ( __PRETTY_FUNCTION__);
+ }
+};
+void calcmy(Matrix const &b, Matrix &c, int k){
+ b[k];
+ c[k];
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44069.C b/gcc/testsuite/g++.dg/torture/pr44069.C
new file mode 100644
index 000000000..99fcd173e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44069.C
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+template <unsigned R, unsigned C>
+class M {
+public:
+ M(const int* arr) {
+ for (unsigned long r = 0; r < R; ++r)
+ for (unsigned long c = 0; c < C; ++c)
+ m[r*C+c] = arr[r*C+c];
+ }
+ int operator()(unsigned r, unsigned c) const
+ { return m[r*C+c]; }
+private:
+ int m[R*C];
+};
+extern "C" void abort (void);
+int main()
+{
+ int vals[2][2] = { { 1, 2 }, { 5, 6 } };
+ M<2,2> m( &(vals[0][0]) );
+ if (m(1,0) != 5)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr44148.C b/gcc/testsuite/g++.dg/torture/pr44148.C
new file mode 100644
index 000000000..a60ba9aa3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44148.C
@@ -0,0 +1,60 @@
+// PR c++/44148
+// { dg-do compile }
+// { dg-options "" }
+// { dg-options "-fpic" { target fpic } }
+
+template <typename T> struct S2
+{
+ typedef const T &t2;
+ t2 operator* () const {}
+};
+template <typename T> struct S3
+{
+ typedef S2 <T> t5;
+};
+template <typename T1, typename T2> T2 foo1 (T1 x, T2 y) { y (*x); }
+template <class T> struct S4
+{
+ T &operator* () const;
+};
+struct S7 {};
+struct S8
+{
+ typedef::S3 <S4 <S7> >::t5 t6;
+ t6 m1 () const;
+};
+template <class T> struct S9
+{
+ typedef T t3;
+ inline t3 &operator[] (unsigned int) {}
+};
+template <typename T1, typename T2, typename T3, void (&T4) (const T1 &, T3 &)> struct S10
+{
+ S10 (T2 &x, unsigned int y = 0) : u (x), v (y) {}
+ void operator () (const S4 <T1> &x) { T4 (*x, u[v++]); }
+ T2 &u;
+ unsigned int v;
+};
+struct S15;
+struct S11
+{
+ static void m3 (const S8 &, S15 &);
+};
+struct S16;
+struct S12;
+struct S13
+{
+ static void m4 (const S7 &,S16 &);
+};
+typedef S10 <S7, S12, S16, S13::m4> t10;
+struct S12: S9 <S16>
+{
+};
+struct S15
+{
+ S12 p;
+};
+void S11::m3 (const S8 &x, S15 &y)
+{
+ foo1 (x.m1 (), t10 (y.p));
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44206.C b/gcc/testsuite/g++.dg/torture/pr44206.C
new file mode 100644
index 000000000..a1dedb450
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44206.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+
+template<int> struct A
+{
+ void foo(void(*)(A));
+ void bar(void(*f)(A)) { foo(f); foo(f); }
+};
+
+template<int N> inline void FOO(A<N> a)
+{
+ a.foo(0);
+}
+
+extern template void FOO(A<0>);
+
+void BAR()
+{
+ A<0> a;
+ FOO(a);
+ a.bar(FOO);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44295.C b/gcc/testsuite/g++.dg/torture/pr44295.C
new file mode 100644
index 000000000..8169bb0a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44295.C
@@ -0,0 +1,170 @@
+/* { dg-do compile } */
+extern "C" {
+ typedef __SIZE_TYPE__ size_t;
+ typedef struct {
+ } __sigset_t;
+ typedef union {
+ } pthread_barrierattr_t;
+ }
+ typedef unsigned short XMLCh;
+ typedef unsigned long XMLSize_t;
+ namespace xercesc_2_5 {
+ class DOMNodeList;
+ class DOMNode {
+ };
+ class DOMDocumentRange {
+ };
+ class DOMDocument: public DOMDocumentRange, public DOMNode {
+ };
+ union wait {
+ struct {
+ }
+ __wait_stopped;
+ }
+ div_t;
+ class MemoryManager;
+ class XMemory {
+ public : void* operator new(size_t size, MemoryManager* memMgr);
+ void operator delete(void* p);
+ void operator delete(void* p, MemoryManager* memMgr);
+ };
+ class XMLExcepts {
+ public : enum Codes {
+ NoError = 0 , HshTbl_ZeroModulus = 48 , HshTbl_BadHashFromKey = 49 };
+ };
+ class XMLUni {
+ };
+ }
+ namespace xercesc_2_5 {
+ class XMLException : public XMemory {
+ public:
+ virtual ~XMLException();
+ XMLException(const char* const srcFile, const unsigned int srcLine, MemoryManager* const memoryManager = 0);
+ void loadExceptText ( const XMLExcepts::Codes toLoad );
+ };
+ class XMLDeleter {
+ };
+ class XMLPlatformUtils {
+ public : static MemoryManager* fgMemoryManager;
+ static inline size_t alignPointerForNewBlockAllocation(size_t ptrSize);
+ };
+ inline size_t XMLPlatformUtils::alignPointerForNewBlockAllocation(size_t ptrSize) {
+ }
+ class HashBase : public XMemory {
+ public:
+ virtual bool equals(const void *const key1, const void *const key2) = 0;
+ virtual ~HashBase() {
+};
+ };
+ class IllegalArgumentException : public XMLException {
+ public:
+IllegalArgumentException(const char* const srcFile , const unsigned int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = 0) : XMLException(srcFile, srcLine, memoryManager) {
+ loadExceptText(toThrow);
+ }
+ };
+ class RuntimeException : public XMLException {
+ public:
+RuntimeException(const char* const srcFile , const unsigned int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = 0) : XMLException(srcFile, srcLine, memoryManager) {
+ loadExceptText(toThrow);
+ }
+ };
+ class MemoryManager {
+ public:
+ virtual ~MemoryManager() {
+ }
+ virtual void* allocate(size_t size) = 0;
+ };
+ template <class TElem> class BaseRefVectorOf : public XMemory {
+ BaseRefVectorOf ( const unsigned int maxElems , const bool adoptElems = true , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager );
+ virtual ~BaseRefVectorOf();
+ bool fAdoptedElems;
+ TElem** fElemList;
+ };
+ template <class TElem> BaseRefVectorOf<TElem>::BaseRefVectorOf( const unsigned int maxElems , const bool adoptElems , MemoryManager* const manager) : fAdoptedElems(adoptElems) {
+ for (unsigned int index = 0;
+ index < maxElems;
+ index++) fElemList[index] = 0;
+ }
+ template <class TElem> BaseRefVectorOf<TElem>::~BaseRefVectorOf() {
+ }
+ class XMLString {
+ public:
+ static bool equals ( const XMLCh* const str1 , const XMLCh* const str2 );
+ static void moveChars ( XMLCh* const targetStr , const XMLCh* const srcStr , const unsigned int count );
+ };
+ inline void XMLString::moveChars( XMLCh* const targetStr , const XMLCh* const srcStr , const unsigned int count) {
+ }
+ inline bool XMLString::equals( const XMLCh* const str1 , const XMLCh* const str2) {
+ const XMLCh* psz1 = str1;
+ const XMLCh* psz2 = str2;
+ if (psz1 == 0 || psz2 == 0) {
+ return true;
+ }
+ }
+ }
+ namespace xercesc_2_5 {
+ class HashPtr : public HashBase {
+ virtual bool equals(const void *const key1, const void *const key2);
+ };
+ template <class TVal> struct DOMDeepNodeListPoolTableBucketElem : public XMemory {
+ void* fKey1;
+ XMLCh* fKey2;
+ XMLCh* fKey3;
+ };
+ template <class TVal> class DOMDeepNodeListPool {
+ public:
+ DOMDeepNodeListPool ( const XMLSize_t modulus , const bool adoptElems , const XMLSize_t initSize = 128 );
+ TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3);
+ DOMDeepNodeListPoolTableBucketElem<TVal>* findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal);
+ bool fAdoptedElems;
+ DOMDeepNodeListPoolTableBucketElem<TVal>** fBucketList;
+ XMLSize_t fHashModulus;
+ HashBase* fHash;
+ TVal** fIdPtrs;
+ XMLSize_t fIdPtrsCount;
+ MemoryManager* fMemoryManager;
+ };
+ template <class TVal> DOMDeepNodeListPool<TVal>::DOMDeepNodeListPool( const XMLSize_t modulus , const bool adoptElems , const XMLSize_t initSize) : fAdoptedElems(adoptElems) , fBucketList(0) , fHash(0) , fIdPtrs(0) {
+ fHash = new (fMemoryManager) HashPtr();
+ fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));
+ if (modulus == 0) throw IllegalArgumentException("./xercesc/dom/impl/bad.c", 38, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager);
+ }
+ template <class TVal> TVal* DOMDeepNodeListPool<TVal>::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) {
+ XMLSize_t hashVal;
+ DOMDeepNodeListPoolTableBucketElem<TVal>* findIt = findBucketElem(key1, key2, key3, hashVal);
+ }
+ template <class TVal> DOMDeepNodeListPoolTableBucketElem<TVal>* DOMDeepNodeListPool<TVal>:: findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) {
+ if (hashVal > fHashModulus) throw RuntimeException("./xercesc/dom/impl/bad.c", 64, XMLExcepts::HshTbl_BadHashFromKey, fMemoryManager);
+ DOMDeepNodeListPoolTableBucketElem<TVal>* curElem = fBucketList[hashVal];
+ if (fHash->equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
+ return curElem;
+ }
+ }
+ class DOMDeepNodeListImpl;
+ class DOMDocumentImpl: public DOMDocument {
+ DOMNodeList* getElementsByTagName(const XMLCh * tagname) const;
+ DOMNodeList* getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName);
+ DOMNodeList* getDeepNodeList(const DOMNode *rootNode, const XMLCh *namespaceURI, const XMLCh *localName);
+ DOMDeepNodeListPool<DOMDeepNodeListImpl>* fNodeListPool;
+ };
+ }
+ void * operator new(size_t amt, xercesc_2_5:: DOMDocument *doc);
+ namespace xercesc_2_5 {
+ class DOMNodeList {
+ };
+ class DOMDeepNodeListImpl: public DOMNodeList {
+ };
+ DOMNodeList *DOMDocumentImpl::getElementsByTagName(const XMLCh *tagname) const {
+ return ((DOMDocumentImpl*)this)->getDeepNodeList(this,tagname);
+ }
+ DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName) {
+ if(!fNodeListPool) {
+ fNodeListPool = new (this) DOMDeepNodeListPool<DOMDeepNodeListImpl>(109, false);
+ }
+ DOMNodeList* retList = fNodeListPool->getByKey(rootNode, tagName, 0);
+ }
+ DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, const XMLCh *namespaceURI, const XMLCh *localName) {
+ DOMNodeList* retList = fNodeListPool->getByKey(rootNode, localName, namespaceURI);
+ }
+ }
+
diff --git a/gcc/testsuite/g++.dg/torture/pr44357.C b/gcc/testsuite/g++.dg/torture/pr44357.C
new file mode 100644
index 000000000..3380350e8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44357.C
@@ -0,0 +1,228 @@
+/* { dg-do compile } */
+extern "C"
+{
+ typedef long unsigned int size_t;
+}
+namespace llvm
+{
+ namespace dont_use
+ {
+ template < typename T > double is_class_helper (...);
+ }
+ template < typename T > struct is_class
+ {
+ public:enum
+ { value = sizeof (char) == sizeof (dont_use::is_class_helper < T > (0)) };
+ };
+ template < typename T > struct isPodLike
+ {
+ static const bool value = !is_class < T >::value;
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Iterator > struct iterator_traits
+ {
+ };
+ template < typename _Tp > struct iterator_traits <_Tp * >
+ {
+ typedef _Tp value_type;
+ };
+}
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Tp > class new_allocator
+ {
+ public:typedef size_t size_type;
+ typedef const _Tp & const_reference;
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
+ _Tp >
+ {
+ public:typedef size_t size_type;
+ template < typename _Tp1 > struct rebind
+ {
+ typedef allocator < _Tp1 > other;
+ };
+ };
+ template < typename _Tp, typename _Alloc > struct _Vector_base
+ {
+ typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
+ };
+template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:protected _Vector_base < _Tp,
+ _Alloc
+ >
+ {
+ typedef _Vector_base < _Tp, _Alloc > _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+ public:typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::const_reference const_reference;
+ typedef size_t size_type;
+ size_type size () const
+ {
+ } const_reference operator[] (size_type __n) const
+ {
+ }};
+}
+
+namespace llvm
+{
+ struct LandingPadInfo;
+ class DwarfException
+ {
+ static bool PadLT (const LandingPadInfo * L, const LandingPadInfo * R);
+ struct CallSiteEntry
+ {
+ };
+ void EmitExceptionTable ();
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _RandomAccessIterator,
+ typename _Compare >
+ void __unguarded_linear_insert (_RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ typename iterator_traits < _RandomAccessIterator >::value_type __val =
+ (*__last);
+ _RandomAccessIterator __next = __last;
+ while (__comp (__val, *__next))
+ {
+ }
+ }
+ template < typename _RandomAccessIterator,
+ typename _Compare > void __insertion_sort (_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
+ {
+ if (__comp (*__i, *__first))
+ {
+ }
+ else
+ std::__unguarded_linear_insert (__i, __comp);
+ }
+ }
+ enum
+ { _S_threshold = 16 };
+ template < typename _RandomAccessIterator,
+ typename _Compare >
+ void __final_insertion_sort (_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ if (__last - __first > int (_S_threshold))
+ {
+ std::__insertion_sort (__first, __first + int (_S_threshold), __comp);
+ }
+ }
+ template < typename _RandomAccessIterator,
+ typename _Compare > inline void sort (_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ if (__first != __last)
+ {
+ std::__final_insertion_sort (__first, __last, __comp);
+ }
+ }
+}
+
+namespace llvm
+{
+ class SmallVectorBase
+ {
+ protected:void *BeginX, *EndX, *CapacityX;
+ struct U
+ {
+ } FirstEl;
+ protected: SmallVectorBase (size_t Size):BeginX (&FirstEl), EndX (&FirstEl),
+ CapacityX ((char *) &FirstEl + Size)
+ {
+ }};
+template < typename T > class SmallVectorTemplateCommon:public
+ SmallVectorBase
+ {
+ public: SmallVectorTemplateCommon (size_t Size):SmallVectorBase (Size)
+ {
+ } typedef size_t size_type;
+ typedef T *iterator;
+ iterator begin ()
+ {
+ } iterator end ()
+ {
+ } size_type size () const
+ {
+ }};
+template < typename T, bool isPodLike > class SmallVectorTemplateBase:public SmallVectorTemplateCommon <
+ T >
+ {
+ public: SmallVectorTemplateBase (size_t Size):SmallVectorTemplateCommon < T >
+ (Size)
+ {
+ }};
+template < typename T > class SmallVectorImpl:public SmallVectorTemplateBase < T,
+ isPodLike < T >::value >
+ {
+ typedef SmallVectorTemplateBase < T, isPodLike < T >::value > SuperClass;
+ public:typedef typename SuperClass::iterator iterator;
+ explicit SmallVectorImpl (unsigned N):SmallVectorTemplateBase < T,
+ isPodLike < T >::value > (N * sizeof (T))
+ {
+ }
+ };
+ template < typename T,
+ unsigned N > class SmallVector:public SmallVectorImpl < T >
+ {
+ typedef typename SmallVectorImpl < T >::U U;
+ enum
+ { MinUs =
+ (static_cast < unsigned int >(sizeof (T)) * N + static_cast <
+ unsigned int >(sizeof (U)) - 1) /static_cast <
+ unsigned int >(sizeof (U)), NumInlineEltsElts =
+ MinUs > 1 ? (MinUs - 1) : 1, NumTsAvailable =
+ (NumInlineEltsElts + 1) * static_cast <
+ unsigned int >(sizeof (U)) / static_cast <
+ unsigned int >(sizeof (T)) };
+ public: SmallVector ():SmallVectorImpl < T > (NumTsAvailable)
+ {
+ }
+ };
+ struct LandingPadInfo
+ {
+ std::vector < int >TypeIds;
+ union
+ {
+ } Contents;
+ };
+}
+
+using namespace llvm;
+bool
+DwarfException::PadLT (const LandingPadInfo * L, const LandingPadInfo * R)
+{
+ const std::vector < int >&LIds = L->TypeIds, &RIds = R->TypeIds;
+ unsigned LSize = LIds.size (), RSize = RIds.size ();
+ unsigned MinSize = LSize < RSize ? LSize : RSize;
+ for (unsigned i = 0; i != MinSize; ++i)
+ if (LIds[i] != RIds[i])
+ return LIds[i] < RIds[i];
+}
+
+void
+DwarfException::EmitExceptionTable ()
+{
+ SmallVector < const LandingPadInfo *, 64 > LandingPads;
+ std::sort (LandingPads.begin (), LandingPads.end (), PadLT);
+ SmallVector < CallSiteEntry, 64 > CallSites;
+ for (unsigned i = 0, e = CallSites.size (); i < e; ++i)
+ {
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44492.C b/gcc/testsuite/g++.dg/torture/pr44492.C
new file mode 100644
index 000000000..41669241e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44492.C
@@ -0,0 +1,31 @@
+// PR middle-end/44492
+// { dg-do run }
+
+struct T { unsigned long p; };
+struct S { T a, b, c; unsigned d; };
+
+__attribute__((noinline))
+void
+bar (const T &x, const T &y)
+{
+ if (x.p != 0x2348 || y.p != 0x2346)
+ __builtin_abort ();
+}
+
+__attribute__((noinline))
+void
+foo (S &s, T e)
+{
+ unsigned long a = e.p;
+ unsigned long b = s.b.p;
+ __asm__ volatile ("" : : "rm" (a), "rm" (b));
+ bar (e, s.b);
+}
+
+int
+main ()
+{
+ S s = { { 0x2345 }, { 0x2346 }, { 0x2347 }, 6 };
+ T t = { 0x2348 };
+ foo (s, t);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44535.C b/gcc/testsuite/g++.dg/torture/pr44535.C
new file mode 100644
index 000000000..9126f3997
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44535.C
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+
+namespace FOO {
+
+template <typename T>
+class A
+{
+public:
+ void Enum();
+ virtual void OnProv() = 0;
+ virtual ~A() { }
+};
+typedef A<char> B;
+
+template<typename T>
+void A<T>::Enum ()
+{
+ OnProv ();
+}
+} // namespace FOO
+
+class C {};
+
+class D: public C, public FOO::B {
+public:
+ void OnProv() {}
+};
+
+int main(int argc, char *argv[])
+{
+ D x;
+ x.Enum();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44809.C b/gcc/testsuite/g++.dg/torture/pr44809.C
new file mode 100644
index 000000000..b6615f23f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44809.C
@@ -0,0 +1,6 @@
+// { dg-do compile }
+unsigned int mEvictionRank[(1 << 5)];
+void Unswap(int i)
+{
+ mEvictionRank[i] = ({ unsigned int __v = i; __v; });
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44813.C b/gcc/testsuite/g++.dg/torture/pr44813.C
new file mode 100644
index 000000000..1dc01b06a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44813.C
@@ -0,0 +1,60 @@
+typedef unsigned int PRUint32;
+typedef int PRInt32;
+typedef unsigned long PRUint64;
+typedef int PRIntn;
+typedef PRIntn PRBool;
+struct nsRect {
+ nsRect(const nsRect& aRect) { }
+};
+enum nsCompatibility { eCompatibility_NavQuirks = 3 };
+class gfxContext;
+typedef PRUint64 nsFrameState;
+class nsPresContext {
+public:
+ nsCompatibility CompatibilityMode() const { }
+};
+class nsStyleContext {
+public:
+ PRBool HasTextDecorations() const;
+};
+class nsIFrame {
+public:
+ nsPresContext* PresContext() const;
+ nsStyleContext* GetStyleContext() const;
+ nsFrameState GetStateBits() const;
+ nsRect GetOverflowRect() const;
+};
+class nsFrame : public nsIFrame { };
+class nsLineList_iterator { };
+class nsLineList {
+public:
+ typedef nsLineList_iterator iterator;
+};
+class gfxSkipCharsIterator { };
+class gfxTextRun {
+public:
+ class PropertyProvider { };
+};
+class nsTextFrame : public nsFrame
+{
+ virtual nsRect ComputeTightBounds(gfxContext* aContext) const;
+ gfxSkipCharsIterator EnsureTextRun(gfxContext* aReferenceContext = 0L,
+ nsIFrame* aLineContainer = 0L,
+ const nsLineList::iterator* aLine = 0L,
+ PRUint32* aFlowEndInTextRun = 0L);
+};
+class PropertyProvider : public gfxTextRun::PropertyProvider
+{
+public:
+ PropertyProvider(nsTextFrame* aFrame, const gfxSkipCharsIterator& aStart);
+ PRInt32 mLength[64];
+};
+nsRect nsTextFrame::ComputeTightBounds(gfxContext* aContext) const
+{
+ if ((GetStyleContext()->HasTextDecorations()
+ && eCompatibility_NavQuirks == PresContext()->CompatibilityMode())
+ || (GetStateBits() & (nsFrameState(1) << (23))))
+ return GetOverflowRect();
+ gfxSkipCharsIterator iter = const_cast<nsTextFrame*>(this)->EnsureTextRun();
+ PropertyProvider provider(const_cast<nsTextFrame*>(this), iter);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44826.C b/gcc/testsuite/g++.dg/torture/pr44826.C
new file mode 100644
index 000000000..aece14070
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44826.C
@@ -0,0 +1,44 @@
+typedef unsigned short PRUint16;
+typedef PRUint16 PRUnichar;
+template <class CharT> struct nsCharTraits {
+};
+class nsAString_internal {
+public:
+ typedef PRUnichar char_type;
+};
+class nsString : public nsAString_internal {
+public:
+ typedef nsString self_type;
+ nsString( const self_type& str );
+};
+class nsDependentString : public nsString {
+public:
+ explicit nsDependentString( const char_type* data );
+};
+typedef struct sqlite3_stmt sqlite3_stmt;
+const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
+class nsIVariant { };
+template <typename DataType> struct variant_storage_traits {
+ typedef DataType ConstructorType;
+ typedef DataType StorageType;
+ static inline StorageType storage_conversion(ConstructorType aData) {
+ return aData;
+ }
+};
+template <typename DataType> class Variant : public nsIVariant {
+public:
+ Variant(typename variant_storage_traits<DataType>::ConstructorType aData)
+ : mData(variant_storage_traits<DataType>::storage_conversion(aData)) {}
+ typename variant_storage_traits<DataType>::StorageType mData;
+};
+typedef Variant<nsString> TextVariant;
+class Row {
+ void initialize(sqlite3_stmt *aStatement);
+};
+void Row::initialize(sqlite3_stmt *aStatement)
+{
+ nsDependentString str(static_cast<const PRUnichar
+*>(::sqlite3_column_text16(aStatement, 0)));
+ new TextVariant(str);
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr44900.C b/gcc/testsuite/g++.dg/torture/pr44900.C
new file mode 100644
index 000000000..ad150d7fb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44900.C
@@ -0,0 +1,76 @@
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-msse" } */
+/* { dg-require-effective-target sse_runtime } */
+
+typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef float __v4sf __attribute__ ((__vector_size__ (16)));
+
+extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__,
+__artificial__))
+_mm_set_ps (const float __Z, const float __Y, const float __X, const float __W)
+{
+ return __extension__ (__m128)(__v4sf){ __W, __X, __Y, __Z };
+}
+
+struct vec
+{
+ union {
+ __m128 v;
+ float e[4];
+ };
+
+ static const vec & zero()
+ {
+ static const vec v = _mm_set_ps(0, 0, 0, 0);
+ return v;
+ }
+
+ vec() {}
+ vec(const __m128 & a) : v(a) {}
+
+ operator const __m128&() const { return v; }
+};
+
+struct vec2
+{
+ vec _v1;
+ vec _v2;
+
+ vec2() {}
+ vec2(const vec & a, const vec & b) : _v1(a), _v2(b) {}
+
+ static vec2 load(const float * a)
+ {
+ return vec2(
+ __builtin_ia32_loadups(&a[0]),
+ __builtin_ia32_loadups(&a[4]));
+ }
+
+ const vec & v1() const { return _v1; }
+ const vec & v2() const { return _v2; }
+};
+
+extern "C" void abort(void);
+
+
+inline bool operator==(const vec & a, const vec & b)
+{ return 0xf == __builtin_ia32_movmskps(__builtin_ia32_cmpeqps(a, b)); }
+
+int main( int argc, char * argv[] )
+{
+ __attribute__((aligned(16))) float data[] =
+ { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5 };
+
+ float * p = &data[2];
+ vec2 a;
+
+ a = vec2::load(p);
+
+ vec v1 = a.v1();
+ vec v2 = a.v2();
+
+ if (v2.e[3] != 7.0)
+ abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44915.C b/gcc/testsuite/g++.dg/torture/pr44915.C
new file mode 100644
index 000000000..ba7e96606
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44915.C
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-findirect-inlining" } */
+
+struct A;
+
+typedef void (A::*f_ptr) ();
+
+void dummy (f_ptr) { }
+
+void call_dummy (f_ptr cb)
+{
+ dummy (cb);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr44972.C b/gcc/testsuite/g++.dg/torture/pr44972.C
new file mode 100644
index 000000000..e409148da
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr44972.C
@@ -0,0 +1,142 @@
+/* { dg-do compile } */
+
+#include<cassert>
+#include<new>
+#include<utility>
+
+namespace boost {
+
+template<class T>
+class optional;
+
+class aligned_storage
+{
+ char data[ 1000 ];
+ public:
+ void const* address() const { return &data[0]; }
+ void * address() { return &data[0]; }
+} ;
+
+
+template<class T>
+class optional_base
+{
+ protected :
+ optional_base(){}
+ optional_base ( T const& val )
+ {
+ construct(val);
+ }
+
+ template<class U>
+ void assign ( optional<U> const& rhs )
+ {
+ if (!is_initialized())
+ if ( rhs.is_initialized() )
+ construct(T());
+ }
+
+ public :
+
+ bool is_initialized() const { return m_initialized ; }
+
+ protected :
+
+ void construct ( T const& val )
+ {
+ new (m_storage.address()) T(val) ;
+ }
+
+ T const* get_ptr_impl() const
+ { return static_cast<T const*>(m_storage.address()); }
+
+ private :
+
+ bool m_initialized ;
+ aligned_storage m_storage ;
+} ;
+
+
+template<class T>
+class optional : public optional_base<T>
+{
+ typedef optional_base<T> base ;
+
+ public :
+
+ optional() : base() {}
+ optional ( T const& val ) : base(val) {}
+ optional& operator= ( optional const& rhs )
+ {
+ this->assign( rhs ) ;
+ return *this ;
+ }
+
+ T const& get() const ;
+
+ T const* operator->() const { assert(this->is_initialized()) ; return this->get_ptr_impl() ; }
+
+} ;
+
+
+} // namespace boost
+
+
+namespace std
+{
+
+ template<typename _Tp, std::size_t _Nm>
+ struct array
+ {
+ typedef _Tp value_type;
+ typedef const value_type* const_iterator;
+
+ value_type _M_instance[_Nm];
+
+ };
+}
+
+
+class NT
+{
+ double _inf, _sup;
+};
+
+
+template < typename T > inline
+std::array<T, 1>
+make_array(const T& b1)
+{
+ std::array<T, 1> a = { { b1 } };
+ return a;
+}
+
+class V
+{
+ typedef std::array<NT, 1> Base;
+ Base base;
+
+public:
+ V() {}
+ V(const NT &x)
+ : base(make_array(x)) {}
+
+};
+
+using boost::optional ;
+
+optional< std::pair< NT, NT > >
+ linsolve_pointC2() ;
+
+optional< V > construct_normal_offset_lines_isecC2 ( )
+{
+ optional< std::pair<NT,NT> > ip;
+
+ ip = linsolve_pointC2();
+
+ V a(ip->first) ;
+ return a;
+}
+
+
+
diff --git a/gcc/testsuite/g++.dg/torture/pr45393.C b/gcc/testsuite/g++.dg/torture/pr45393.C
new file mode 100644
index 000000000..5bf16b034
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45393.C
@@ -0,0 +1,38 @@
+// { dg-do compile }
+
+class FloatPoint;
+class Path {
+public:
+ ~Path();
+ void moveTo(const FloatPoint&);
+ static void createEllipse(const FloatPoint& center, float rx, float ry);
+};
+extern "C" {
+ extern float cosf (float);
+ extern float sinf (float);
+}
+const float piFloat = static_cast<float>(3.14159265358979323846);
+class FloatPoint {
+public:
+ FloatPoint(float x, float y) : m_x(x), m_y(y) { }
+ float x() const;
+ float y() const;
+ float m_x, m_y;
+};
+void Path::createEllipse(const FloatPoint& center, float rx, float ry)
+{
+ float cx = center.x();
+ float cy = center.y();
+ Path path;
+ float x = cx;
+ float y = cy;
+ unsigned step = 0, num = 100;
+ while (1) {
+ float angle = static_cast<float>(step) / num * 2.0f * piFloat;
+ x = cx + cosf(angle) * rx;
+ y = cy + sinf(angle) * ry;
+ step++;
+ if (step == 1)
+ path.moveTo(FloatPoint(x, y));
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr45580.C b/gcc/testsuite/g++.dg/torture/pr45580.C
new file mode 100644
index 000000000..c3af4910a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45580.C
@@ -0,0 +1,50 @@
+// { dg-do compile }
+
+namespace std {
+ typedef __SIZE_TYPE__ size_t;
+}
+inline void* operator new(std::size_t, void* __p) throw() {
+ return __p;
+}
+class Noncopyable { };
+struct CollectorCell { };
+template<typename T> class PassRefPtr {
+public:
+ T* releaseRef() const { }
+};
+template <typename T> class NonNullPassRefPtr {
+public:
+ template <class U> NonNullPassRefPtr(const PassRefPtr<U>& o)
+ : m_ptr(o.releaseRef()) { }
+ mutable T* m_ptr;
+};
+struct ClassInfo;
+class JSValue { };
+JSValue jsNull();
+class Structure;
+class JSGlobalData {
+ static void storeVPtrs();
+};
+class JSCell : public Noncopyable {
+ friend class JSObject;
+ friend class JSGlobalData;
+ virtual ~JSCell();
+};
+class JSObject : public JSCell {
+public:
+ explicit JSObject(NonNullPassRefPtr<Structure>);
+ static PassRefPtr<Structure> createStructure(JSValue prototype) { }
+};
+class JSByteArray : public JSObject {
+ friend class JSGlobalData;
+ enum VPtrStealingHackType { VPtrStealingHack };
+ JSByteArray(VPtrStealingHackType)
+ : JSObject(createStructure(jsNull())), m_classInfo(0) { }
+ const ClassInfo* m_classInfo;
+};
+void JSGlobalData::storeVPtrs() {
+ CollectorCell cell;
+ void* storage = &cell;
+ JSCell* jsByteArray = new (storage) JSByteArray(JSByteArray::VPtrStealingHack);
+ jsByteArray->~JSCell();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr45699.C b/gcc/testsuite/g++.dg/torture/pr45699.C
new file mode 100644
index 000000000..828c1ef8e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45699.C
@@ -0,0 +1,61 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+class A
+{
+public:
+ virtual void foo () {abort();}
+};
+
+class B : public A
+{
+public:
+ int z;
+ virtual void foo () {abort();}
+};
+
+class C : public A
+{
+public:
+ void *a[32];
+ unsigned long b;
+ long c[32];
+
+ virtual void foo () {abort();}
+};
+
+class D : public C, public B
+{
+public:
+ D () : C(), B()
+ {
+ int i;
+ for (i = 0; i < 32; i++)
+ {
+ a[i] = (void *) 0;
+ c[i] = 0;
+ }
+ b = 0xaaaa;
+ }
+
+ virtual void foo ();
+};
+
+void D::foo()
+{
+ if (b != 0xaaaa)
+ abort();
+}
+
+static inline void bar (B &b)
+{
+ b.foo ();
+}
+
+int main()
+{
+ D d;
+ bar (d);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr45709-2.C b/gcc/testsuite/g++.dg/torture/pr45709-2.C
new file mode 100644
index 000000000..1f6a2344f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45709-2.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+
+struct Region {
+ int storage[4];
+ int count;
+};
+static inline Region subtract(int lhs)
+{
+ Region reg;
+ int* storage = reg.storage;
+ int* storage2 = reg.storage;
+ if (lhs > 0)
+ storage++, storage2--;
+ reg.count = storage - reg.storage + storage2 - reg.storage;
+ return reg;
+}
+void bar(int a)
+{
+ const Region copyBack(subtract(a));
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr45709.C b/gcc/testsuite/g++.dg/torture/pr45709.C
new file mode 100644
index 000000000..1584ec76a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45709.C
@@ -0,0 +1,19 @@
+// { dg-do compile }
+
+struct Region {
+ int storage[4];
+ int count;
+};
+static inline Region subtract(int lhs)
+{
+ Region reg;
+ int* storage = reg.storage;
+ if (lhs > 0)
+ storage++;
+ reg.count = storage - reg.storage;
+ return reg;
+}
+void bar(int a)
+{
+ const Region copyBack(subtract(a));
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr45843.C b/gcc/testsuite/g++.dg/torture/pr45843.C
new file mode 100644
index 000000000..f77b8cb01
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45843.C
@@ -0,0 +1,28 @@
+// PR target/45843
+// { dg-do run }
+
+#include <stdarg.h>
+
+extern "C" void abort ();
+struct S { struct T { } a[14]; char b; };
+struct S arg, s;
+
+void
+foo (int z, ...)
+{
+ char c;
+ va_list ap;
+ va_start (ap, z);
+ c = 'a';
+ arg = va_arg (ap, struct S);
+ if (c != 'a')
+ abort ();
+ va_end (ap);
+}
+
+int
+main ()
+{
+ foo (1, s);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr45854.C b/gcc/testsuite/g++.dg/torture/pr45854.C
new file mode 100644
index 000000000..17ee006e0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45854.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+
+template < typename = void >
+struct X { } ;
+struct Y
+{
+ Y () ;
+} ;
+template < typename = X < > >
+struct T
+{
+ void f ()
+ {
+ f () ;
+ }
+} ;
+struct S
+{
+ S ( X < > = X < > ()) ;
+ ~S ()
+ {
+ T < > () . f () ;
+ }
+} ;
+struct Z
+{
+ S s ;
+ Y y ;
+} a ;
+
diff --git a/gcc/testsuite/g++.dg/torture/pr45874.C b/gcc/testsuite/g++.dg/torture/pr45874.C
new file mode 100644
index 000000000..70965ff57
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45874.C
@@ -0,0 +1,58 @@
+// { dg-do compile }
+
+typedef struct {
+} IppLibraryVersion;
+typedef unsigned char Ipp8u;
+typedef unsigned int Ipp32u;
+typedef signed int Ipp32s;
+typedef enum e_vm_Status {
+ VM_OK = 0, VM_OPERATION_FAILED =-999, VM_NOT_INITIALIZED =-998, VM_TIMEOUT =-987, VM_NOT_ENOUGH_DATA =-996, VM_NULL_PTR =-995, VM_SO_CANT_LOAD =-994, VM_SO_INVALID_HANDLE =-993, VM_SO_CANT_GET_ADDR =-992 }
+ vm_status;
+ typedef Ipp32s Status;
+ class MediaReceiver {
+ };
+class MediaBuffer : public MediaReceiver {
+};
+struct TrackInfo {
+};
+struct Mpeg2TrackInfo : public TrackInfo {
+};
+class BitstreamReader {
+public: BitstreamReader(void);
+ virtual ~BitstreamReader(void) {
+ }
+ Ipp32u GetBits(Ipp32s iNum);
+ void SkipBits(Ipp32s iNum);
+protected: virtual void Refresh(void);
+ Ipp32s m_iReadyBits;
+};
+class FrameConstructor : public MediaBuffer {
+};
+class VideoFrameConstructor : public FrameConstructor {
+};
+class Mpeg2FrameConstructor : public VideoFrameConstructor {
+ static Status ParsePictureHeader(Ipp8u *buf, Ipp32s iLen, Mpeg2TrackInfo *pInfo);
+};
+Status Mpeg2FrameConstructor::ParsePictureHeader(Ipp8u *buf, Ipp32s iLen, Mpeg2TrackInfo *pInfo) {
+ BitstreamReader bs;
+ bs.SkipBits(32 + 4 + 4 + 4 + 4 + 4 + 2);
+ bs.SkipBits(1 + 1 + 1 + 1 + 1 + 1 + 1);
+ bs.SkipBits(5);
+ bs.SkipBits(3);
+ Ipp8u source_format;
+ bs.SkipBits(22);
+ bs.SkipBits(8);
+ if (7 == source_format) {
+ Ipp8u ufep = (Ipp8u)bs.GetBits(3);
+ if (0x01 == ufep) {
+ bs.SkipBits(10);
+ }
+ }
+}
+void BitstreamReader::SkipBits(Ipp32s iNum) {
+ if (iNum <= m_iReadyBits) {
+ m_iReadyBits -= iNum;
+ Refresh();
+ }
+}
+void BitstreamReader::Refresh(void) { }
diff --git a/gcc/testsuite/g++.dg/torture/pr45875.C b/gcc/testsuite/g++.dg/torture/pr45875.C
new file mode 100644
index 000000000..f1347f543
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45875.C
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+struct c1 {};
+
+struct c10 : c1
+{
+ virtual void foo ();
+};
+
+struct c11 : c10, c1 // // { dg-warning "" }
+{
+ virtual void f6 ();
+};
+
+struct c28 : virtual c11
+{
+ void f6 ();
+};
+
+void check_c28 ()
+{
+ c28 obj;
+ c11 *ptr = &obj;
+ ptr->f6 ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr45877.C b/gcc/testsuite/g++.dg/torture/pr45877.C
new file mode 100644
index 000000000..9af6ae999
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45877.C
@@ -0,0 +1,141 @@
+// { dg-do compile }
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ typedef __SIZE_TYPE__ size_t;
+ template<typename _Alloc> class allocator;
+ template<class _CharT> struct char_traits;
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_string;
+ typedef basic_string<char> string;
+ template<class _T1, class _T2> struct pair { };
+ template<typename _Tp> class allocator { };
+ template<typename _Arg1, typename _Arg2, typename _Result>
+ struct binary_function {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_string {
+ public:
+ basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
+ };
+ class type_info {
+ public:
+ const char* name() const;
+ };
+ extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
+ void * memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __len) throw ()
+ {
+ return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
+ }
+ template <typename _Key, typename _Tp >
+ class map {
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ public:
+ mapped_type& operator[](const key_type& __k);
+ };
+}
+class CodeAlloc { };
+using namespace std;
+typedef void *Stack;
+class basicForEachType;
+typedef const basicForEachType * aType;
+extern map<const string,basicForEachType *> map_type;
+class AnyTypeWithOutCheck { };
+typedef AnyTypeWithOutCheck AnyType;
+template<typename T> AnyTypeWithOutCheck inline SetAny(const T & x)
+{
+ AnyTypeWithOutCheck any;
+ memcpy(&any,&x,sizeof(x));
+}
+template<typename T> const T& GetAny(const AnyTypeWithOutCheck & x);
+class E_F0;
+class C_F0;
+class Polymorphic;
+typedef E_F0 * Expression;
+class basicAC_F0;
+extern Polymorphic * TheOperators, * TheRightOperators;
+class basicForEachType : public CodeAlloc {
+public:
+ virtual C_F0 CastTo(const C_F0 & e) const ;
+};
+class E_F0 :public CodeAlloc {
+public:
+ virtual AnyType operator()(Stack) const =0;
+};
+class E_F0mps : public E_F0 {
+};
+class ArrayOfaType : public CodeAlloc{
+protected:
+ aType * t;
+};
+class OneOperator : public ArrayOfaType {
+public:
+ OneOperator(aType rr,aType a,aType b);
+ virtual E_F0 * code(const basicAC_F0 &) const =0;
+};
+class Polymorphic: public E_F0mps {
+public:
+ void Add(const char * op,OneOperator * p0 ,OneOperator * p1=0) const;
+};
+class C_F0 {
+public:
+ operator E_F0 * () const;
+};
+class basicAC_F0 {
+public:
+ const C_F0 & operator [] (int i) const;
+};
+struct OneBinaryOperatorMI { };
+struct evalE_F2 { };
+template<typename C,class MI=OneBinaryOperatorMI,class MIx=evalE_F2 >
+class OneBinaryOperator : public OneOperator
+{
+ typedef typename C::result_type R;
+ typedef typename C::first_argument_type A;
+ typedef typename C::second_argument_type B;
+ aType t0,t1;
+ class Op : public E_F0 {
+ Expression a,b;
+ public:
+ AnyType operator()(Stack s) const {
+ return SetAny<R>(static_cast<R>(C::f( GetAny<A>((*a)(s)),
+ GetAny<B>((*b)(s)))));
+ }
+ Op(Expression aa,Expression bb) : a(aa),b(bb) { }
+ };
+public:
+ E_F0 * code(const basicAC_F0 & args) const {
+ return new Op(t0->CastTo(args[0]),t1->CastTo(args[1]));
+ }
+ OneBinaryOperator()
+ : OneOperator(map_type[typeid(R).name()],
+ map_type[typeid(A).name()],
+ map_type[typeid(B).name()]), t0(t[0]), t1(t[1]) { }
+};
+struct NothingType { };
+class ShapeOfArray{ };
+template<class R> class KN_: public ShapeOfArray { };
+template <class T> struct affectation: binary_function<T, T, T> { };
+template<class K,class L,class OP> struct set_A_BI
+: public binary_function<KN_<K>,pair<KN_<K>, KN_<L> > *,KN_<K> >
+{
+ static KN_<K> f(const KN_<K> & a, pair<KN_<K>, KN_<L> > * const & b);
+};
+template<class K,class L,class OP> struct set_AI_B
+: public binary_function<pair<KN_<K>, KN_<L> > * ,KN_<K>, NothingType >
+{
+ static NothingType f( pair<KN_<K>, KN_<L> > * const & b,const KN_<K> & a);
+};
+template<class K,class Z> void ArrayOperator()
+{
+ TheOperators->Add("=", new OneBinaryOperator<set_A_BI< K,Z,affectation<K> > >,
+ new OneBinaryOperator<set_AI_B< K,Z,affectation<K> > >);
+}
+void initArrayOperatorlong() {
+ ArrayOperator<long,long>();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr45934.C b/gcc/testsuite/g++.dg/torture/pr45934.C
new file mode 100644
index 000000000..f43964107
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr45934.C
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+
+extern "C" void abort ();
+
+struct B *b;
+
+struct B
+{
+ virtual void f () { }
+ ~B() { b->f(); }
+};
+
+struct D : public B
+{
+ virtual void f () { abort (); }
+};
+
+int main ()
+{
+ D d;
+ b = &d;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr46111.C b/gcc/testsuite/g++.dg/torture/pr46111.C
new file mode 100644
index 000000000..df57d8d02
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr46111.C
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-require-effective-target pthread }
+// { dg-options "-ftree-parallelize-loops=2 -g" }
+
+struct A
+{
+ int zero ()
+ {
+ return 0;
+ }
+};
+
+static inline void
+bar (int)
+{
+}
+
+struct B
+{
+ struct A a;
+ B (int n)
+ {
+ for (int i = 0; i < n; i++)
+ bar (a.zero ());
+ }
+};
+
+void
+foo (int n)
+{
+ struct B b (n);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr46149.C b/gcc/testsuite/g++.dg/torture/pr46149.C
new file mode 100644
index 000000000..bdc3d7704
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr46149.C
@@ -0,0 +1,51 @@
+// { dg-do run }
+// { dg-options "-fno-tree-sra" }
+
+struct S
+{
+ S ():p ((char *) __builtin_calloc (1, 1))
+ {
+ }
+ char *p;
+};
+
+template < class T > struct A
+{
+ A (const S & __m1, const T & __m2):m1 (__m1), m2 (__m2)
+ {
+ }
+ const S & m1;
+ const T & m2;
+};
+
+struct B:A < S >
+{
+ B (const S & __v):A < S > (__v, __v)
+ {
+ }
+};
+
+struct C:A < B >
+{
+ C (const S & __e1, const B & __e2):A < B > (__e1, __e2)
+ {
+ }
+};
+
+struct D
+{
+ D (const C & __c):c (__c)
+ {
+ }
+ const C c;
+};
+
+int
+main ()
+{
+ S s;
+ B b (s);
+ C c (s, b);
+ D d (c);
+ return d.c.m2.m2.p[0];
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr46154.C b/gcc/testsuite/g++.dg/torture/pr46154.C
new file mode 100644
index 000000000..424b1fad8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr46154.C
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fipa-cp-clone" } */
+
+struct S
+{
+ virtual int foo ()
+ {
+ return foo () == 0;
+ }
+ virtual void baz ();
+};
+
+void A ()
+{
+ S s;
+ s.foo ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr46287.C b/gcc/testsuite/g++.dg/torture/pr46287.C
new file mode 100644
index 000000000..fd201c48d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr46287.C
@@ -0,0 +1,66 @@
+// Check that indirect calls to thunks do not lead to errors.
+// { dg-do run }
+
+extern "C" void abort ();
+
+class A
+{
+public:
+ virtual void foo () {abort();}
+};
+
+class B : public A
+{
+public:
+ int z;
+ virtual void foo () {abort();}
+};
+
+class C : public A
+{
+public:
+ void *a[32];
+ unsigned long b;
+ long c[32];
+
+ virtual void foo () {abort();}
+};
+
+class D : public C, public B
+{
+public:
+ D () : C(), B()
+ {
+ int i;
+ for (i = 0; i < 32; i++)
+ {
+ a[i] = (void *) 0;
+ c[i] = 0;
+ }
+ b = 0xaaaa;
+ }
+
+ virtual void foo ();
+};
+
+void D::foo()
+{
+ if (b != 0xaaaa)
+ abort();
+}
+
+static inline void bar (B &b)
+{
+
+ b.foo ();
+}
+
+int main()
+{
+ int i;
+ D d;
+
+ for (i = 0; i < 5000; i++)
+ bar (d);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr46364.C b/gcc/testsuite/g++.dg/torture/pr46364.C
new file mode 100644
index 000000000..8098991ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr46364.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+#include <string>
+
+void a() throw (int);
+void b(std::string const &);
+
+void c(std::string *e)
+{
+ b("");
+
+ try {
+ a();
+ } catch (...) {
+ *e = "";
+ }
+}
+
+void d() {
+ c(0);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr46367.C b/gcc/testsuite/g++.dg/torture/pr46367.C
new file mode 100644
index 000000000..260b5c113
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr46367.C
@@ -0,0 +1,11 @@
+#pragma interface
+struct S
+{
+ S *s;
+ ~S ()
+ {
+ delete s;
+ }
+};
+
+S s;
diff --git a/gcc/testsuite/g++.dg/torture/pr46383.C b/gcc/testsuite/g++.dg/torture/pr46383.C
new file mode 100644
index 000000000..2b610394b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr46383.C
@@ -0,0 +1,252 @@
+// { dg-do compile }
+
+namespace std {
+template<class,class>struct pair{};
+ template<typename _Tp> struct _Vector_base {
+ struct _Vector_impl
+ {
+ _Tp* _M_start;
+ _Tp* _M_finish;
+ _Tp* _M_end_of_storage;
+ };
+ _Vector_impl _M_impl;
+ };
+ template<typename _Tp >
+ struct vector : _Vector_base<_Tp>
+ {
+ vector(const vector& __x);
+ };
+}
+namespace boost {
+struct G{};
+template <class T, class U >
+struct modable2
+: G
+{ };
+}
+namespace CGAL {
+struct Rep { };
+struct Handle
+{
+ Handle() ;
+ Handle(const Handle& x) ;
+ Rep* PTR;
+};
+template <typename ET_> class Lazy_exact_nt
+ : Handle
+ , boost::modable2< Lazy_exact_nt<ET_>, int >
+ , boost::modable2< Lazy_exact_nt<ET_>, double >
+{ };
+ struct CC_iterator { };
+struct Triangulation_data_structure_3 {
+ typedef CC_iterator Vertex_handle;
+ typedef CC_iterator Cell_handle;
+ typedef std::pair<Cell_handle, int> Facet;
+};
+template < class GT, class Tds_ > struct Triangulation_3 {
+ typedef Tds_ Tds;
+ typedef typename GT::Point_3 Point;
+ typedef typename Tds::Facet Facet;
+ typedef typename Tds::Vertex_handle Vertex_handle;
+ enum Locate_type { VERTEX=0, EDGE, FACET, CELL, OUTSIDE_CONVEX_HULL, OUTSIDE_AFFINE_HULL };
+ Tds _tds;
+ bool is_infinite(const Facet & f) const ;
+};
+template < class Gt, class Tds_ > struct Delaunay_triangulation_3 : public Triangulation_3<Gt, Tds_> { };
+ namespace Surface_mesher { enum Verbose_flag { VERBOSE, NOT_VERBOSE }; }
+enum Mesher_level_conflict_status { NO_CONFLICT = 0, CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED, CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED };
+struct Null_mesher_level {
+ template <typename P, typename Z> Mesher_level_conflict_status test_point_conflict_from_superior(P, Z) ;
+};
+template < class Tr, class Derived, class Element, class Previous, class Triangulation_traits > struct Mesher_level {
+ typedef Tr Triangulation;
+ typedef typename Triangulation::Point Point;
+ typedef typename Triangulation::Vertex_handle Vertex_handle;
+ typedef typename Triangulation_traits::Zone Zone;
+ typedef Previous Previous_level;
+ Derived& derived() { return static_cast<Derived&>(*this); }
+ Previous& previous_level;
+ Mesher_level(Previous_level& previous)
+ : previous_level(previous)
+ { }
+ Vertex_handle insert(Point p, Zone& z) ;
+ Zone conflicts_zone(const Point& p, Element e) ;
+ Element get_next_element() ;
+ template <class Mesh_visitor> void before_insertion(Element& e, const Point& p, Zone& zone, Mesh_visitor visitor) {
+ visitor.before_insertion(e, p, zone);
+ }
+ template <class Mesh_visitor> void after_insertion(Vertex_handle vh, Mesh_visitor visitor) {
+ derived().after_insertion_impl(vh);
+ }
+ template <class Mesh_visitor> void after_no_insertion(const Element& e, const Point& p, Zone& zone, Mesh_visitor visitor) {
+ visitor.after_no_insertion(e, p, zone);
+ }
+ template <class Mesh_visitor> void refine(Mesh_visitor visitor)
+ {
+ Element e = get_next_element();
+ const Mesher_level_conflict_status result = try_to_refine_element(e, visitor);
+ }
+ template <class Mesh_visitor> Mesher_level_conflict_status try_to_refine_element(Element e, Mesh_visitor visitor)
+ {
+ Point p ;
+ Zone zone = conflicts_zone(p, e);
+ const Mesher_level_conflict_status result = test_point_conflict(p, zone);
+ before_insertion(e, p, zone, visitor);
+ Vertex_handle v = insert(p, zone);
+ after_insertion(v, visitor);
+ after_no_insertion(e, p, zone, visitor);
+ }
+ Mesher_level_conflict_status test_point_conflict(const Point& p, Zone& zone)
+ {
+ return previous_level.test_point_conflict_from_superior(p, zone);
+ }
+};
+struct Null_mesh_visitor {
+ template <typename E, typename P, typename Z> void before_insertion(E, P, Z) const {}
+ template <typename E, typename P, typename Z> void after_no_insertion(E, P, Z) const {}
+};
+template <class Tr> struct Triangulation_ref_impl {
+ Triangulation_ref_impl(Tr& t);
+};
+template <typename Tr> struct Triangulation_mesher_level_traits_3
+: public Triangulation_ref_impl<Tr>
+{
+ typedef typename Tr::Facet Facet;
+ Triangulation_mesher_level_traits_3(Tr& t)
+ : Triangulation_ref_impl<Tr>(t)
+ { }
+ struct Zone {
+ typedef std::vector<int*> Cells;
+ typedef std::vector<Facet> Facets;
+ typedef typename Tr::Locate_type Locate_type;
+ Locate_type locate_type;
+ Cells cells;
+ Facets boundary_facets;
+ Facets internal_facets;
+ };
+};
+ namespace Surface_mesher {
+ namespace details {
+ template <typename Base> struct Triangulation_generator {
+ typedef typename Base::Complex_2_in_triangulation_3 C2T3;
+ typedef typename C2T3::Triangulation Triangulation;
+ typedef Triangulation Type;
+ typedef Type type;
+ };
+ template <typename Base> struct Facet_generator {
+ typedef typename Triangulation_generator<Base>::type Tr;
+ typedef typename Tr::Facet Type;
+ typedef Type type;
+ };
+ template <typename Base, typename Self, typename Element, typename PreviousLevel = Null_mesher_level> struct Mesher_level_generator {
+ typedef typename Base::Complex_2_in_triangulation_3 C2T3;
+ typedef typename C2T3::Triangulation Triangulation;
+ typedef Triangulation_mesher_level_traits_3<Triangulation> Tr_m_l_traits_3;
+ typedef Mesher_level <Triangulation, Self, Element, PreviousLevel, Tr_m_l_traits_3> Type;
+ };
+ }
+ template < class C2T3, class Surface_, class SurfaceMeshTraits, class Criteria_ > struct Surface_mesher_base
+ : public Triangulation_mesher_level_traits_3<typename C2T3::Triangulation>
+ {
+ typedef C2T3 Complex_2_in_triangulation_3;
+ typedef Surface_ Surface;
+ typedef SurfaceMeshTraits Surface_mesh_traits;
+ typedef Criteria_ Criteria;
+ typedef typename C2T3::Triangulation Tr;
+ typedef typename Tr::Vertex_handle Vertex_handle;
+ typedef typename Tr::Facet Facet;
+ Surface_mesher_base (C2T3& co, const Surface& s, const Surface_mesh_traits& mesh_traits, const Criteria& c)
+: Triangulation_mesher_level_traits_3<Tr>(co.triangulation()), c2t3(co), tr(co.triangulation()), surf(s), meshtraits(mesh_traits), criteria(c)
+ { }
+ C2T3& c2t3;
+ Tr& tr;
+ const Surface& surf;
+ const Surface_mesh_traits& meshtraits;
+ const Criteria& criteria;
+ void after_insertion_impl(const Vertex_handle& v) {
+ after_insertion_handle_opposite_facet (Facet ());
+ after_insertion_handle_incident_facet (Facet ());
+ }
+ void after_insertion_handle_incident_facet (const Facet& f) {
+ tr.is_infinite(f) ;
+ new_facet<false>(f);
+ }
+ template <bool remove_from_complex_if_not_in_restricted_Delaunay> void new_facet (const Facet& f) ;
+ void after_insertion_handle_opposite_facet (const Facet& f) {
+ after_insertion_handle_incident_facet (f);
+ }
+ };
+ template < typename Base, typename Element = typename details::Facet_generator<Base>::type, typename PreviousLevel = Null_mesher_level, Verbose_flag verbose = NOT_VERBOSE > struct Surface_mesher
+ : public Base , public details::Mesher_level_generator< Base, Surface_mesher<Base, Element, PreviousLevel, verbose>, Element, PreviousLevel >::Type
+ {
+ typedef typename Base::Complex_2_in_triangulation_3 C2T3;
+ typedef typename Base::Surface Surface;
+ typedef typename Base::Criteria Criteria;
+ typedef typename Base::Surface_mesh_traits Surface_mesh_traits;
+ typedef typename details::Mesher_level_generator< Base, Surface_mesher<Base, Element, PreviousLevel, verbose>, Element, PreviousLevel >::Type Mesher_lvl;
+ using Mesher_lvl::refine;
+ Null_mesher_level null_mesher_level;
+ Null_mesh_visitor null_visitor;
+ bool initialized;
+ Surface_mesher(C2T3& c2t3, const Surface& surface, const Surface_mesh_traits& mesh_traits, const Criteria& criteria)
+ : Base(c2t3, surface, mesh_traits, criteria), Mesher_lvl(null_mesher_level), initialized(false)
+ { }
+ void refine_mesh () {
+ refine(null_visitor);
+ }
+ };
+ }
+template <typename Surface> struct Surface_mesh_traits_generator_3 {
+ typedef typename Surface::Surface_mesher_traits_3 Type;
+ typedef Type type;
+};
+template < class Tr, typename Edge_info_ = void > struct Complex_2_in_triangulation_3 {
+ typedef Tr Triangulation;
+ Triangulation& triangulation();
+};
+template <class Tr> struct Surface_mesh_complex_2_in_triangulation_3
+: public Complex_2_in_triangulation_3<Tr>
+{ };
+ struct Non_manifold_tag {};
+ template < typename C2T3, typename SurfaceMeshTraits_3, typename Criteria, typename Tag > struct Make_surface_mesh_helper {
+ typedef Surface_mesher::Surface_mesher_base< C2T3, typename SurfaceMeshTraits_3::Surface_3, SurfaceMeshTraits_3, Criteria> Mesher_base;
+ };
+ template <typename C2T3, typename SurfaceMeshTraits_3, typename Criteria, typename Tag, Surface_mesher::Verbose_flag verbosity = Surface_mesher::NOT_VERBOSE > struct Surface_mesher_generator {
+ typedef typename Make_surface_mesh_helper< C2T3, SurfaceMeshTraits_3, Criteria, Tag>::Mesher_base Mesher_base;
+ typedef Surface_mesher::Surface_mesher< Mesher_base, typename Surface_mesher::details::Facet_generator<Mesher_base>::type, Null_mesher_level, verbosity> Mesher;
+ typedef Mesher type;
+ };
+template <typename C2T3, typename SurfaceMeshTraits_3, typename Criteria> void make_surface_mesh(C2T3& c2t3, const typename SurfaceMeshTraits_3::Surface_3& surface, const SurfaceMeshTraits_3& surface_mesh_traits, const Criteria& criteria) {
+ typedef typename Surface_mesher_generator< C2T3, SurfaceMeshTraits_3, Criteria, Non_manifold_tag, Surface_mesher::NOT_VERBOSE >::type Mesher;
+ Mesher mesher(c2t3, surface, surface_mesh_traits, criteria);
+ mesher.refine_mesh();
+}
+template <class Kernel> struct Surface_mesh_triangulation_generator_3 {
+ typedef CGAL::Triangulation_data_structure_3 Tds;
+ typedef CGAL::Delaunay_triangulation_3<Kernel, Tds> Type;
+};
+ namespace Surface_mesher {
+ namespace { struct Return_min { }; }
+ template < class GT, class Surface, class Unused = Return_min > struct Implicit_surface_oracle_3 {
+ typedef Surface Surface_3;
+ };
+ }
+ template< typename GT> struct Implicit_surface_3 {
+ typedef GT Geom_traits;
+ typedef Implicit_surface_3<Geom_traits > Self;
+ typedef Surface_mesher::Implicit_surface_oracle_3< Geom_traits, Self> Surface_mesher_traits_3;
+ };
+}
+struct K {
+struct Point_3 {
+CGAL::Lazy_exact_nt<double> a[3];
+};
+};
+typedef CGAL::Surface_mesh_triangulation_generator_3<K>::Type Tr;
+typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<Tr> C2T3;
+typedef CGAL::Implicit_surface_3<K > Surface;
+typedef CGAL::Surface_mesh_traits_generator_3<Surface>::type Traits;
+void f() {
+ C2T3 c2t3 ;
+ CGAL::make_surface_mesh(c2t3, Surface(), Traits(), 3);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr46469.C b/gcc/testsuite/g++.dg/torture/pr46469.C
new file mode 100644
index 000000000..8212ea4f9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr46469.C
@@ -0,0 +1,13 @@
+extern "C" __inline __attribute__ ((__gnu_inline__)) int pthread_equal ()
+ {
+ }
+
+static
+ __typeof
+ (pthread_equal)
+ __gthrw_pthread_equal __attribute__ ((__weakref__ ("pthread_equal")));
+
+int identifierByPthreadHandle ()
+{
+ pthread_equal ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr47290.C b/gcc/testsuite/g++.dg/torture/pr47290.C
new file mode 100644
index 000000000..b739de5b7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr47290.C
@@ -0,0 +1,19 @@
+// PR tree-optimization/47290
+// { dg-do compile }
+
+struct V
+{
+ V (int = 0);
+ ~V ()
+ {
+ for (;;)
+ ;
+ }
+ int size ();
+};
+
+struct S
+{
+ V a, b;
+ S () : b (a.size ()) {}
+} s;
diff --git a/gcc/testsuite/g++.dg/torture/pr47313.C b/gcc/testsuite/g++.dg/torture/pr47313.C
new file mode 100644
index 000000000..c10f558a3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr47313.C
@@ -0,0 +1,53 @@
+// { dg-do compile }
+
+namespace internal {
+ template < class DSC, bool Const > struct CC_iterator {
+ typedef CC_iterator iterator;
+ typedef typename DSC::value_type value_type;
+ typedef const value_type* pointer;
+ CC_iterator () ;
+ CC_iterator (const iterator &it) {
+ }
+ pointer p;
+ pointer operator->() const ;
+ };
+}
+template < class T > struct Compact_container {
+ typedef Compact_container <T> Self;
+ typedef T value_type;
+ typedef internal::CC_iterator<Self, false> iterator;
+};
+template < typename TDS = void > struct Periodic_3_triangulation_ds_cell_base_3 {
+ typedef typename TDS::Vertex_handle Vertex_handle;
+ const Vertex_handle& vertex(int i) const {
+ }
+};
+struct Triangulation_data_structure_3 {
+ typedef Triangulation_data_structure_3 Tds;
+ typedef Periodic_3_triangulation_ds_cell_base_3<Tds> Cell;
+ typedef Compact_container<Cell> Cell_range;
+ typedef Compact_container<int> Vertex_range;
+ typedef typename Cell_range::iterator Cell_handle;
+ typedef typename Vertex_range::iterator Vertex_handle;
+};
+typedef Triangulation_data_structure_3 TDS1;
+template < class > struct Periodic_3_Delaunay_triangulation_3 {
+ typedef TDS1::Vertex_handle Vertex_handle;
+ typedef TDS1::Cell_handle Cell_handle;
+ int compare_distance() const {
+ }
+ Vertex_handle nearest_vertex() const;
+};
+template < class Tds > typename Periodic_3_Delaunay_triangulation_3<Tds>::Vertex_handle Periodic_3_Delaunay_triangulation_3<Tds>::nearest_vertex() const {
+ Cell_handle c ;
+ Vertex_handle nearest = c->vertex(0);
+ nearest = (compare_distance() == -1) ? nearest : c->vertex(0);
+ return nearest;
+}
+typedef Periodic_3_Delaunay_triangulation_3<TDS1> PDT1;
+struct Periodic_3_triangulation_hierarchy_3 : PDT1 {
+ Vertex_handle nearest_vertex() const;
+};
+Periodic_3_triangulation_hierarchy_3::Vertex_handle Periodic_3_triangulation_hierarchy_3:: nearest_vertex() const {
+ return PDT1::nearest_vertex();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr47382.C b/gcc/testsuite/g++.dg/torture/pr47382.C
new file mode 100644
index 000000000..a12dbe3fd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr47382.C
@@ -0,0 +1,30 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+struct A
+{
+ inline ~A ();
+ virtual void foo () {}
+};
+
+struct B : A
+{
+ virtual void foo () { abort(); }
+};
+
+static inline void middleman (A *a)
+{
+ a->foo ();
+}
+
+inline A::~A ()
+{
+ middleman (this);
+}
+
+int main ()
+{
+ B b;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr47541.C b/gcc/testsuite/g++.dg/torture/pr47541.C
new file mode 100644
index 000000000..350a05192
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr47541.C
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+
+struct Dummy {};
+struct RefCount : public Dummy {
+ ~RefCount(); /* Has to be non-pod. */
+ int *a;
+ int *b;
+};
+RefCount::~RefCount(){}
+struct Wrapper : public Dummy { RefCount ref; };
+void __attribute__((noinline,noclone))
+Push(Wrapper ptr)
+{
+ *ptr.ref.b = 0;
+}
+extern "C" void abort (void);
+int main()
+{
+ int a = 1, b = 1;
+ Wrapper x;
+ x.ref.a = &a;
+ x.ref.b = &b;
+ Push(x);
+ if (b != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr47559.C b/gcc/testsuite/g++.dg/torture/pr47559.C
new file mode 100644
index 000000000..42dedee29
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr47559.C
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x -fnon-call-exceptions" }
+
+void foo (int *k) noexcept
+{
+ for (;;)
+ *k = 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr47714.C b/gcc/testsuite/g++.dg/torture/pr47714.C
new file mode 100644
index 000000000..4ff2eeef0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr47714.C
@@ -0,0 +1,16 @@
+struct A { virtual ~A () {} };
+struct B { virtual ~B () {} };
+struct C { virtual const A *foo (int) const = 0; };
+struct E : public B, public A { };
+struct F : public C
+{
+ virtual const E *foo (int) const;
+};
+void bar (int &);
+
+const E *
+F::foo (int x) const
+{
+ bar (x);
+ return __null;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr48165.C b/gcc/testsuite/g++.dg/torture/pr48165.C
new file mode 100644
index 000000000..a42893f60
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr48165.C
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+
+typedef __SIZE_TYPE__ size_t;
+
+extern "C" {
+ extern __inline __attribute__ ((__always_inline__))
+ __attribute__ ((__gnu_inline__, __artificial__)) void *
+ memcpy (void *__restrict __dest, __const void *__restrict __src,
+ size_t __len) throw ()
+ {
+ return __builtin___memcpy_chk (__dest, __src, __len,
+ __builtin_object_size (__dest, 0));
+ }
+}
+
+typedef char TCODE[20];
+typedef TCODE TCODE_ARRAY[5];
+typedef struct PARAM
+{
+ TCODE_ARRAY tcode;
+} PARAM;
+
+static void foo (void* p)
+{
+ char buffer[4+sizeof(PARAM)];
+ PARAM *param = (PARAM *)(buffer + 4);
+ int i;
+
+ for (i=0; i < 5; i++)
+ {
+ memcpy( param->tcode[i], p, 20 );
+ }
+}
+
+void bar (void* p)
+{
+ foo (p);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr48661.C b/gcc/testsuite/g++.dg/torture/pr48661.C
new file mode 100644
index 000000000..8de2142f7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr48661.C
@@ -0,0 +1,77 @@
+// PR middle-end/48661
+// { dg-do run }
+
+extern "C" void abort ();
+
+__attribute__((noinline))
+double
+foo (double x, double y)
+{
+ asm volatile ("" : : : "memory");
+ return x + y;
+}
+
+__attribute__((noinline, noclone))
+void
+bar (int x)
+{
+ if (x != 123)
+ abort ();
+}
+
+struct A
+{
+ double a1, a2;
+};
+
+struct B
+{
+ virtual int m () const = 0 ;
+};
+
+struct C
+{
+ virtual ~C () {}
+};
+
+struct D : virtual public B, public C
+{
+ explicit D (const A &x) : d(123) { foo (x.a2, x.a1); }
+ int m () const { return d; }
+ int d;
+};
+
+struct E
+{
+ E () : d(0) {}
+ virtual void n (const B &x) { d = x.m (); x.m (); x.m (); }
+ int d;
+};
+
+void
+test ()
+{
+ A a;
+ a.a1 = 0;
+ a.a2 = 1;
+ E p;
+ D q (a);
+ const B &b = q;
+ bar (b.m ());
+ p.n (b);
+ bar (p.d);
+}
+
+void
+baz ()
+{
+ A a;
+ D p2 (a);
+}
+
+int
+main ()
+{
+ test ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr48695.C b/gcc/testsuite/g++.dg/torture/pr48695.C
new file mode 100644
index 000000000..44e6c771d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr48695.C
@@ -0,0 +1,38 @@
+// { dg-do run }
+
+typedef __SIZE_TYPE__ size_t;
+
+inline void *operator new (size_t, void *__p) throw() { return __p; }
+
+struct _Vector_impl
+{
+ int *_M_start;
+ int *_M_finish;
+ _Vector_impl () :_M_start (0), _M_finish (0) {}
+};
+
+struct vector
+{
+ _Vector_impl _M_impl;
+ int *_M_allocate (size_t __n)
+ {
+ return __n != 0 ? new int[__n] : 0;
+ }
+ void push_back ()
+ {
+ new (this->_M_impl._M_finish) int ();
+ this->_M_impl._M_finish =
+ this->_M_allocate (this->_M_impl._M_finish - this->_M_impl._M_start) + 1;
+ }
+};
+
+int
+main ()
+{
+ for (int i = 0; i <= 1; i++)
+ for (int j = 0; j <= 1; j++)
+ {
+ vector a[2];
+ a[i].push_back ();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr49039.C b/gcc/testsuite/g++.dg/torture/pr49039.C
new file mode 100644
index 000000000..f576cba42
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr49039.C
@@ -0,0 +1,76 @@
+// PR tree-optimization/49039
+// { dg-do run }
+
+template <class T1, class T2>
+struct pair
+{
+ T1 first;
+ T2 second;
+ pair (const T1 & a, const T2 & b):first (a), second (b) {}
+};
+
+template <class T1, class T2>
+inline pair <T1, T2>
+make_pair (T1 x, T2 y)
+{
+ return pair <T1, T2> (x, y);
+}
+
+typedef __SIZE_TYPE__ size_t;
+struct S
+{
+ const char *Data;
+ size_t Length;
+ static size_t min (size_t a, size_t b) { return a < b ? a : b; }
+ static size_t max (size_t a, size_t b) { return a > b ? a : b; }
+ S () :Data (0), Length (0) { }
+ S (const char *Str) : Data (Str), Length (__builtin_strlen (Str)) {}
+ S (const char *data, size_t length) : Data (data), Length (length) {}
+ bool empty () const { return Length == 0; }
+ size_t size () const { return Length; }
+ S slice (size_t Start, size_t End) const
+ {
+ Start = min (Start, Length);
+ End = min (max (Start, End), Length);
+ return S (Data + Start, End - Start);
+ }
+ pair <S, S> split (char Separator) const
+ {
+ size_t Idx = find (Separator);
+ if (Idx == ~size_t (0))
+ return make_pair (*this, S ());
+ return make_pair (slice (0, Idx), slice (Idx + 1, ~size_t (0)));
+ }
+ size_t find (char C, size_t From = 0) const
+ {
+ for (size_t i = min (From, Length), e = Length; i != e; ++i)
+ if (Data[i] == C)
+ return i;
+ return ~size_t (0);
+ }
+};
+
+void
+Test (const char *arg)
+{
+ S Desc (arg);
+ while (!Desc.empty ())
+ {
+ pair <S, S> Split = Desc.split ('-');
+ S Token = Split.first;
+ Desc = Split.second;
+ if (Token.empty ())
+ continue;
+ Split = Token.split (':');
+ S Specifier = Split.first;
+ if (Specifier.empty ())
+ __builtin_abort ();
+ }
+}
+
+int
+main ()
+{
+ Test ("-");
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr49115.C b/gcc/testsuite/g++.dg/torture/pr49115.C
new file mode 100644
index 000000000..c4cce21ba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr49115.C
@@ -0,0 +1,25 @@
+// { dg-do run }
+
+extern "C" void abort (void);
+struct MyException {};
+struct Data {
+ int nr;
+ Data() : nr(66) {}
+};
+Data __attribute__((noinline,noclone)) getData(int i)
+{
+ if (i) throw MyException();
+ Data data;
+ data.nr = i;
+ return data;
+}
+int main(int, char **)
+{
+ Data data;
+ try {
+ data = getData(1);
+ } catch (MyException& e) {
+ if (data.nr != 66)
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr49309.C b/gcc/testsuite/g++.dg/torture/pr49309.C
new file mode 100644
index 000000000..a34537792
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr49309.C
@@ -0,0 +1,15 @@
+// PR tree-optimization/49309
+// { dg-do compile }
+// { dg-options "-fpreprocessed -fmudflap" }
+
+struct A
+{
+ int i;
+
+ A();
+ A(const A&);
+};
+
+inline void foo(A a) { a = A(); }
+
+void bar() { foo(A()); }
diff --git a/gcc/testsuite/g++.dg/torture/pr49615.C b/gcc/testsuite/g++.dg/torture/pr49615.C
new file mode 100644
index 000000000..98a2f95b8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr49615.C
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-g" } */
+
+template <class T>
+static inline bool Dispatch (T* obj, void (T::*func) ())
+{
+ (obj->*func) ();
+}
+class C
+{
+ bool f (int);
+ void g ();
+};
+bool C::f (int n)
+{
+ bool b;
+ switch (n)
+ {
+ case 0:
+ b = Dispatch (this, &C::g);
+ case 1:
+ b = Dispatch (this, &C::g);
+ }
+}
+void C::g ()
+{
+ for (;;) { }
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pr49628.C b/gcc/testsuite/g++.dg/torture/pr49628.C
new file mode 100644
index 000000000..4bc6543a3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr49628.C
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+
+#include <vector>
+
+template <int rank, int dim> class Tensor;
+template <int dim> class Tensor<1,dim> {
+public:
+ explicit Tensor (const bool initialize = true);
+ Tensor (const Tensor<1,dim> &);
+ Tensor<1,dim> & operator = (const Tensor<1,dim> &);
+ double values[(dim!=0) ? (dim) : 1];
+};
+template <int dim>
+inline Tensor<1,dim> & Tensor<1,dim>::operator = (const Tensor<1,dim> &p)
+{
+ for (unsigned int i=0; i<dim; ++i)
+ values[i] = p.values[i];
+};
+template <int dim> class Quadrature {
+public:
+ const unsigned int n_quadrature_points;
+};
+class MappingQ1
+{
+ class InternalData {
+ public:
+ std::vector<Tensor<1,3> > shape_derivatives;
+ unsigned int n_shape_functions;
+ };
+ void compute_data (const Quadrature<3> &quadrature, InternalData &data)
+ const;
+};
+void MappingQ1::compute_data (const Quadrature<3> &q, InternalData &data) const
+{
+ const unsigned int n_q_points = q.n_quadrature_points;
+ data.shape_derivatives.resize(data.n_shape_functions * n_q_points);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr49644.C b/gcc/testsuite/g++.dg/torture/pr49644.C
new file mode 100644
index 000000000..5fb82e017
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr49644.C
@@ -0,0 +1,17 @@
+// PR c/49644
+// { dg-do run }
+
+extern "C" void abort ();
+
+int
+main ()
+{
+ _Complex double a[12], *c = a, s = 3.0 + 1.0i;
+ double b[12] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, *d = b;
+ int i;
+ for (i = 0; i < 6; i++)
+ *c++ = *d++ * s;
+ if (c != a + 6 || d != b + 6)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr49720.C b/gcc/testsuite/g++.dg/torture/pr49720.C
new file mode 100644
index 000000000..c5da7ba67
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr49720.C
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+extern char t_start[], t_end[], t_size[];
+bool foo (void)
+{
+ long size = reinterpret_cast<long>(t_size);
+ return (size == t_end - t_start);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr50189.C b/gcc/testsuite/g++.dg/torture/pr50189.C
new file mode 100644
index 000000000..06f1d3695
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr50189.C
@@ -0,0 +1,121 @@
+// { dg-do run }
+// { dg-options "-fstrict-enums" }
+
+extern "C" void abort (void);
+class CCUTILS_KeyedScalarLevelPosition
+{
+public:
+
+ typedef enum
+ {
+ UNINITED = 0,
+ AT_BEGIN = 1,
+ AT_END = 2,
+ AT_KEY = 3
+
+ } position_t;
+
+ bool is_init() const
+ { return(m_timestamp != UNINITED); }
+
+ bool is_at_begin() const
+ { return(m_timestamp == AT_BEGIN); }
+
+ position_t get_state() const
+ {
+ return((m_timestamp >= AT_KEY)
+ ? AT_KEY
+ : ((position_t)m_timestamp));
+ }
+
+ void set_at_begin()
+ { m_timestamp = AT_BEGIN; }
+
+ unsigned int get_index() const
+ { return(m_index); }
+
+ void set_pos(unsigned int a_index, unsigned int a_timestmap)
+ {
+ m_index = a_index;
+ m_timestamp = a_timestmap;
+ }
+
+ bool check_pos(unsigned int a_num_entries, unsigned int a_timestamp) const
+ {
+ if (get_state() != AT_KEY)
+ return(false);
+
+ if (m_timestamp != a_timestamp)
+ return(false);
+
+ return(m_index < a_num_entries);
+ }
+
+ void set_not_init()
+ { m_timestamp = 0; }
+
+private:
+
+ unsigned int m_timestamp;
+ unsigned int m_index;
+
+};
+
+class CCUTILS_KeyedScalarPosition
+{
+public:
+
+ CCUTILS_KeyedScalarLevelPosition m_L1;
+ CCUTILS_KeyedScalarLevelPosition m_L2;
+};
+
+class baz
+{
+public:
+ int *n[20];
+ unsigned int m_cur_array_len;
+ unsigned int m_timestamp;
+
+ unsigned int _get_timestamp() const
+ { return(m_timestamp); }
+
+ bool _check_L1_pos(const CCUTILS_KeyedScalarPosition &a_position) const
+ {
+ return(a_position.m_L1.check_pos(
+ m_cur_array_len, _get_timestamp()));
+ }
+
+ void *next (CCUTILS_KeyedScalarPosition &);
+};
+
+void * baz::next (CCUTILS_KeyedScalarPosition &a_position)
+{
+ if (a_position.m_L1.is_at_begin() || (!a_position.m_L1.is_init()))
+ {
+ a_position.m_L1.set_pos(0, _get_timestamp());
+ a_position.m_L2.set_at_begin();
+ }
+ else if (!_check_L1_pos(a_position))
+ return(0);
+
+ return n[a_position.m_L1.get_index ()];
+}
+
+int main (int, char **)
+{
+ baz obj;
+ CCUTILS_KeyedScalarPosition a_pos;
+ void *ret;
+ int n[5];
+
+ obj.n[0] = n;
+ obj.m_cur_array_len = 1;
+ obj.m_timestamp = 42;
+
+ a_pos.m_L1.set_pos (0, 42);
+
+ ret = obj.next (a_pos);
+ if (ret == 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr51344.C b/gcc/testsuite/g++.dg/torture/pr51344.C
new file mode 100644
index 000000000..07be919c3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr51344.C
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { i?86-*-* && ilp32 } } } */
+class A;
+
+template <class T>
+class B
+{
+ friend __attribute__((cdecl)) A& operator >>(A& a, B& b)
+ {
+ return a;
+ }
+};
diff --git a/gcc/testsuite/g++.dg/torture/pr55355.C b/gcc/testsuite/g++.dg/torture/pr55355.C
new file mode 100644
index 000000000..6d8f8b6be
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr55355.C
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+struct A
+{
+ void funcA(void);
+};
+
+struct B {};
+
+struct C
+{
+ void funcC(void) { a_mp->funcA(); }
+
+ char buf_ma[268435456];
+ A *a_mp;
+ B b_m;
+};
+
+void
+func(C *c_p)
+{
+ c_p->funcC();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr56403.C b/gcc/testsuite/g++.dg/torture/pr56403.C
new file mode 100644
index 000000000..27b6eeb88
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr56403.C
@@ -0,0 +1,12 @@
+// PR c++/56403
+// { dg-do compile }
+
+#include <stdarg.h>
+
+struct S { va_list err_args; };
+
+void *
+foo ()
+{
+ return new S ();
+}
diff --git a/gcc/testsuite/g++.dg/torture/predcom-1.C b/gcc/testsuite/g++.dg/torture/predcom-1.C
new file mode 100644
index 000000000..c668cac60
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/predcom-1.C
@@ -0,0 +1,29 @@
+/* Test for ICE in predictive commoning with empty loop header block
+ on arm-none-linux-gnueabi. */
+
+struct Foo
+{
+ double *ptr;
+
+ Foo (double *ptr_)
+ : ptr (ptr_)
+ {
+ }
+
+ Foo PostInc ()
+ {
+ return Foo (ptr++);
+ }
+};
+
+bool Baz (Foo first, double *last)
+{
+ Foo prev (first.ptr);
+
+ first.ptr++;
+
+ while (first.ptr != last)
+ if (*first.PostInc ().ptr < *prev.PostInc ().ptr)
+ return false;
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/pushpop_macro.C b/gcc/testsuite/g++.dg/torture/pushpop_macro.C
new file mode 100644
index 000000000..98065e6ee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pushpop_macro.C
@@ -0,0 +1,19 @@
+/* Do the preprocessor push_macro/pop_macro test. */
+
+/* { dg-do run } */
+
+extern "C" void abort ();
+
+#define _ 2
+#pragma push_macro("_")
+#undef _
+#define _ 1
+#pragma pop_macro("_")
+
+int main ()
+{
+ if (_ != 2)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/check.h b/gcc/testsuite/g++.dg/torture/stackalign/check.h
new file mode 100644
index 000000000..af1988512
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/check.h
@@ -0,0 +1,36 @@
+#include <stddef.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" void abort (void);
+#else
+extern void abort (void);
+#endif
+
+int
+check_int (int *i, int align)
+{
+ *i = 20;
+ if ((((ptrdiff_t) i) & (align - 1)) != 0)
+ {
+#ifdef DEBUG
+ printf ("\nUnalign address (%d): %p!\n", align, i);
+#endif
+ abort ();
+ }
+ return *i;
+}
+
+void
+check (void *p, int align)
+{
+ if ((((ptrdiff_t) p) & (align - 1)) != 0)
+ {
+#ifdef DEBUG
+ printf ("\nUnalign address (%d): %p!\n", align, p);
+#endif
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C
new file mode 100644
index 000000000..89b0a6a67
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C
@@ -0,0 +1,57 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+foo (int size) throw (B,A)
+{
+ char *p = (char*) __builtin_alloca (size + 1);
+ aligned i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C
new file mode 100644
index 000000000..4b849a2e4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C
@@ -0,0 +1,43 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+__attribute__ ((fastcall))
+void
+foo (int j, int k, int m, int n, int o) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ if (i != 20 || j != 1 || k != 2 || m != 3 || n != 4 || o != 5)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (1, 2, 3, 4, 5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C
new file mode 100644
index 000000000..cc05ed04f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+foo (void) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C
new file mode 100644
index 000000000..d2555f2e2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+static void
+inline __attribute__((always_inline))
+foo (void) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C
new file mode 100644
index 000000000..1cbc68cc4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+static void
+inline __attribute__((always_inline))
+foo (int size) throw (B,A)
+{
+ char *p = (char *) __builtin_alloca (size + 1);
+ aligned i;
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C
new file mode 100644
index 000000000..de9bed55c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C
@@ -0,0 +1,43 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+__attribute__ ((thiscall))
+void
+foo (int j, int k, int m, int n, int o) throw (B,A)
+{
+ aligned i;
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ if (i != 20 || j != 1 || k != 2 || m != 3 || n != 4 || o != 5)
+ abort ();
+
+ throw A();
+}
+
+int
+main()
+{
+ try { foo (1, 2, 3, 4, 5); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C
new file mode 100644
index 000000000..b9ba81b12
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C
@@ -0,0 +1,73 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+foo (const char *fmt, ...) throw (B,A)
+{
+ va_list arg;
+ char *p;
+ aligned i;
+ int size;
+ double x;
+
+ va_start (arg, fmt);
+ size = va_arg (arg, int);
+ if (size != 5)
+ abort ();
+ p = (char *) __builtin_alloca (size + 1);
+
+ x = va_arg (arg, double);
+ if (x != 5.0)
+ abort ();
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+
+ va_end (arg);
+}
+
+int
+main()
+{
+ try { foo ("foo", 5, 5.0); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C
new file mode 100644
index 000000000..5e282179c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C
@@ -0,0 +1,79 @@
+/* { dg-options "-Wno-abi" {target arm_eabi} } */
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+ A() {}
+};
+
+struct B {};
+
+void
+test (va_list arg) throw (B,A)
+{
+ char *p;
+ aligned i;
+ int size;
+ double x;
+
+ size = va_arg (arg, int);
+ if (size != 5)
+ abort ();
+
+ p = (char *) __builtin_alloca (size + 1);
+
+ x = va_arg (arg, double);
+ if (x != 5.0)
+ abort ();
+
+ bar (p, size);
+ if (__builtin_strncmp (p, "good", size) != 0)
+ {
+#ifdef DEBUG
+ p[size] = '\0';
+ printf ("Failed: %s != good\n", p);
+#endif
+ abort ();
+ }
+
+ if (check_int (&i, __alignof__(i)) != i)
+ abort ();
+
+ throw A();
+}
+
+void
+foo (const char *fmt, ...)
+{
+ va_list arg;
+ va_start (arg, fmt);
+ test (arg);
+ va_end (arg);
+}
+int
+main()
+{
+ try { foo ("foo", 5, 5.0); }
+ catch (A& a) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp b/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp
new file mode 100644
index 000000000..3d0609fc4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/stackalign.exp
@@ -0,0 +1,35 @@
+# Copyright (C) 2008, 2010
+# Free Software Foundation, Inc.
+
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# This harness is for tests that should be run at all optimisation levels.
+
+load_lib g++-dg.exp
+dg-init
+set additional_flags ""
+
+# If automatic stack alignment is supported, force it on.
+if { [check_effective_target_automatic_stack_alignment] } then {
+ lappend additional_flags "-mstackrealign"
+ lappend additional_flags "-mpreferred-stack-boundary=5"
+}
+
+gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] $additional_flags
+if { [check_effective_target_fpic] } then {
+ lappend additional_flags "-fpic"
+ gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] $additional_flags
+}
+dg-finish
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C b/gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C
new file mode 100644
index 000000000..393b37e7b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/stdcall-1.C
@@ -0,0 +1,17 @@
+// { dg-do compile { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
+
+// This case is to detect an assertion failure in stack branch development.
+
+bool f();
+struct S {
+ __attribute__ ((stdcall)) ~S();
+};
+void g() {
+ for (;;) {
+ S s1, s2, s3;
+ if (f())
+ continue;
+ if (f())
+ return;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h b/gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h
new file mode 100644
index 000000000..ff5602784
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/test-unwind.h
@@ -0,0 +1,142 @@
+#include "check.h"
+
+
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) STRING (prefix) cname
+#define STRING(x) #x
+
+#ifdef __cplusplus
+extern "C" void abort (void);
+#else
+extern void abort (void);
+#endif
+
+extern void foo(void);
+
+#define INIT_EDI 1
+#define INIT_ESI 2
+#define INIT_EBX 3
+
+/* Set DI/SI/BX to wrong value
+ Use following template so that RA will save/restore callee
+ save registers in prologue/epilogue */
+#define ALTER_REGS() \
+ { \
+ int dummy; \
+ __asm__ __volatile__ (\
+ "movl %1, %0" : "=D" (dummy) : "i" (-INIT_EDI)\
+ );\
+ __asm__ __volatile__ (\
+ "movl %1, %0" : "=S" (dummy) : "i" (-INIT_ESI)\
+ );\
+ __asm__ __volatile__ (\
+ "movl %1, %0" : "=b" (dummy) : "i" (-INIT_EBX)\
+ );\
+ }
+
+#if defined __PIC__ || defined __USING_SJLJ_EXCEPTIONS__
+int
+main ()
+{
+ return 0;
+}
+#else
+void __attribute__ ((noinline))
+copy (char *p, int size)
+{
+ __builtin_strncpy (p, "good", size);
+}
+
+int g_edi __attribute__((externally_visible)) =INIT_EDI;
+int g_esi __attribute__((externally_visible)) =INIT_ESI;
+int g_ebx __attribute__((externally_visible)) = INIT_EBX;
+int g_ebp __attribute__((externally_visible));
+int g_esp __attribute__((externally_visible));
+int g_ebp_save __attribute__((externally_visible));
+int g_esp_save __attribute__((externally_visible));
+int n_error;
+
+int
+main()
+{
+ int dummy;
+ // Init registers to correct value.
+ // Use following template so that RA will save/restore callee
+ // save registers in prologue/epilogue
+ __asm__ __volatile__ (
+ "movl %1, %0"
+ : "=D" (dummy)
+ : "i" (INIT_EDI)
+ );
+ __asm__ __volatile__ (
+ "movl %1, %0"
+ : "=S" (dummy)
+ : "i" (INIT_ESI)
+ );
+ __asm__ __volatile__ (
+ "movl %1, %0"
+ : "=b" (dummy)
+ : "i" (INIT_EBX)
+ );
+ __asm__ __volatile__ (
+ "movl %ebp," ASMNAME("g_ebp_save")"\n\t"
+ "movl %esp," ASMNAME("g_esp_save")"\n\t"
+ );
+ try {
+ foo();
+ }
+ catch (...)
+ {
+ }
+
+ // Get DI/SI/BX register value after exception caught
+ __asm__ __volatile__ (
+ "movl %edi," ASMNAME("g_edi")"\n\t"
+ "movl %esi," ASMNAME("g_esi")"\n\t"
+ "movl %ebx," ASMNAME("g_ebx")"\n\t"
+ "movl %ebp," ASMNAME("g_ebp")"\n\t"
+ "movl %esp," ASMNAME("g_esp")"\n\t"
+ );
+
+ // Check if DI/SI/BX register value are the same as before calling
+ // foo.
+ if (g_edi != INIT_EDI)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("edi=%d, correct value:%d\n", g_edi, INIT_EDI);
+#endif
+ }
+ if (g_esi != INIT_ESI)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("esi=%d, correct value:%d\n", g_esi, INIT_ESI);
+#endif
+ }
+ if (g_ebx != INIT_EBX)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("ebx=%d, correct value:%d\n", g_ebx, INIT_EBX);
+#endif
+ }
+ if (g_ebp != g_ebp_save)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("ebp=0x%x, correct value:0x%x\n", g_ebp, g_ebp_save);
+#endif
+ }
+ if (g_esp != g_esp_save)
+ {
+ n_error++;
+#ifdef DEBUG
+ printf("esp=0x%x, correct value:0x%x\n", g_esp, g_esp_save);
+#endif
+ }
+ if (n_error !=0)
+ abort();
+ return 0;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/throw-1.C b/gcc/testsuite/g++.dg/torture/stackalign/throw-1.C
new file mode 100644
index 000000000..3eddc1d02
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/throw-1.C
@@ -0,0 +1,62 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k,l,m,n;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ for (k=0; k < j; k++)
+ for (l=0; l < k; l++)
+ for (m=0; m < l; m++)
+ for (n=0; n < m; n++)
+ global2 = k;
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+ throw 0;
+}
+
+void foo()
+{
+ bar();
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ foo();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/throw-2.C b/gcc/testsuite/g++.dg/torture/stackalign/throw-2.C
new file mode 100644
index 000000000..63a8c6e7c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/throw-2.C
@@ -0,0 +1,53 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ global2 = k;
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+ throw 0;
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ bar ();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/throw-3.C b/gcc/testsuite/g++.dg/torture/stackalign/throw-3.C
new file mode 100644
index 000000000..d3e53b829
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/throw-3.C
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ global2 = k;
+ throw 0;
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ bar ();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/throw-4.C b/gcc/testsuite/g++.dg/torture/stackalign/throw-4.C
new file mode 100644
index 000000000..52e6f7ff7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/throw-4.C
@@ -0,0 +1,55 @@
+/* { dg-do run } */
+/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+ volatile t_align a = 1;
+ int i,j,k;
+ i=j=k=0;
+ for (i=0; i < global; i++)
+ for (j=0; j < i; j++)
+ {
+ global2 = k;
+ throw 0;
+ }
+ if (check_int ((int *) &a, __alignof__(a)) != a)
+ abort ();
+}
+
+int main()
+{
+ int ll = 1;
+ int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+ try {
+ for (; i < global; i++)
+ for (; j < i; j++)
+ for (; k < j; k++)
+ for (; l < k; l++)
+ for (; m < l; m++)
+ for (; n < m; n++)
+ global2 = k;
+ bar ();
+ }
+ catch (...)
+ {
+ }
+ ll = i+j+k+l+m+n;
+ if (ll != 15)
+ {
+#ifdef DEBUG
+ printf("FAIL: sum %d != 15\n", ll);
+#endif
+ abort();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C
new file mode 100644
index 000000000..f8166eb95
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-0.C
@@ -0,0 +1,12 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+void __attribute__ ((noinline)) foo()
+{
+ ALTER_REGS();
+ // Throw the except and expect returning to main
+ throw 1;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C
new file mode 100644
index 000000000..70dce7485
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-1.C
@@ -0,0 +1,16 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+/* Test situation 1: Stack really realign without DRAP */
+void __attribute__ ((noinline))
+foo ()
+{
+ int __attribute__ ((aligned(64))) a=1;
+ if (check_int (&a, __alignof__(a)) != a)
+ abort ();
+ ALTER_REGS();
+ throw a;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C
new file mode 100644
index 000000000..791eeb551
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-2.C
@@ -0,0 +1,29 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+/* Test situation 2: stack really realign with DRAP reg CX */
+void __attribute__ ((noinline))
+foo ()
+{
+ int __attribute__ ((aligned(64))) a=4;
+ char * s = (char *) __builtin_alloca (a + 1);
+
+ copy (s, a);
+ if (__builtin_strncmp (s, "good", a) != 0)
+ {
+#ifdef DEBUG
+ s[a] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+
+ if (check_int (&a, __alignof__(a)) != a)
+ abort ();
+
+ ALTER_REGS();
+ throw a;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C
new file mode 100644
index 000000000..29dee2d5a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-3.C
@@ -0,0 +1,35 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+/* Test situation 3: Stack realign really happen with DRAP reg DI */
+void __attribute__ ((noinline)) __attribute__ ((regparm(3)))
+bar (int arg1, int arg2, int arg3)
+{
+ int __attribute__ ((aligned(64))) a=1;
+ char * s = (char *) __builtin_alloca (arg3 + 1);
+
+ copy (s, arg3);
+ if (__builtin_strncmp (s, "good", arg3) != 0)
+ {
+#ifdef DEBUG
+ s[arg3] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+
+ if (check_int (&a, __alignof__(a)) != a)
+ abort ();
+
+ ALTER_REGS();
+ throw arg1+arg2+arg3+a;
+}
+
+void
+foo()
+{
+ bar (1,2,3);
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C
new file mode 100644
index 000000000..a896176ae
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-4.C
@@ -0,0 +1,17 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+volatile int __attribute__ ((aligned(32))) g_a=1;
+/* Test situation 4: no Drap and stack realign doesn't really happen */
+void __attribute__ ((noinline))
+foo()
+{
+ int i;
+ ALTER_REGS();
+ for (i=0; i < 10; i++)
+ g_a++;
+ throw g_a;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C
new file mode 100644
index 000000000..514e4e77a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-5.C
@@ -0,0 +1,31 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+double g_f=1.0;
+/* Test situation 5: Stack realign dosn't really happen with DRAP reg CX */
+void __attribute__ ((noinline)) __attribute__ ((regparm(2)))
+bar(int arg1, int arg2, int arg3, int arg4)
+{
+ char * s = (char *) __builtin_alloca (arg4 + 1);
+
+ copy (s, arg4);
+ if (__builtin_strncmp (s, "good", arg4) != 0)
+ {
+#ifdef DEBUG
+ s[arg4] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+ ALTER_REGS();
+ if (g_f) throw arg1+arg2+arg3+ g_f;
+}
+
+void __attribute__((noinline))
+foo()
+{
+ bar(1,2,3,4);
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C b/gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C
new file mode 100644
index 000000000..a888ca1b5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/stackalign/unwind-6.C
@@ -0,0 +1,31 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "test-unwind.h"
+
+#if !defined __PIC__ && !defined __USING_SJLJ_EXCEPTIONS__
+double g_f=1.0;
+/* Test situation 6: Stack realign dosn't really happen with DRAP reg DI */
+void __attribute__ ((noinline)) __attribute__ ((regparm(3)))
+bar(int arg1, int arg2, int arg3, int arg4)
+{
+ char * s = (char *) __builtin_alloca (arg4 + 1);
+
+ copy (s, arg4);
+ if (__builtin_strncmp (s, "good", arg4) != 0)
+ {
+#ifdef DEBUG
+ s[arg4] = '\0';
+ printf ("Failed: %s != good\n", s);
+#endif
+ abort ();
+ }
+ ALTER_REGS();
+ if (g_f) throw arg1+arg2+arg3+ g_f;
+}
+
+void __attribute__((noinline))
+foo()
+{
+ bar(1,2,3,4);
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/torture/str_empty.C b/gcc/testsuite/g++.dg/torture/str_empty.C
new file mode 100644
index 000000000..e24f0b6ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/str_empty.C
@@ -0,0 +1,15 @@
+// PR c++/31617
+// Segfault in integer_zerop
+// Origin: Andrew Pinski <andrew_pinski@playstation.sony.com>
+// { dg-do compile }
+
+struct polynomial {
+ ~polynomial ();
+};
+
+void spline_rep1 ()
+{
+ new polynomial[0]; // { dg-bogus "allocating zero-element array" }
+}
+
+
diff --git a/gcc/testsuite/g++.dg/torture/type-generic-1.C b/gcc/testsuite/g++.dg/torture/type-generic-1.C
new file mode 100644
index 000000000..4d82592af
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/type-generic-1.C
@@ -0,0 +1,13 @@
+/* Do the type-generic tests. Unlike pr28796-2.c, we test these
+ without any fast-math flags. */
+
+/* { dg-do run } */
+/* { dg-add-options ieee } */
+/* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
+
+#include "../../gcc.dg/tg-tests.h"
+
+int main(void)
+{
+ return main_tests ();
+}