From: Diego Novillo Date: Wed, 28 Jul 2004 12:38:53 +0000 (+0000) Subject: re PR tree-optimization/16688 (ICE in group_aliases, at tree-ssa-alias.c:1234) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6fea55e979fdde5cda078fed67abf0c6e37dfce9;p=gcc.git re PR tree-optimization/16688 (ICE in group_aliases, at tree-ssa-alias.c:1234) PR tree-optimization/16688 PR tree-optimization/16689 * g++.dg/tree-ssa/pr16688.C: New test. From-SVN: r85262 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a505d4dec38..ae7cd8024da 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2004-07-28 Diego Novillo + + PR tree-optimization/16688 + PR tree-optimization/16689 + * g++.dg/tree-ssa/pr16688.C: New test. + 2004-07-28 Diego Novillo * gcc.dg/tree-ssa/20031022-1.c: Adjust number of expected diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr16688.C b/gcc/testsuite/g++.dg/tree-ssa/pr16688.C new file mode 100644 index 00000000000..ce88bc2b2dc --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr16688.C @@ -0,0 +1,273 @@ +/* PR 16688. Test provided by Wolfgang Bangerth. The alias analyzer + was aborting when trying to group aliases. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +template +struct iterator_traits; + +template +struct iterator_traits<_Tp*> { + typedef _Tp& reference; +}; + +template struct NI { + _Iterator current; + + typedef typename iterator_traits<_Iterator>::reference reference; + + NI() { } + + NI(const _Iterator& __i) : current(__i) { } + + reference operator*() const { return *current; } + + NI& operator++() { return *this; } + + const _Iterator& base() const { return current; } +}; + +template +inline int +operator-(const NI<_IteratorL>& __lhs, + const NI<_IteratorR>& __rhs) +{ return __lhs.base() - __rhs.base(); } + + +template +inline _OI +__copy_aux(_II __first, _II __last, _OI __result) +{ + struct __copy { + static _OI + copy(_II __first, _II __last, _OI __result) + { + for (; __first != __last; ++__result, ++__first) + *__result = *__first; + return __result; + } + }; + + return __copy::copy(__first, __last, __result); +} + +struct __copy_normal +{ + template + static _OI + copy_n(_II __first, _II __last, _OI __result) + { + return __copy_aux(__first, __last, __result); + } +}; +template +inline _OutputIterator +copy(_InputIterator __first, _InputIterator __last, + _OutputIterator __result) +{ + return __copy_normal::copy_n(__first, __last, __result); +} + +template +void uninitialized_fill_n(T,U,V); + + +template +struct _Vector_base { + struct _Vector_impl { + _Tp* start; + _Tp* finish; + _Tp* end_of_storage; + _Vector_impl() : start(0), finish(0), end_of_storage(0) + { } + } impl; + + _Vector_base(unsigned __n) { + impl.start = allocate(__n); + impl.finish = impl.start; + impl.end_of_storage = impl.start + __n; + } + + ~_Vector_base() { + deallocate(impl.start, + impl.end_of_storage - impl.start); + } + + _Tp* allocate(unsigned __n); + + void deallocate(_Tp* __p, unsigned __n); + + NI<_Tp*> begin() { return NI<_Tp*> (impl.start); } +}; + + +template +struct vector : _Vector_base<_Tp> +{ + vector(int __n) + : _Vector_base<_Tp>(__n) + { + uninitialized_fill_n(this->impl.start, __n, _Tp()); + } +}; + + + +struct Tensor +{ + Tensor (); + Tensor (const Tensor &); + + double values[2]; +}; + + +inline +Tensor::Tensor (const Tensor &p) +{ + for (unsigned int i=0; i<2; ++i) + values[i] = p.values[i]; +} + + +struct TriaAccessor +{ + typedef void * AccessorData; + + void copy_from (const TriaAccessor &); + void operator = (const TriaAccessor *); + + TriaAccessor & operator = (const TriaAccessor &); + + bool operator == (const TriaAccessor &) const; + + bool operator != (const TriaAccessor &) const; + void operator ++ (); + + int state () const; + bool used () const; + + int present_level; + int present_index; + int** levels; +}; + +inline int TriaAccessor::state () const { + if ((present_level>=0) && (present_index>=0)) + return 0; + else + if ((present_level==-1) && (present_index==-1)) + return 1; + else + return 2; +} + + +inline +void TriaAccessor::operator ++ () { + ++this->present_index; + + while (this->present_index >= + static_cast(*this->levels[this->present_level])) + { + ++this->present_level; + this->present_index = 0; + + if (this->present_level >= static_cast(1)) + { + + this->present_level = this->present_index = -1; + return; + } + } +} + +struct MGDoFObjectAccessor : TriaAccessor {}; + + + +struct TriaRawIterator +{ + TriaRawIterator (); + + TriaRawIterator (const TriaRawIterator &); + TriaRawIterator (const MGDoFObjectAccessor &a); + const MGDoFObjectAccessor & operator * () const; + + MGDoFObjectAccessor & operator * (); + const MGDoFObjectAccessor * operator -> () const; + + MGDoFObjectAccessor * operator -> (); + + TriaRawIterator & operator = (const TriaRawIterator &); + + bool operator == (const TriaRawIterator &) const; + bool operator != (const TriaRawIterator &) const; + bool operator < (const TriaRawIterator &) const; + MGDoFObjectAccessor accessor; + + TriaRawIterator & operator ++ (); +}; + +struct TriaIterator : TriaRawIterator +{ + TriaIterator (); + + TriaIterator (const TriaIterator &i); + + TriaIterator & + operator = (const TriaIterator &); + + TriaIterator & + operator = (const TriaRawIterator &); +}; + + +inline +TriaRawIterator::TriaRawIterator (const TriaRawIterator &i) : + accessor (i.accessor) {} + +inline +TriaIterator::TriaIterator (const TriaIterator &i) : + TriaRawIterator (static_cast(i)) {} + +inline +TriaRawIterator & TriaRawIterator::operator ++ () { + while (++accessor, (this->accessor.state() == 0)) + if (this->accessor.used() == true) + return *this; + return *this; +} + +struct Comp { + Comp (const Tensor &dir) : dir(dir) {} + + bool operator () (const TriaIterator &c1, const TriaIterator &c2) const; + const Tensor dir; +}; + + +template +void x1(Iter first, Iter last, int i, Comp comp) +{ + x1(Iter(), last, i, comp); +} + +template +inline void x2(Iter first, Iter last, Comp comp) +{ + if (first.base() != last.base()) + x1(first, last, (last - first), comp); +} + +void downstream_dg (const Tensor& direction) +{ + vector ordered_cells(13); + const Comp comparator(direction); + + TriaIterator begin, end; + + copy (begin, end, ordered_cells.begin()); + x2 (ordered_cells.begin(), ordered_cells.begin(), comparator); +}