annotate gcc/testsuite/g++.dg/opt/pr44919.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } }
kono
parents:
diff changeset
2 // { dg-options "-O3 -fselective-scheduling2" }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
3 // { dg-additional-options "-Wno-return-type" }
111
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 namespace std {
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 typedef long unsigned int size_t;
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 template<typename _Tp> class new_allocator { public: typedef size_t size_type; typedef _Tp* pointer; };
kono
parents:
diff changeset
10 template<typename _Tp> class allocator: public new_allocator<_Tp> { public: typedef size_t size_type; template<typename _Tp1> struct rebind { typedef allocator<_Tp1> other; }; };
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 class back_insert_iterator { };
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
13 template<typename _Container> back_insert_iterator back_inserter(_Container& __x) { return back_insert_iterator(); };
111
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 class vector { };
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 struct _List_node_base { };
kono
parents:
diff changeset
18 struct _List_node : public _List_node_base { };
kono
parents:
diff changeset
19 template<typename _Tp> struct _List_iterator { typedef _List_iterator<_Tp> _Self; typedef _Tp& reference; explicit _List_iterator(_List_node_base* __x) : _M_node(__x) { } reference operator*() const { } _Self& operator++() { } bool operator!=(const _Self& __x) const { return _M_node != __x._M_node; } _List_node_base* _M_node; };
kono
parents:
diff changeset
20 template<typename _Tp, typename _Alloc> class _List_base { protected: typedef typename _Alloc::template rebind<_List_node >::other _Node_alloc_type; struct _List_impl : public _Node_alloc_type { _List_node_base _M_node; }; _List_impl _M_impl; };
kono
parents:
diff changeset
21 template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class list : protected _List_base<_Tp, _Alloc> { public: typedef _Tp value_type; typedef _List_iterator<_Tp> iterator; iterator begin() { } iterator end() { return iterator(&this->_M_impl._M_node); } };
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 namespace tr1 { template<typename _Tp, size_t _Nm> struct array { typedef _Tp value_type; typedef const value_type& const_reference; typedef const value_type* const_iterator; typedef size_t size_type; value_type _M_instance[_Nm ? _Nm : 1]; const_iterator begin() const { return const_iterator(&_M_instance[0]); } const_reference operator[](size_type __n) const { return _M_instance[__n]; } }; }
kono
parents:
diff changeset
24 }
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 namespace X {
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 class Object { };
kono
parents:
diff changeset
29 struct Has_qrt { };
kono
parents:
diff changeset
30 template <typename F> struct qrt_or_not { typedef const typename F::result_type & type; };
kono
parents:
diff changeset
31 template <typename Functor, typename P1 = void> struct Qualified_result_of : qrt_or_not<Functor> { };
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 using std::tr1::array;
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 template <class R_> class Point_2 : public R_::Kernel_base::Point_2 {
kono
parents:
diff changeset
36 public:
kono
parents:
diff changeset
37 typedef typename R_::Kernel_base::Point_2 RPoint_2;
kono
parents:
diff changeset
38 typedef RPoint_2 Rep;
kono
parents:
diff changeset
39 const Rep& rep() const { }
kono
parents:
diff changeset
40 };
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 template <class R_> class Vector_2 : public R_::Kernel_base::Vector_2 {
kono
parents:
diff changeset
43 public:
kono
parents:
diff changeset
44 typedef typename R_::Kernel_base::Vector_2 RVector_2;
kono
parents:
diff changeset
45 typedef RVector_2 Rep;
kono
parents:
diff changeset
46 const Rep& rep() const { return *this; }
kono
parents:
diff changeset
47 typedef R_ R;
kono
parents:
diff changeset
48 typename Qualified_result_of<typename R::Compute_x_2,Vector_2>::type x() const { return R().compute_x_2_object()(*this); }
kono
parents:
diff changeset
49 typename Qualified_result_of<typename R::Compute_y_2,Vector_2>::type y() const { return R().compute_y_2_object()(*this); }
kono
parents:
diff changeset
50 typename Qualified_result_of<typename R::Compute_y_2,Vector_2>::type cartesian(int i) const { return (i==0) ? x() : y(); }
kono
parents:
diff changeset
51 typename Qualified_result_of<typename R::Compute_hx_2,Vector_2>::type hx() const { return R().compute_hx_2_object()(*this); }
kono
parents:
diff changeset
52 typename Qualified_result_of<typename R::Compute_hy_2,Vector_2>::type hy() const { return R().compute_hy_2_object()(*this); }
kono
parents:
diff changeset
53 typename Qualified_result_of<typename R::Compute_hw_2,Vector_2>::type hw() const { return R().compute_hw_2_object()(*this); }
kono
parents:
diff changeset
54 typename Qualified_result_of<typename R::Compute_hx_2,Vector_2>::type homogeneous(int i) const { return (i==0) ? hx() : (i==1)? hy() : hw(); }
kono
parents:
diff changeset
55 };
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 template <class R_> class Segment_2 : public R_::Kernel_base::Segment_2 { };
kono
parents:
diff changeset
58 template <class R_> class Iso_rectangle_2 : public R_::Kernel_base::Iso_rectangle_2 { };
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 template <typename T, int i > const T& constant() { static const T t(i); return t; }
kono
parents:
diff changeset
61 template <class T, class Alloc = std::allocator<T > > class Handle_for { struct RefCounted { T t; }; typedef typename Alloc::template rebind<RefCounted>::other Allocator; typedef typename Allocator::pointer pointer; pointer ptr_; public: typedef T element_type; const T * Ptr() const { return &(ptr_->t); } };
kono
parents:
diff changeset
62 template <class T, class Allocator> const T& get(const Handle_for<T, Allocator> &h) { return *(h.Ptr()); }
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 template <class R_> class PointC2 {
kono
parents:
diff changeset
65 public:
kono
parents:
diff changeset
66 typedef typename R_::Vector_2 Vector_2; Vector_2 base;
kono
parents:
diff changeset
67 typedef typename Vector_2::Cartesian_const_iterator Cartesian_const_iterator; Cartesian_const_iterator cartesian_begin() const { return base.cartesian_begin(); }
kono
parents:
diff changeset
68 };
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 template <class R_> class VectorC2 {
kono
parents:
diff changeset
71 public:
kono
parents:
diff changeset
72 typedef typename R_::FT FT;
kono
parents:
diff changeset
73 typedef array<FT, 2> Rep;
kono
parents:
diff changeset
74 typedef typename R_::template Handle<Rep>::type Base;
kono
parents:
diff changeset
75 Base base;
kono
parents:
diff changeset
76 typedef typename Rep::const_iterator Cartesian_const_iterator;
kono
parents:
diff changeset
77 const FT & x() const { return X::get(base)[0]; }
kono
parents:
diff changeset
78 const FT & y() const { return X::get(base)[1]; }
kono
parents:
diff changeset
79 const FT & hx() const { return x(); }
kono
parents:
diff changeset
80 const FT & hy() const { return y(); }
kono
parents:
diff changeset
81 const FT & hw() const { return constant<FT, 1>(); }
kono
parents:
diff changeset
82 Cartesian_const_iterator cartesian_begin() const { return X::get(base).begin(); }
kono
parents:
diff changeset
83 };
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 template <class R_> class SegmentC2 { };
kono
parents:
diff changeset
86 template <class R_> class Iso_rectangleC2 { };
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 namespace internal {
kono
parents:
diff changeset
89 template <class K> class Segment_2_Iso_rectangle_2_pair {
kono
parents:
diff changeset
90 public:
kono
parents:
diff changeset
91 enum Intersection_results { NO_INTERSECTION };
kono
parents:
diff changeset
92 Segment_2_Iso_rectangle_2_pair(typename K::Segment_2 const *seg, typename K::Iso_rectangle_2 const *rect) ;
kono
parents:
diff changeset
93 Intersection_results intersection_type() const;
kono
parents:
diff changeset
94 mutable Intersection_results _result;
kono
parents:
diff changeset
95 typename K::Point_2 _ref_point;
kono
parents:
diff changeset
96 typename K::Vector_2 _dir;
kono
parents:
diff changeset
97 typename K::Point_2 _isomin;
kono
parents:
diff changeset
98 typename K::Point_2 _isomax;
kono
parents:
diff changeset
99 mutable typename K::FT _min, _max;
kono
parents:
diff changeset
100 };
kono
parents:
diff changeset
101 template <class K> Object intersection( const typename K::Segment_2 &seg, const typename K::Iso_rectangle_2 &iso, const K&) {
kono
parents:
diff changeset
102 typedef Segment_2_Iso_rectangle_2_pair<K> is_t; is_t ispair(&seg, &iso); switch (ispair.intersection_type()) { }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
103 return Object();
111
kono
parents:
diff changeset
104 }
kono
parents:
diff changeset
105 template <class K> typename Segment_2_Iso_rectangle_2_pair<K>::Intersection_results Segment_2_Iso_rectangle_2_pair<K>::intersection_type() const {
kono
parents:
diff changeset
106 typedef typename K::RT RT;
kono
parents:
diff changeset
107 typedef typename K::FT FT;
kono
parents:
diff changeset
108 typename K::Construct_cartesian_const_iterator_2 construct_cccit;
kono
parents:
diff changeset
109 typename K::Cartesian_const_iterator_2 ref_point_it = construct_cccit(_ref_point);
kono
parents:
diff changeset
110 typename K::Cartesian_const_iterator_2 end = construct_cccit(_ref_point, 0);
kono
parents:
diff changeset
111 typename K::Cartesian_const_iterator_2 isomin_it = construct_cccit(_isomin);
kono
parents:
diff changeset
112 typename K::Cartesian_const_iterator_2 isomax_it = construct_cccit(_isomax);
kono
parents:
diff changeset
113 for (unsigned int i=0; ref_point_it != end; ++i, ++ref_point_it, ++isomin_it, ++isomax_it) {
kono
parents:
diff changeset
114 if (_dir.homogeneous(i) == RT(0)) {
kono
parents:
diff changeset
115 if ( *(ref_point_it) <*(isomin_it) ) {
kono
parents:
diff changeset
116 _result = NO_INTERSECTION;
kono
parents:
diff changeset
117 }
kono
parents:
diff changeset
118 if ( *(ref_point_it) > *(isomax_it)) {
kono
parents:
diff changeset
119 _result = NO_INTERSECTION;
kono
parents:
diff changeset
120 }
kono
parents:
diff changeset
121 } else {
kono
parents:
diff changeset
122 FT newmin, newmax;
kono
parents:
diff changeset
123 if (_dir.homogeneous(i) > RT(0)) {
kono
parents:
diff changeset
124 newmin = ( *(isomin_it) - (*ref_point_it)) / _dir.cartesian(i);
kono
parents:
diff changeset
125 newmax = ( *(isomax_it) - (*ref_point_it)) / _dir.cartesian(i);
kono
parents:
diff changeset
126 } else {
kono
parents:
diff changeset
127 newmin = ( (*isomax_it) - (*ref_point_it)) / _dir.cartesian(i);
kono
parents:
diff changeset
128 newmax = ( (*isomin_it) - (*ref_point_it)) / _dir.cartesian(i);
kono
parents:
diff changeset
129 }
kono
parents:
diff changeset
130 if (newmin > _min) _min = newmin;
kono
parents:
diff changeset
131 if (newmax <_max) _max = newmax;
kono
parents:
diff changeset
132 if (_max <_min) { return _result; }
kono
parents:
diff changeset
133 }
kono
parents:
diff changeset
134 }
kono
parents:
diff changeset
135 }
kono
parents:
diff changeset
136 }
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 template <class K> Object intersection(const Segment_2<K> &seg, const Iso_rectangle_2<K> &iso) { typedef typename K::Intersect_2 Intersect; return Intersect()(seg, iso); }
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 namespace CommonKernelFunctors {
kono
parents:
diff changeset
141 template <typename K> class Construct_cartesian_const_iterator_2 {
kono
parents:
diff changeset
142 typedef typename K::Point_2 Point_2;
kono
parents:
diff changeset
143 typedef typename K::Cartesian_const_iterator_2 Cartesian_const_iterator_2;
kono
parents:
diff changeset
144 public:
kono
parents:
diff changeset
145 typedef Cartesian_const_iterator_2 result_type;
kono
parents:
diff changeset
146 Cartesian_const_iterator_2 operator()( const Point_2& p) const { return p.rep().cartesian_begin(); }
kono
parents:
diff changeset
147 Cartesian_const_iterator_2 operator()( const Point_2& p, int) const { }
kono
parents:
diff changeset
148 };
kono
parents:
diff changeset
149 template <typename K> class Intersect_2 {
kono
parents:
diff changeset
150 typedef typename K::Object_2 Object_2;
kono
parents:
diff changeset
151 public:
kono
parents:
diff changeset
152 typedef Object_2 result_type;
kono
parents:
diff changeset
153 template <class T1, class T2> Object_2 operator()(const T1& t1, const T2& t2) const { return internal::intersection(t1, t2, K()); }
kono
parents:
diff changeset
154 };
kono
parents:
diff changeset
155 }
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 namespace CartesianKernelFunctors {
kono
parents:
diff changeset
158 using namespace CommonKernelFunctors;
kono
parents:
diff changeset
159 template <typename K> class Compute_x_2 : Has_qrt {
kono
parents:
diff changeset
160 typedef typename K::FT FT;
kono
parents:
diff changeset
161 typedef typename K::Vector_2 Vector_2;
kono
parents:
diff changeset
162 public:
kono
parents:
diff changeset
163 typedef FT result_type;
kono
parents:
diff changeset
164 const result_type & operator()(const Vector_2& v) const { return v.rep().x(); }
kono
parents:
diff changeset
165 };
kono
parents:
diff changeset
166 template <typename K> class Compute_y_2 : Has_qrt {
kono
parents:
diff changeset
167 typedef typename K::FT FT;
kono
parents:
diff changeset
168 typedef typename K::Vector_2 Vector_2;
kono
parents:
diff changeset
169 public:
kono
parents:
diff changeset
170 typedef FT result_type;
kono
parents:
diff changeset
171 const result_type & operator()(const Vector_2& v) const { return v.rep().y(); }
kono
parents:
diff changeset
172 };
kono
parents:
diff changeset
173 template <typename K> class Compute_hx_2 : public Has_qrt {
kono
parents:
diff changeset
174 typedef typename K::FT FT;
kono
parents:
diff changeset
175 typedef typename K::Vector_2 Vector_2;
kono
parents:
diff changeset
176 public:
kono
parents:
diff changeset
177 typedef FT result_type;
kono
parents:
diff changeset
178 const result_type & operator()(const Vector_2& v) const { return v.rep().hx(); }
kono
parents:
diff changeset
179 };
kono
parents:
diff changeset
180 template <typename K> class Compute_hy_2 : public Has_qrt {
kono
parents:
diff changeset
181 typedef typename K::FT FT;
kono
parents:
diff changeset
182 typedef typename K::Vector_2 Vector_2;
kono
parents:
diff changeset
183 public:
kono
parents:
diff changeset
184 typedef FT result_type;
kono
parents:
diff changeset
185 const result_type & operator()(const Vector_2& v) const { return v.rep().hy(); }
kono
parents:
diff changeset
186 };
kono
parents:
diff changeset
187 template <typename K> class Compute_hw_2 : public Has_qrt {
kono
parents:
diff changeset
188 typedef typename K::FT FT;
kono
parents:
diff changeset
189 typedef typename K::Vector_2 Vector_2;
kono
parents:
diff changeset
190 public:
kono
parents:
diff changeset
191 typedef FT result_type;
kono
parents:
diff changeset
192 const result_type & operator()(const Vector_2& v) const { return v.rep().hw(); }
kono
parents:
diff changeset
193 };
kono
parents:
diff changeset
194 }
kono
parents:
diff changeset
195
kono
parents:
diff changeset
196 template <typename K_, typename FT_> struct Cartesian_base {
kono
parents:
diff changeset
197 typedef K_ Kernel;
kono
parents:
diff changeset
198 typedef X::Object Object_2;
kono
parents:
diff changeset
199 typedef PointC2<Kernel> Point_2;
kono
parents:
diff changeset
200 typedef VectorC2<Kernel> Vector_2;
kono
parents:
diff changeset
201 typedef SegmentC2<Kernel> Segment_2;
kono
parents:
diff changeset
202 typedef Iso_rectangleC2<Kernel> Iso_rectangle_2;
kono
parents:
diff changeset
203 typedef typename array<FT_, 2>::const_iterator Cartesian_const_iterator_2;
kono
parents:
diff changeset
204 };
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 template <typename K_base, typename Kernel_ > struct Type_equality_wrapper : public K_base {
kono
parents:
diff changeset
207 typedef K_base Kernel_base;
kono
parents:
diff changeset
208 typedef X::Point_2<Kernel_> Point_2;
kono
parents:
diff changeset
209 typedef X::Vector_2<Kernel_> Vector_2;
kono
parents:
diff changeset
210 typedef X::Segment_2<Kernel_> Segment_2;
kono
parents:
diff changeset
211 typedef X::Iso_rectangle_2<Kernel_> Iso_rectangle_2;
kono
parents:
diff changeset
212 };
kono
parents:
diff changeset
213
kono
parents:
diff changeset
214 template <typename FT_, typename Kernel_ > struct Cartesian_base_ref_count : public Cartesian_base<Kernel_, FT_ > {
kono
parents:
diff changeset
215 typedef FT_ RT;
kono
parents:
diff changeset
216 typedef FT_ FT;
kono
parents:
diff changeset
217 template <typename T > struct Handle { typedef Handle_for<T> type; };
kono
parents:
diff changeset
218 typedef Kernel_ K;
kono
parents:
diff changeset
219 typedef CartesianKernelFunctors::Compute_x_2<K> Compute_x_2;
kono
parents:
diff changeset
220 Compute_x_2 compute_x_2_object() const { }
kono
parents:
diff changeset
221 typedef CartesianKernelFunctors::Compute_y_2<K> Compute_y_2;
kono
parents:
diff changeset
222 Compute_y_2 compute_y_2_object() const { }
kono
parents:
diff changeset
223 typedef CartesianKernelFunctors::Compute_hx_2<K> Compute_hx_2;
kono
parents:
diff changeset
224 Compute_hx_2 compute_hx_2_object() const { }
kono
parents:
diff changeset
225 typedef CartesianKernelFunctors::Compute_hy_2<K> Compute_hy_2;
kono
parents:
diff changeset
226 Compute_hy_2 compute_hy_2_object() const { }
kono
parents:
diff changeset
227 typedef CartesianKernelFunctors::Compute_hw_2<K> Compute_hw_2;
kono
parents:
diff changeset
228 Compute_hw_2 compute_hw_2_object() const { }
kono
parents:
diff changeset
229 typedef CartesianKernelFunctors::Construct_cartesian_const_iterator_2<K> Construct_cartesian_const_iterator_2;
kono
parents:
diff changeset
230 typedef CartesianKernelFunctors::Intersect_2<K> Intersect_2;
kono
parents:
diff changeset
231 };
kono
parents:
diff changeset
232
kono
parents:
diff changeset
233 template <typename FT_ > struct Cartesian : public Type_equality_wrapper<Cartesian_base_ref_count<FT_, Cartesian<FT_> >, Cartesian<FT_> > { };
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 template <class Kernel> class Ipelet_base {
kono
parents:
diff changeset
236 public:
kono
parents:
diff changeset
237 typedef typename X::Point_2<Kernel> Point_2;
kono
parents:
diff changeset
238 typedef typename Kernel::Segment_2 Segment_2;
kono
parents:
diff changeset
239 typedef typename Kernel::Iso_rectangle_2 Iso_rectangle_2;
kono
parents:
diff changeset
240
kono
parents:
diff changeset
241 Iso_rectangle_2 read_active_objects () const { }
kono
parents:
diff changeset
242 struct Voronoi_from_tri{ std::list<Segment_2> seg_list; };
kono
parents:
diff changeset
243
kono
parents:
diff changeset
244 template <class T,class output_iterator> bool cast_into_seg(const T& obj,const Iso_rectangle_2& bbox,output_iterator out_it) const{ X::intersection(obj,bbox); }
kono
parents:
diff changeset
245 template<class iterator,class output_iterator> void cast_into_seg(const iterator first,const iterator end, const Iso_rectangle_2& bbox, output_iterator out_it) const { for (iterator it=first; it!=end; ++it) cast_into_seg(*it,bbox,out_it); }
kono
parents:
diff changeset
246 void draw_dual_(Voronoi_from_tri& v_recup,const Iso_rectangle_2& bbox) const { std::vector seg_cont; cast_into_seg(v_recup.seg_list.begin(),v_recup.seg_list.end(),bbox,std::back_inserter(seg_cont)); }
kono
parents:
diff changeset
247 void draw_dual_in_ipe(const Iso_rectangle_2& bbox) const { Voronoi_from_tri v_recup; draw_dual_(v_recup,bbox); }
kono
parents:
diff changeset
248 };
kono
parents:
diff changeset
249
kono
parents:
diff changeset
250 typedef X::Cartesian<double> Kernel;
kono
parents:
diff changeset
251
kono
parents:
diff changeset
252 class diagrammeIpelet : public X::Ipelet_base<Kernel> { void protected_run(); };
kono
parents:
diff changeset
253 void diagrammeIpelet::protected_run() { Iso_rectangle_2 bbox = read_active_objects( ); draw_dual_in_ipe(bbox); }
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255 }