re PR libstdc++/34095 (parallel mode: segfault in std::sort)
2008-01-01 Paolo Carlini <pcarlini@suse.de> PR libstdc++/34095 * include/parallel/multiway_merge.h (multiway_merge_bubble, parallel_multiway_merge): Together with ::operator new use ::operator delete. * include/parallel/losertree.h (LoserTree<>::~LoserTree): Likewise. * include/parallel/quicksort.h (parallel_sort_qs_divide): Likewise. * include/parallel/random_shuffle.h (parallel_random_shuffle_drs_pu, sequential_random_shuffle): Likewise. * include/parallel/tree.h (_M_not_sorted_bulk_insertion_construction): Likewise. * include/parallel/multiway_mergesort.h (parallel_sort_mwms_pu, parallel_sort_mwms): Likewise. * include/parallel/partial_sum.h (parallel_partial_sum_linear): Likewise. * testsuite/25_algorithms/sort/34095.cc: New. From-SVN: r131247
This commit is contained in:
parent
33d95150e4
commit
fac9044d26
9 changed files with 68 additions and 17 deletions
|
@ -1,3 +1,21 @@
|
||||||
|
2008-01-01 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
PR libstdc++/34095
|
||||||
|
* include/parallel/multiway_merge.h (multiway_merge_bubble,
|
||||||
|
parallel_multiway_merge): Together with ::operator new use
|
||||||
|
::operator delete.
|
||||||
|
* include/parallel/losertree.h (LoserTree<>::~LoserTree): Likewise.
|
||||||
|
* include/parallel/quicksort.h (parallel_sort_qs_divide): Likewise.
|
||||||
|
* include/parallel/random_shuffle.h (parallel_random_shuffle_drs_pu,
|
||||||
|
sequential_random_shuffle): Likewise.
|
||||||
|
* include/parallel/tree.h (_M_not_sorted_bulk_insertion_construction):
|
||||||
|
Likewise.
|
||||||
|
* include/parallel/multiway_mergesort.h (parallel_sort_mwms_pu,
|
||||||
|
parallel_sort_mwms): Likewise.
|
||||||
|
* include/parallel/partial_sum.h (parallel_partial_sum_linear):
|
||||||
|
Likewise.
|
||||||
|
* testsuite/25_algorithms/sort/34095.cc: New.
|
||||||
|
|
||||||
2008-01-01 Paolo Carlini <pcarlini@suse.de>
|
2008-01-01 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
* testsuite/25_algorithms/sort/34636.cc: Fix Copyright year.
|
* testsuite/25_algorithms/sort/34636.cc: Fix Copyright year.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2007 Free Software Foundation, Inc.
|
// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the terms
|
// software; you can redistribute it and/or modify it under the terms
|
||||||
|
@ -250,7 +250,7 @@ template<typename T, typename Comparator = std::less<T> >
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ~LoserTree()
|
inline ~LoserTree()
|
||||||
{ delete[] losers; }
|
{ ::operator delete(losers); }
|
||||||
|
|
||||||
inline int
|
inline int
|
||||||
get_min_source()
|
get_min_source()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2007 Free Software Foundation, Inc.
|
// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the terms
|
// software; you can redistribute it and/or modify it under the terms
|
||||||
|
@ -936,7 +936,7 @@ template<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete fe; //Destructors already called.
|
::operator delete(fe); //Destructors already called.
|
||||||
delete[] source;
|
delete[] source;
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
|
@ -1622,7 +1622,7 @@ template<
|
||||||
else
|
else
|
||||||
pieces[slab][seq].second = _GLIBCXX_PARALLEL_LENGTH(seqs_begin[seq]);
|
pieces[slab][seq].second = _GLIBCXX_PARALLEL_LENGTH(seqs_begin[seq]);
|
||||||
}
|
}
|
||||||
delete[] samples;
|
::operator delete(samples);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2007 Free Software Foundation, Inc.
|
// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the terms
|
// software; you can redistribute it and/or modify it under the terms
|
||||||
|
@ -321,7 +321,7 @@ template<typename RandomAccessIterator, typename Comparator>
|
||||||
sd->source + offset);
|
sd->source + offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete[] sd->temporaries[iam];
|
::operator delete(sd->temporaries[iam]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief PMWMS main call.
|
/** @brief PMWMS main call.
|
||||||
|
@ -415,7 +415,7 @@ template<typename RandomAccessIterator, typename Comparator>
|
||||||
delete[] sd.merging_places;
|
delete[] sd.merging_places;
|
||||||
|
|
||||||
if (Settings::sort_splitting == Settings::SAMPLING)
|
if (Settings::sort_splitting == Settings::SAMPLING)
|
||||||
delete[] sd.samples;
|
::operator delete(sd.samples);
|
||||||
|
|
||||||
delete[] sd.offsets;
|
delete[] sd.offsets;
|
||||||
delete[] sd.pieces;
|
delete[] sd.pieces;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2007 Free Software Foundation, Inc.
|
// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the terms
|
// software; you can redistribute it and/or modify it under the terms
|
||||||
|
@ -182,7 +182,7 @@ template<
|
||||||
sums[iam]);
|
sums[iam]);
|
||||||
} //parallel
|
} //parallel
|
||||||
|
|
||||||
delete[] sums;
|
::operator delete(sums);
|
||||||
delete[] borders;
|
delete[] borders;
|
||||||
|
|
||||||
return result + n;
|
return result + n;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2007 Free Software Foundation, Inc.
|
// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the terms
|
// software; you can redistribute it and/or modify it under the terms
|
||||||
|
@ -91,7 +91,7 @@ namespace __gnu_parallel
|
||||||
pred(comp, pivot);
|
pred(comp, pivot);
|
||||||
difference_type split = parallel_partition(begin, end, pred, num_threads);
|
difference_type split = parallel_partition(begin, end, pred, num_threads);
|
||||||
|
|
||||||
delete[] samples;
|
::operator delete(samples);
|
||||||
|
|
||||||
return split;
|
return split;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2007 Free Software Foundation, Inc.
|
// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the terms
|
// software; you can redistribute it and/or modify it under the terms
|
||||||
|
@ -237,7 +237,7 @@ template<typename RandomAccessIterator, typename RandomNumberGenerator>
|
||||||
((b == d->bins_begin) ? 0 : sd->dist[b][d->num_threads]));
|
((b == d->bins_begin) ? 0 : sd->dist[b][d->num_threads]));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] sd->temporaries[iam];
|
::operator delete(sd->temporaries[iam]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Round up to the next greater power of 2.
|
/** @brief Round up to the next greater power of 2.
|
||||||
|
@ -490,7 +490,7 @@ template<typename RandomAccessIterator, typename RandomNumberGenerator>
|
||||||
delete[] dist0;
|
delete[] dist0;
|
||||||
delete[] dist1;
|
delete[] dist1;
|
||||||
delete[] oracles;
|
delete[] oracles;
|
||||||
delete[] target;
|
::operator delete(target);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
__gnu_sequential::random_shuffle(begin, end, rng);
|
__gnu_sequential::random_shuffle(begin, end, rng);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2007 Free Software Foundation, Inc.
|
// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
// software; you can redistribute it and/or modify it under the terms
|
// software; you can redistribute it and/or modify it under the terms
|
||||||
|
@ -1344,7 +1344,7 @@ namespace __gnu_parallel
|
||||||
_M_sorted_bulk_construction(sorted_access, beg_partition, n, num_threads, strictly_less_or_less_equal);
|
_M_sorted_bulk_construction(sorted_access, beg_partition, n, num_threads, strictly_less_or_less_equal);
|
||||||
else
|
else
|
||||||
_M_sorted_bulk_insertion(sorted_access, beg_partition, n, num_threads, strictly_less_or_less_equal);
|
_M_sorted_bulk_insertion(sorted_access, beg_partition, n, num_threads, strictly_less_or_less_equal);
|
||||||
delete v;
|
::operator delete(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Construct a tree sequentially using the parallel routine
|
/** @brief Construct a tree sequentially using the parallel routine
|
||||||
|
|
33
libstdc++-v3/testsuite/25_algorithms/sort/34095.cc
Normal file
33
libstdc++-v3/testsuite/25_algorithms/sort/34095.cc
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
|
//
|
||||||
|
// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
|
||||||
|
// any later version.
|
||||||
|
|
||||||
|
// This library 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 this library; see the file COPYING. If not, write to the Free
|
||||||
|
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||||
|
// USA.
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
// libstdc++/34095
|
||||||
|
void test01()
|
||||||
|
{
|
||||||
|
std::vector<std::vector<int> > v(20000);
|
||||||
|
std::sort(v.begin(), v.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
test01();
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue