This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/14863] [3.4 regression] unit-at-a-time causes miscompilation
- From: "rguenth at tat dot physik dot uni-tuebingen dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Jun 2004 12:05:08 -0000
- Subject: [Bug rtl-optimization/14863] [3.4 regression] unit-at-a-time causes miscompilation
- References: <20040406114325.14863.rguenth@tat.physik.uni-tuebingen.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de 2004-06-02 12:05 -------
Subject: Re: [3.4 regression] unit-at-a-time
causes miscompilation
So we have:
void Engine<(int)1, int, Dynamic>::performDestroy<IntervalIterator>
(IntervalIterator const&, IntervalIterator const&, BackFill const&, bool)
{
int koffset = (offsetFlag ? 0 : first_m);
int killed =
Pooma::Algorithms::delete_backfill(data_m.begin(), data_m.end(),
killBegin, killEnd, koffset);
Interval<1> newdom;
if (killed < domain().size())
newdom = Interval<1>(domain().first(), domain().last() - killed);
domain_m = newdom;
data_m.resize(domain().size(), typename DataBlockPtr<T>::NoInitTag());
}
and inlined, with segfault at the marked place (note I already changed
IntervalIterator::operator*() to return by value, not by reference):
template <class DataIterator, class KillIterator>
inline
typename std::iterator_traits<DataIterator>::difference_type
delete_backfill(DataIterator data_begin, DataIterator data_end,
const KillIterator kill_begin, const KillIterator kill_end,
typename std::iterator_traits<DataIterator>::difference_type offset = 0)
{
PAssert(data_end >= data_begin);
PAssert(kill_end >= kill_begin);
std::reverse_iterator<KillIterator> rk_pos(kill_end);
std::reverse_iterator<KillIterator> rk_end(kill_begin);
typedef std::iterator_traits<DataIterator> DataTraits_t;
typedef typename DataTraits_t::difference_type Diff_t;
Diff_t last = data_end - data_begin - 1;
while (!(rk_pos == rk_end))
{
if ((*rk_pos - offset) != last) break;
^^^^^^^
--last;
++rk_pos;
}
DataIterator last_pos = data_begin + last;
while (!(rk_pos == rk_end))
{
*(data_begin + (*rk_pos++ - offset)) = *last_pos--;
}
return kill_end - kill_begin;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14863