1 // PR tree-optimization/22444
2 // When creating SFT's, we shouldn't add the original variable
3 // to the addressable vars list, because this may cause false aliasing
4 // with the subvars leading to the subvars not being renamed when they should
5 // { dg-do compile }
6 // { dg-options "-O2" }
7 // { dg-additional-options "-Wno-return-type" }
8 __extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t;
9 __extension__ typedef __SIZE_TYPE__ size_t;
10 namespace std
11 {
12   template<class _T1, class _T2> struct pair
13   {
14     _T1 first;
15     _T2 second;
pairpair16     pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) { }
17   };
18 }
19 namespace __gnu_internal
20 {
21   typedef char __one;
22   template<typename _Tp> __one __test_type(int _Tp::*);
23 }
24 namespace std
25 {
26   template<typename _Tp> struct ___is_pod
27   {
28     enum { __value = (sizeof(__gnu_internal::__test_type<_Tp>(0))!= sizeof(__gnu_internal::__one)) };
29   };
30   template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&> struct iterator
31   { };
32   template<typename _Iterator> struct iterator_traits
33   {
34     typedef typename _Iterator::difference_type difference_type;
35   };
36   template<typename _Iterator> class reverse_iterator : public iterator<typename iterator_traits<_Iterator>::iterator_category, typename iterator_traits<_Iterator>::value_type, typename iterator_traits<_Iterator>::difference_type, typename iterator_traits<_Iterator>::pointer, typename iterator_traits<_Iterator>::reference>
37   {
38     typedef _Iterator iterator_type;
39     typedef typename iterator_traits<_Iterator>::difference_type difference_type;
40     typedef typename iterator_traits<_Iterator>::reference reference;
41     reverse_iterator operator+(difference_type __n) const {}
42     reverse_iterator& operator+=(difference_type __n) { }
43     reference operator[](difference_type __n) const { }
44   };
45 }
46 namespace __gnu_cxx
47 {
48   template<bool _Thread> class __pool;
49   template<template <bool> class _PoolTp, bool _Thread> struct __common_pool_policy;
50   template<typename _Tp> class __mt_alloc_base
51   {
52     typedef ptrdiff_t difference_type;
53     typedef _Tp* pointer;
54   };
55   template<typename _Tp, typename _Poolp = __common_pool_policy<__pool, true> > class __mt_alloc : public __mt_alloc_base<_Tp>
56   {
57     typedef size_t size_type;
58   };
59 }
60 namespace std
61 {
62   template<typename _Tp> struct allocator:public __gnu_cxx::__mt_alloc<_Tp>
63   {
64     template<typename _Tp1> struct rebind
65     {
66       typedef allocator<_Tp1> other;
67     };
68   };
69   template <class _Arg, class _Result> struct unary_function  { };
70   template <class _Arg1, class _Arg2, class _Result> struct binary_function
71   {
72     typedef _Arg2 second_argument_type;
73   };
74   template <class _Tp> struct less : public binary_function<_Tp, _Tp, bool>
75   {
operatorless76     bool operator()(const _Tp& __x, const _Tp& __y) const { }
77   };
78   template <class _Tp> struct _Identity : public unary_function<_Tp,_Tp> { };
79   struct _Rb_tree_node_base
80   {
81     typedef _Rb_tree_node_base* _Base_ptr;
82     typedef const _Rb_tree_node_base* _Const_Base_ptr;
83     _Base_ptr _M_right;
_S_minimum_Rb_tree_node_base84     static _Base_ptr _S_minimum(_Base_ptr __x) { }
_S_maximum_Rb_tree_node_base85     static _Base_ptr _S_maximum(_Base_ptr __x) { }
86   };
87   template<typename _Val> struct _Rb_tree_node { };
88   template<typename _Tp> struct _Rb_tree_iterator
89   {
90     typedef _Tp* pointer;
91     typedef _Rb_tree_iterator<_Tp> _Self;
92     typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
93     pointer operator->() const { }
94     _Self operator++(int) { }
95     _Base_ptr _M_node;
96   };
97   template<typename _Tp> struct _Rb_tree_const_iterator
98   {
99     typedef const _Tp* pointer;
100     typedef _Rb_tree_iterator<_Tp> iterator;
101     typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr;
_Rb_tree_const_iterator_Rb_tree_const_iterator102     _Rb_tree_const_iterator(const iterator& __it) : _M_node(__it._M_node) { }
103     _Base_ptr _M_node;
104   };
105   template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc = allocator<_Val> > struct _Rb_tree
106   {
107     typedef typename _Alloc::template rebind<std::_Rb_tree_node<_Val> >::other _Node_allocator;
108     typedef _Rb_tree_node_base* _Base_ptr;
109     typedef const _Rb_tree_node_base* _Const_Base_ptr;
110     typedef std::_Rb_tree_node<_Val> _Rb_tree_node;
111     typedef _Key key_type;
112     typedef _Val value_type;
113     typedef value_type* pointer;
114     typedef _Rb_tree_node* _Link_type;
115     template<typename _Key_compare, bool _Is_pod_comparator = std::___is_pod<_Key_compare>::__value> struct _Rb_tree_impl
116       : _Node_allocator
117     {
118       _Rb_tree_node_base _M_header;
119     };
120     _Rb_tree_impl<_Compare> _M_impl;
121     typedef _Rb_tree_iterator<value_type> iterator;
122     typedef _Rb_tree_const_iterator<value_type> const_iterator;
123     typedef std::reverse_iterator<iterator> reverse_iterator;
124     pair<iterator,bool> insert_unique(const value_type& __x);
125   };
126   template<class _Key, class _Compare, class _Alloc> class set
127   {
128     typedef _Key key_type;
129     typedef _Key value_type;
130     typedef _Compare key_compare;
131     typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;
132     typedef _Rb_tree<_Key, value_type, _Identity<value_type>, key_compare, _Key_alloc_type> _Rep_type;
133     _Rep_type _M_t;
134     typedef typename _Rep_type::const_iterator iterator;
insert(const value_type & __x)135     std::pair<iterator,bool> insert(const value_type& __x)
136     {
137       std::pair<typename _Rep_type::iterator, bool> __p = _M_t.insert_unique(__x);
138       return std::pair<iterator, bool>(__p.first, __p.second);
139     }
140   };
141 }
142 template class std::set<int, std::less<int>, std::allocator<char> >;
143