diff mbox series

[2/2] libstdc++: Add dg-require-thread-fence in several tests

Message ID 20230910193045.3549775-2-christophe.lyon@linaro.org
State New
Headers show
Series [1/2] testsuite: Add and use thread_fence effective-target | expand

Commit Message

Christophe Lyon Sept. 10, 2023, 7:30 p.m. UTC
Some targets like arm-eabi with newlib and default settings rely on
__sync_synchronize() to ensure synchronization.  Newlib does not
implement it by default, to make users aware they have to take special
care.

This makes a few tests fail to link.

This patch requires the missing thread-fence effective target in the
tests that need it, making them UNSUPPORTED instead of FAIL and
UNRESOLVED.

2023-09-10  Christophe Lyon  <christophe.lyon@linaro.org>

	libstdc++-v3/
	* testsuite/20_util/to_address/debug.cc: Require thread-fence effective target.
	* testsuite/21_strings/basic_string/cons/char/self_move.cc: Likewise.
	* testsuite/21_strings/basic_string/debug/1_neg.cc: Likewise.
	* testsuite/21_strings/basic_string/debug/2_neg.cc: Likewise.
	* testsuite/21_strings/basic_string/debug/find1_neg.cc: Likewise.
	* testsuite/21_strings/basic_string/debug/find2_neg.cc: Likewise.
	* testsuite/21_strings/basic_string/hash/debug.cc: Likewise.
	* testsuite/21_strings/basic_string/requirements/citerators.cc: Likewise.
	* testsuite/21_strings/basic_string/requirements/exception/basic.cc: Likewise.
	* testsuite/21_strings/basic_string/requirements/exception/generation_prohibited.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/exception/propagation_consistent.cc:
	Likewise.
	* testsuite/21_strings/debug/shrink_to_fit.cc: Likewise.
	* testsuite/23_containers/array/debug/back1_neg.cc: Likewise.
	* testsuite/23_containers/array/debug/back2_neg.cc: Likewise.
	* testsuite/23_containers/array/debug/front1_neg.cc: Likewise.
	* testsuite/23_containers/array/debug/front2_neg.cc: Likewise.
	* testsuite/23_containers/array/debug/square_brackets_operator1_neg.cc: Likewise.
	* testsuite/23_containers/array/debug/square_brackets_operator2_neg.cc: Likewise.
	* testsuite/23_containers/deque/cons/self_move.cc: Likewise.
	* testsuite/23_containers/deque/debug/98466.cc: Likewise.
	* testsuite/23_containers/deque/debug/assign4_neg.cc: Likewise.
	* testsuite/23_containers/deque/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/deque/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/deque/debug/invalidation/1.cc: Likewise.
	* testsuite/23_containers/deque/debug/invalidation/2.cc: Likewise.
	* testsuite/23_containers/deque/debug/invalidation/3.cc: Likewise.
	* testsuite/23_containers/deque/debug/invalidation/4.cc: Likewise.
	* testsuite/23_containers/forward_list/cons/self_move.cc: Likewise.
	* testsuite/23_containers/forward_list/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/debug/move_assign_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/debug/move_neg.cc: Likewise.
	* testsuite/23_containers/list/cons/self_move.cc: Likewise.
	* testsuite/23_containers/list/debug/assign4_neg.cc: Likewise.
	* testsuite/23_containers/list/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/list/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/list/debug/invalidation/1.cc: Likewise.
	* testsuite/23_containers/list/debug/invalidation/2.cc: Likewise.
	* testsuite/23_containers/list/debug/invalidation/3.cc: Likewise.
	* testsuite/23_containers/list/debug/invalidation/4.cc: Likewise.
	* testsuite/23_containers/map/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/map/debug/construct5_neg.cc: Likewise.
	* testsuite/23_containers/map/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/map/debug/invalidation/1.cc: Likewise.
	* testsuite/23_containers/map/debug/invalidation/2.cc: Likewise.
	* testsuite/23_containers/map/debug/move_assign_neg.cc: Likewise.
	* testsuite/23_containers/map/debug/move_neg.cc: Likewise.
	* testsuite/23_containers/map/modifiers/erase/end_neg.cc: Likewise.
	* testsuite/23_containers/map/modifiers/insert/16813.cc: Likewise.
	* testsuite/23_containers/multimap/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/multimap/debug/construct5_neg.cc: Likewise.
	* testsuite/23_containers/multimap/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/multimap/debug/invalidation/1.cc: Likewise.
	* testsuite/23_containers/multimap/debug/invalidation/2.cc: Likewise.
	* testsuite/23_containers/multimap/debug/move_assign_neg.cc: Likewise.
	* testsuite/23_containers/multimap/debug/move_neg.cc: Likewise.
	* testsuite/23_containers/multiset/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/multiset/debug/construct5_neg.cc: Likewise.
	* testsuite/23_containers/multiset/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/multiset/debug/invalidation/1.cc: Likewise.
	* testsuite/23_containers/multiset/debug/invalidation/2.cc: Likewise.
	* testsuite/23_containers/multiset/debug/move_assign_neg.cc: Likewise.
	* testsuite/23_containers/multiset/debug/move_neg.cc: Likewise.
	* testsuite/23_containers/set/cons/self_move.cc: Likewise.
	* testsuite/23_containers/set/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/set/debug/construct5_neg.cc: Likewise.
	* testsuite/23_containers/set/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/set/debug/invalidation/1.cc: Likewise.
	* testsuite/23_containers/set/debug/invalidation/2.cc: Likewise.
	* testsuite/23_containers/set/debug/move_assign_neg.cc: Likewise.
	* testsuite/23_containers/set/debug/move_neg.cc: Likewise.
	* testsuite/23_containers/span/back_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/cons_1_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/cons_2_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/first_2_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/first_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/front_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/index_op_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/last_2_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/last_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/subspan_2_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/subspan_3_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/subspan_4_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/subspan_5_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/subspan_6_assert_neg.cc: Likewise.
	* testsuite/23_containers/span/subspan_assert_neg.cc: Likewise.
	* testsuite/23_containers/unordered_map/debug/98466.cc: Likewise.
	* testsuite/23_containers/unordered_map/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/unordered_map/debug/construct5_neg.cc: Likewise.
	* testsuite/23_containers/unordered_map/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/unordered_map/debug/move_assign_neg.cc: Likewise.
	* testsuite/23_containers/unordered_map/debug/move_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/debug/construct5_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/debug/move_assign_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/debug/move_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/debug/construct5_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/debug/move_assign_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/debug/move_neg.cc: Likewise.
	* testsuite/23_containers/unordered_set/cons/self_move.cc: Likewise.
	* testsuite/23_containers/unordered_set/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/unordered_set/debug/construct5_neg.cc: Likewise.
	* testsuite/23_containers/unordered_set/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/unordered_set/debug/move_assign_neg.cc: Likewise.
	* testsuite/23_containers/unordered_set/debug/move_neg.cc: Likewise.
	* testsuite/23_containers/vector/cons/self_move.cc: Likewise.
	* testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc: Likewise.
	* testsuite/23_containers/vector/debug/assign4_neg.cc: Likewise.
	* testsuite/23_containers/vector/debug/construct4_neg.cc: Likewise.
	* testsuite/23_containers/vector/debug/insert4_neg.cc: Likewise.
	* testsuite/23_containers/vector/debug/insert6_neg.cc: Likewise.
	* testsuite/23_containers/vector/debug/insert7_neg.cc: Likewise.
	* testsuite/23_containers/vector/debug/invalidation/1.cc: Likewise.
	* testsuite/23_containers/vector/debug/invalidation/2.cc: Likewise.
	* testsuite/23_containers/vector/debug/invalidation/3.cc: Likewise.
	* testsuite/23_containers/vector/debug/invalidation/4.cc: Likewise.
	* testsuite/23_containers/vector/debug/move_assign_neg.cc: Likewise.
	* testsuite/23_containers/vector/debug/move_neg.cc: Likewise.
	* testsuite/23_containers/vector/debug/mutex_association.cc: Likewise.
	* testsuite/24_iterators/move_iterator/debug_neg.cc: Likewise.
	* testsuite/24_iterators/normal_iterator/debug_neg.cc: Likewise.
	* testsuite/24_iterators/range_operations/advance_debug_neg.cc: Likewise.
	* testsuite/24_iterators/reverse_iterator/debug_neg.cc: Likewise.
	* testsuite/25_algorithms/binary_search/partitioned.cc: Likewise.
	* testsuite/25_algorithms/copy/86658.cc: Likewise.
	* testsuite/25_algorithms/copy/debug/99402.cc: Likewise.
	* testsuite/25_algorithms/equal_range/partitioned.cc: Likewise.
	* testsuite/25_algorithms/for_each/for_each_n_debug.cc: Likewise.
	* testsuite/25_algorithms/lower_bound/partitioned.cc: Likewise.
	* testsuite/25_algorithms/sample/2.cc: Likewise.
	* testsuite/25_algorithms/upper_bound/partitioned.cc: Likewise.
	* testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/mask-1_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/mask-2_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/mask-3_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/mask-4_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/mask-5_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/mask-6_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/mask-7_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/mask-8_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/mask.cc: Likewise.
	* testsuite/29_atomics/atomic/compare_exchange_padding.cc: Likewise.
	* testsuite/29_atomics/atomic/cons/value_init.cc: Likewise.
	* testsuite/29_atomics/atomic_float/value_init.cc: Likewise.
	* testsuite/29_atomics/atomic_integral/cons/value_init.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/generic.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/integral.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/pointer.cc: Likewise.
	* testsuite/experimental/net/timer/waitable/dest.cc: Likewise.
	* testsuite/experimental/net/timer/waitable/ops.cc: Likewise.
	* testsuite/experimental/polymorphic_allocator/construct_pair.cc: Likewise.
---
 libstdc++-v3/testsuite/20_util/to_address/debug.cc              | 1 +
 .../testsuite/21_strings/basic_string/cons/char/self_move.cc    | 1 +
 libstdc++-v3/testsuite/21_strings/basic_string/debug/1_neg.cc   | 1 +
 libstdc++-v3/testsuite/21_strings/basic_string/debug/2_neg.cc   | 1 +
 .../testsuite/21_strings/basic_string/debug/find1_neg.cc        | 1 +
 .../testsuite/21_strings/basic_string/debug/find2_neg.cc        | 1 +
 libstdc++-v3/testsuite/21_strings/basic_string/hash/debug.cc    | 1 +
 .../21_strings/basic_string/requirements/citerators.cc          | 1 +
 .../21_strings/basic_string/requirements/exception/basic.cc     | 1 +
 .../requirements/exception/generation_prohibited.cc             | 1 +
 .../requirements/exception/propagation_consistent.cc            | 1 +
 libstdc++-v3/testsuite/21_strings/debug/shrink_to_fit.cc        | 1 +
 libstdc++-v3/testsuite/23_containers/array/debug/back1_neg.cc   | 1 +
 libstdc++-v3/testsuite/23_containers/array/debug/back2_neg.cc   | 1 +
 libstdc++-v3/testsuite/23_containers/array/debug/front1_neg.cc  | 1 +
 libstdc++-v3/testsuite/23_containers/array/debug/front2_neg.cc  | 1 +
 .../23_containers/array/debug/square_brackets_operator1_neg.cc  | 1 +
 .../23_containers/array/debug/square_brackets_operator2_neg.cc  | 1 +
 libstdc++-v3/testsuite/23_containers/deque/cons/self_move.cc    | 1 +
 libstdc++-v3/testsuite/23_containers/deque/debug/98466.cc       | 1 +
 libstdc++-v3/testsuite/23_containers/deque/debug/assign4_neg.cc | 1 +
 .../testsuite/23_containers/deque/debug/construct4_neg.cc       | 1 +
 libstdc++-v3/testsuite/23_containers/deque/debug/insert4_neg.cc | 1 +
 .../testsuite/23_containers/deque/debug/invalidation/1.cc       | 2 ++
 .../testsuite/23_containers/deque/debug/invalidation/2.cc       | 2 ++
 .../testsuite/23_containers/deque/debug/invalidation/3.cc       | 2 ++
 .../testsuite/23_containers/deque/debug/invalidation/4.cc       | 2 ++
 .../testsuite/23_containers/forward_list/cons/self_move.cc      | 1 +
 .../23_containers/forward_list/debug/construct4_neg.cc          | 1 +
 .../23_containers/forward_list/debug/move_assign_neg.cc         | 1 +
 .../testsuite/23_containers/forward_list/debug/move_neg.cc      | 1 +
 libstdc++-v3/testsuite/23_containers/list/cons/self_move.cc     | 1 +
 libstdc++-v3/testsuite/23_containers/list/debug/assign4_neg.cc  | 1 +
 .../testsuite/23_containers/list/debug/construct4_neg.cc        | 1 +
 libstdc++-v3/testsuite/23_containers/list/debug/insert4_neg.cc  | 1 +
 .../testsuite/23_containers/list/debug/invalidation/1.cc        | 2 ++
 .../testsuite/23_containers/list/debug/invalidation/2.cc        | 2 ++
 .../testsuite/23_containers/list/debug/invalidation/3.cc        | 2 ++
 .../testsuite/23_containers/list/debug/invalidation/4.cc        | 2 ++
 .../testsuite/23_containers/map/debug/construct4_neg.cc         | 1 +
 .../testsuite/23_containers/map/debug/construct5_neg.cc         | 1 +
 libstdc++-v3/testsuite/23_containers/map/debug/insert4_neg.cc   | 1 +
 .../testsuite/23_containers/map/debug/invalidation/1.cc         | 2 ++
 .../testsuite/23_containers/map/debug/invalidation/2.cc         | 2 ++
 .../testsuite/23_containers/map/debug/move_assign_neg.cc        | 1 +
 libstdc++-v3/testsuite/23_containers/map/debug/move_neg.cc      | 1 +
 .../testsuite/23_containers/map/modifiers/erase/end_neg.cc      | 1 +
 .../testsuite/23_containers/map/modifiers/insert/16813.cc       | 2 ++
 .../testsuite/23_containers/multimap/debug/construct4_neg.cc    | 1 +
 .../testsuite/23_containers/multimap/debug/construct5_neg.cc    | 1 +
 .../testsuite/23_containers/multimap/debug/insert4_neg.cc       | 1 +
 .../testsuite/23_containers/multimap/debug/invalidation/1.cc    | 2 ++
 .../testsuite/23_containers/multimap/debug/invalidation/2.cc    | 2 ++
 .../testsuite/23_containers/multimap/debug/move_assign_neg.cc   | 1 +
 libstdc++-v3/testsuite/23_containers/multimap/debug/move_neg.cc | 1 +
 .../testsuite/23_containers/multiset/debug/construct4_neg.cc    | 1 +
 .../testsuite/23_containers/multiset/debug/construct5_neg.cc    | 2 ++
 .../testsuite/23_containers/multiset/debug/insert4_neg.cc       | 1 +
 .../testsuite/23_containers/multiset/debug/invalidation/1.cc    | 2 ++
 .../testsuite/23_containers/multiset/debug/invalidation/2.cc    | 2 ++
 .../testsuite/23_containers/multiset/debug/move_assign_neg.cc   | 1 +
 libstdc++-v3/testsuite/23_containers/multiset/debug/move_neg.cc | 1 +
 libstdc++-v3/testsuite/23_containers/set/cons/self_move.cc      | 1 +
 .../testsuite/23_containers/set/debug/construct4_neg.cc         | 1 +
 .../testsuite/23_containers/set/debug/construct5_neg.cc         | 1 +
 libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc   | 1 +
 .../testsuite/23_containers/set/debug/invalidation/1.cc         | 2 ++
 .../testsuite/23_containers/set/debug/invalidation/2.cc         | 2 ++
 .../testsuite/23_containers/set/debug/move_assign_neg.cc        | 1 +
 libstdc++-v3/testsuite/23_containers/set/debug/move_neg.cc      | 1 +
 libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc    | 1 +
 libstdc++-v3/testsuite/23_containers/span/cons_1_assert_neg.cc  | 1 +
 libstdc++-v3/testsuite/23_containers/span/cons_2_assert_neg.cc  | 1 +
 libstdc++-v3/testsuite/23_containers/span/first_2_assert_neg.cc | 1 +
 libstdc++-v3/testsuite/23_containers/span/first_assert_neg.cc   | 1 +
 libstdc++-v3/testsuite/23_containers/span/front_assert_neg.cc   | 1 +
 .../testsuite/23_containers/span/index_op_assert_neg.cc         | 1 +
 libstdc++-v3/testsuite/23_containers/span/last_2_assert_neg.cc  | 1 +
 libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc    | 1 +
 .../testsuite/23_containers/span/subspan_2_assert_neg.cc        | 1 +
 .../testsuite/23_containers/span/subspan_3_assert_neg.cc        | 1 +
 .../testsuite/23_containers/span/subspan_4_assert_neg.cc        | 1 +
 .../testsuite/23_containers/span/subspan_5_assert_neg.cc        | 1 +
 .../testsuite/23_containers/span/subspan_6_assert_neg.cc        | 1 +
 libstdc++-v3/testsuite/23_containers/span/subspan_assert_neg.cc | 1 +
 .../testsuite/23_containers/unordered_map/debug/98466.cc        | 1 +
 .../23_containers/unordered_map/debug/construct4_neg.cc         | 1 +
 .../23_containers/unordered_map/debug/construct5_neg.cc         | 1 +
 .../testsuite/23_containers/unordered_map/debug/insert4_neg.cc  | 1 +
 .../23_containers/unordered_map/debug/move_assign_neg.cc        | 1 +
 .../testsuite/23_containers/unordered_map/debug/move_neg.cc     | 1 +
 .../23_containers/unordered_multimap/debug/construct4_neg.cc    | 1 +
 .../23_containers/unordered_multimap/debug/construct5_neg.cc    | 1 +
 .../23_containers/unordered_multimap/debug/insert4_neg.cc       | 1 +
 .../23_containers/unordered_multimap/debug/move_assign_neg.cc   | 1 +
 .../23_containers/unordered_multimap/debug/move_neg.cc          | 1 +
 .../23_containers/unordered_multiset/debug/construct4_neg.cc    | 1 +
 .../23_containers/unordered_multiset/debug/construct5_neg.cc    | 1 +
 .../23_containers/unordered_multiset/debug/insert4_neg.cc       | 1 +
 .../23_containers/unordered_multiset/debug/move_assign_neg.cc   | 1 +
 .../23_containers/unordered_multiset/debug/move_neg.cc          | 1 +
 .../testsuite/23_containers/unordered_set/cons/self_move.cc     | 1 +
 .../23_containers/unordered_set/debug/construct4_neg.cc         | 1 +
 .../23_containers/unordered_set/debug/construct5_neg.cc         | 1 +
 .../testsuite/23_containers/unordered_set/debug/insert4_neg.cc  | 1 +
 .../23_containers/unordered_set/debug/move_assign_neg.cc        | 1 +
 .../testsuite/23_containers/unordered_set/debug/move_neg.cc     | 1 +
 libstdc++-v3/testsuite/23_containers/vector/cons/self_move.cc   | 1 +
 .../23_containers/vector/debug/assign4_backtrace_neg.cc         | 1 +
 .../testsuite/23_containers/vector/debug/assign4_neg.cc         | 1 +
 .../testsuite/23_containers/vector/debug/construct4_neg.cc      | 1 +
 .../testsuite/23_containers/vector/debug/insert4_neg.cc         | 1 +
 .../testsuite/23_containers/vector/debug/insert6_neg.cc         | 1 +
 .../testsuite/23_containers/vector/debug/insert7_neg.cc         | 1 +
 .../testsuite/23_containers/vector/debug/invalidation/1.cc      | 1 +
 .../testsuite/23_containers/vector/debug/invalidation/2.cc      | 1 +
 .../testsuite/23_containers/vector/debug/invalidation/3.cc      | 1 +
 .../testsuite/23_containers/vector/debug/invalidation/4.cc      | 1 +
 .../testsuite/23_containers/vector/debug/move_assign_neg.cc     | 1 +
 libstdc++-v3/testsuite/23_containers/vector/debug/move_neg.cc   | 1 +
 .../testsuite/23_containers/vector/debug/mutex_association.cc   | 1 +
 libstdc++-v3/testsuite/24_iterators/move_iterator/debug_neg.cc  | 2 ++
 .../testsuite/24_iterators/normal_iterator/debug_neg.cc         | 1 +
 .../24_iterators/range_operations/advance_debug_neg.cc          | 1 +
 .../testsuite/24_iterators/reverse_iterator/debug_neg.cc        | 1 +
 .../testsuite/25_algorithms/binary_search/partitioned.cc        | 1 +
 libstdc++-v3/testsuite/25_algorithms/copy/86658.cc              | 1 +
 libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc        | 1 +
 libstdc++-v3/testsuite/25_algorithms/equal_range/partitioned.cc | 1 +
 .../testsuite/25_algorithms/for_each/for_each_n_debug.cc        | 1 +
 libstdc++-v3/testsuite/25_algorithms/lower_bound/partitioned.cc | 1 +
 libstdc++-v3/testsuite/25_algorithms/sample/2.cc                | 1 +
 libstdc++-v3/testsuite/25_algorithms/upper_bound/partitioned.cc | 1 +
 .../testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc       | 1 +
 libstdc++-v3/testsuite/26_numerics/valarray/mask-1_neg.cc       | 1 +
 libstdc++-v3/testsuite/26_numerics/valarray/mask-2_neg.cc       | 1 +
 libstdc++-v3/testsuite/26_numerics/valarray/mask-3_neg.cc       | 1 +
 libstdc++-v3/testsuite/26_numerics/valarray/mask-4_neg.cc       | 1 +
 libstdc++-v3/testsuite/26_numerics/valarray/mask-5_neg.cc       | 1 +
 libstdc++-v3/testsuite/26_numerics/valarray/mask-6_neg.cc       | 1 +
 libstdc++-v3/testsuite/26_numerics/valarray/mask-7_neg.cc       | 1 +
 libstdc++-v3/testsuite/26_numerics/valarray/mask-8_neg.cc       | 1 +
 libstdc++-v3/testsuite/26_numerics/valarray/mask.cc             | 1 +
 .../testsuite/29_atomics/atomic/compare_exchange_padding.cc     | 1 +
 libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc     | 1 +
 libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc    | 1 +
 .../testsuite/29_atomics/atomic_integral/cons/value_init.cc     | 1 +
 .../testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc | 1 +
 libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc         | 1 +
 libstdc++-v3/testsuite/29_atomics/atomic_ref/integral.cc        | 1 +
 libstdc++-v3/testsuite/29_atomics/atomic_ref/pointer.cc         | 1 +
 libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc  | 1 +
 libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc   | 1 +
 .../experimental/polymorphic_allocator/construct_pair.cc        | 1 +
 154 files changed, 173 insertions(+)

Comments

Jonathan Wakely Sept. 11, 2023, 10:59 a.m. UTC | #1
On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
>
> Some targets like arm-eabi with newlib and default settings rely on
> __sync_synchronize() to ensure synchronization.  Newlib does not
> implement it by default, to make users aware they have to take special
> care.
>
> This makes a few tests fail to link.

Does this mean those features are unusable on the target, or just that
users need to provide their own __sync_synchronize to use them?

>
> This patch requires the missing thread-fence effective target in the
> tests that need it, making them UNSUPPORTED instead of FAIL and
> UNRESOLVED.

Some of the modified tests should not be using
__gnu_debug::_Safe_sequence_base::_M_detach_all(), because they don't
use the Debug Mode. I don't know where those linker errors come from.
For example, the 23_containers/span/*assert_neg.cc and
26_numerics/valarray/* tests shouldn't use debug iterators or atomics.
Neither should 25_algorithms/sample/2.cc nor
26_numerics/bit/bit.pow.two/bit_ceil_neg.cc

The last three in the patch shouldn't use it either:

> diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> index cb818708aef..372ed6e0c00 100644
> --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> @@ -18,6 +18,7 @@
>  // { dg-do run { target c++14 } }
>  // { dg-add-options libatomic }
>  // { dg-xfail-if "poll not available" { *-*-rtems* } }
> +// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
>
>  #include <experimental/timer>
>  #include <testsuite_hooks.h>
> diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> index ae51979c3b4..8383e0be6a4 100644
> --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> @@ -18,6 +18,7 @@
>  // { dg-do run { target c++14 } }
>  // { dg-add-options libatomic }
>  // { dg-xfail-if "poll not available" { *-*-rtems* } }
> +// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
>
>  #include <experimental/timer>
>  #include <testsuite_hooks.h>
> diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> index 960c1d253b5..42de45619a8 100644
> --- a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> @@ -16,6 +16,7 @@
>  // <http://www.gnu.org/licenses/>.
>
>  // { dg-do run { target c++14 } }
> +// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
>
>  #include <experimental/memory_resource>
>  #include <utility>


I'm concerned with how much of the testsuite is being completely
disabled for this target.

Any tests with "debug" in the path are probably relying on the debug
mode, and any that use -D_GLIBCXX_DEBUG in dg-options are. And I
suppose it's expected that 29_atomics/* tests rely on atomic
synchronization, but it's unfortunate that those now can't be tested
for arm-eabi, and I don't understand why it only affects eight of the
atomics tests not all the other ones.

Something doesn't seem right here.
Christophe Lyon Sept. 11, 2023, 12:36 p.m. UTC | #2
On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <jwakely@redhat.com> wrote:

> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
> >
> > Some targets like arm-eabi with newlib and default settings rely on
> > __sync_synchronize() to ensure synchronization.  Newlib does not
> > implement it by default, to make users aware they have to take special
> > care.
> >
> > This makes a few tests fail to link.
>
> Does this mean those features are unusable on the target, or just that
> users need to provide their own __sync_synchronize to use them?
>

IIUC the user is expected to provide them.
Looks like we discussed this in the past :-)
In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
see the pointer to Ramana's comment:
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html

The default arch for arm-eabi is armv4t which is very old.
When running the testsuite with something more recent (either as default by
configuring GCC --with-arch=XXX or by forcing -march/-mcpu via
dejagnu's target-board), the compiler generates barrier instructions and
there are no such errors.

For instance, here is a log with the defaults:
https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
and a log when we target cortex-m0 which is still a very small cpu but has
barriers:
https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi

I somehow wanted to get rid of such errors with the default
configuration....


> >
> > This patch requires the missing thread-fence effective target in the
> > tests that need it, making them UNSUPPORTED instead of FAIL and
> > UNRESOLVED.
>
> Some of the modified tests should not be using
> __gnu_debug::_Safe_sequence_base::_M_detach_all(), because they don't
> use the Debug Mode. I don't know where those linker errors come from.
> For example, the 23_containers/span/*assert_neg.cc and
> 26_numerics/valarray/* tests shouldn't use debug iterators or atomics.
> Neither should 25_algorithms/sample/2.cc nor
> 26_numerics/bit/bit.pow.two/bit_ceil_neg.cc
>

Ouch!  I had the feeling this patch wouldn't count as obvious :-)

I confess I didn't analyze the linker map for every single test updated by
this patch....
I can have a deeper look based on your comment below, excluding those that
look "OK"


> The last three in the patch shouldn't use it either:
>
> > diff --git
> a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> > index cb818708aef..372ed6e0c00 100644
> > --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> > +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> > @@ -18,6 +18,7 @@
> >  // { dg-do run { target c++14 } }
> >  // { dg-add-options libatomic }
> >  // { dg-xfail-if "poll not available" { *-*-rtems* } }
> > +// { dg-require-thread-fence "" } // needed by
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
> >
> >  #include <experimental/timer>
> >  #include <testsuite_hooks.h>
> > diff --git
> a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> > index ae51979c3b4..8383e0be6a4 100644
> > --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> > +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> > @@ -18,6 +18,7 @@
> >  // { dg-do run { target c++14 } }
> >  // { dg-add-options libatomic }
> >  // { dg-xfail-if "poll not available" { *-*-rtems* } }
> > +// { dg-require-thread-fence "" } // needed by
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
> >
> >  #include <experimental/timer>
> >  #include <testsuite_hooks.h>
> > diff --git
> a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> > index 960c1d253b5..42de45619a8 100644
> > ---
> a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> > +++
> b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> > @@ -16,6 +16,7 @@
> >  // <http://www.gnu.org/licenses/>.
> >
> >  // { dg-do run { target c++14 } }
> > +// { dg-require-thread-fence "" } // needed by
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
> >
> >  #include <experimental/memory_resource>
> >  #include <utility>
>
>
> I'm concerned with how much of the testsuite is being completely
> disabled for this target.
>
I think that depends on which "flavour" of arm-eabi we are looking at.
I'm trying to cleanup some of the "obvious" failures, and that proves to be
tedious:
- quite a few gcc/g++ tests have problems when overriding -mcpu/-march with
dejagnu's target-board
- so I thought a first step could be to clean the default configuration,
but as said above it targets a very old architecture


>
> Any tests with "debug" in the path are probably relying on the debug
> mode, and any that use -D_GLIBCXX_DEBUG in dg-options are. And I
> suppose it's expected that 29_atomics/* tests rely on atomic
> synchronization, but it's unfortunate that those now can't be tested
> for arm-eabi, and I don't understand why it only affects eight of the
>
that's only the "default" arm-eabi, it does not happen in other non-default
arm-eabi (well I didn't check all possible cases)


> atomics tests not all the other ones.
>
> Something doesn't seem right here.
>
>
Thanks,

Christophe
Jonathan Wakely Sept. 11, 2023, 1:10 p.m. UTC | #3
On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
>
>
>
> On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <jwakely@redhat.com> wrote:
>>
>> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
>> <christophe.lyon@linaro.org> wrote:
>> >
>> > Some targets like arm-eabi with newlib and default settings rely on
>> > __sync_synchronize() to ensure synchronization.  Newlib does not
>> > implement it by default, to make users aware they have to take special
>> > care.
>> >
>> > This makes a few tests fail to link.
>>
>> Does this mean those features are unusable on the target, or just that
>> users need to provide their own __sync_synchronize to use them?
>
>
> IIUC the user is expected to provide them.
> Looks like we discussed this in the past :-)
> In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
> see the pointer to Ramana's comment: https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html

Oh yes, thanks for the reminder!

>
> The default arch for arm-eabi is armv4t which is very old.
> When running the testsuite with something more recent (either as default by configuring GCC --with-arch=XXX or by forcing -march/-mcpu via dejagnu's target-board), the compiler generates barrier instructions and there are no such errors.

Ah yes, that's fine then.

> For instance, here is a log with the defaults:
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
> and a log when we target cortex-m0 which is still a very small cpu but has barriers:
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
>
> I somehow wanted to get rid of such errors with the default configuration....

Yep, that makes sense, and we'll still be testing them for newer
arches on the target, so it's not completely disabling those parts of
the testsuite.

But I'm still curious why some of those tests need this change. I
think the ones I noted below are probably failing for some other
reasons.

>
>>
>> >
>> > This patch requires the missing thread-fence effective target in the
>> > tests that need it, making them UNSUPPORTED instead of FAIL and
>> > UNRESOLVED.
>>
>> Some of the modified tests should not be using
>> __gnu_debug::_Safe_sequence_base::_M_detach_all(), because they don't
>> use the Debug Mode. I don't know where those linker errors come from.
>> For example, the 23_containers/span/*assert_neg.cc and
>> 26_numerics/valarray/* tests shouldn't use debug iterators or atomics.
>> Neither should 25_algorithms/sample/2.cc nor
>> 26_numerics/bit/bit.pow.two/bit_ceil_neg.cc
>
>
> Ouch!  I had the feeling this patch wouldn't count as obvious :-)
>
> I confess I didn't analyze the linker map for every single test updated by this patch....
> I can have a deeper look based on your comment below, excluding those that look "OK"
>
>>
>> The last three in the patch shouldn't use it either:
>>
>> > diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
>> > index cb818708aef..372ed6e0c00 100644
>> > --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
>> > +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
>> > @@ -18,6 +18,7 @@
>> >  // { dg-do run { target c++14 } }
>> >  // { dg-add-options libatomic }
>> >  // { dg-xfail-if "poll not available" { *-*-rtems* } }
>> > +// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
>> >
>> >  #include <experimental/timer>
>> >  #include <testsuite_hooks.h>
>> > diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
>> > index ae51979c3b4..8383e0be6a4 100644
>> > --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
>> > +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
>> > @@ -18,6 +18,7 @@
>> >  // { dg-do run { target c++14 } }
>> >  // { dg-add-options libatomic }
>> >  // { dg-xfail-if "poll not available" { *-*-rtems* } }
>> > +// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
>> >
>> >  #include <experimental/timer>
>> >  #include <testsuite_hooks.h>
>> > diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
>> > index 960c1d253b5..42de45619a8 100644
>> > --- a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
>> > +++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
>> > @@ -16,6 +16,7 @@
>> >  // <http://www.gnu.org/licenses/>.
>> >
>> >  // { dg-do run { target c++14 } }
>> > +// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
>> >
>> >  #include <experimental/memory_resource>
>> >  #include <utility>
>>
>>
>> I'm concerned with how much of the testsuite is being completely
>> disabled for this target.
>
> I think that depends on which "flavour" of arm-eabi we are looking at.
> I'm trying to cleanup some of the "obvious" failures, and that proves to be tedious:
> - quite a few gcc/g++ tests have problems when overriding -mcpu/-march with dejagnu's target-board
> - so I thought a first step could be to clean the default configuration, but as said above it targets a very old architecture
>
>>
>>
>> Any tests with "debug" in the path are probably relying on the debug
>> mode, and any that use -D_GLIBCXX_DEBUG in dg-options are. And I
>> suppose it's expected that 29_atomics/* tests rely on atomic
>> synchronization, but it's unfortunate that those now can't be tested
>> for arm-eabi, and I don't understand why it only affects eight of the
>
> that's only the "default" arm-eabi, it does not happen in other non-default arm-eabi (well I didn't check all possible cases)
>
>>
>> atomics tests not all the other ones.
>>
>> Something doesn't seem right here.
>>
>
> Thanks,
>
> Christophe
>
Christophe Lyon Sept. 11, 2023, 1:57 p.m. UTC | #4
On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely <jwakely@redhat.com> wrote:

> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
> >
> >
> >
> > On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >>
> >> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
> >> <christophe.lyon@linaro.org> wrote:
> >> >
> >> > Some targets like arm-eabi with newlib and default settings rely on
> >> > __sync_synchronize() to ensure synchronization.  Newlib does not
> >> > implement it by default, to make users aware they have to take special
> >> > care.
> >> >
> >> > This makes a few tests fail to link.
> >>
> >> Does this mean those features are unusable on the target, or just that
> >> users need to provide their own __sync_synchronize to use them?
> >
> >
> > IIUC the user is expected to provide them.
> > Looks like we discussed this in the past :-)
> > In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
> > see the pointer to Ramana's comment:
> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
>
> Oh yes, thanks for the reminder!
>
> >
> > The default arch for arm-eabi is armv4t which is very old.
> > When running the testsuite with something more recent (either as default
> by configuring GCC --with-arch=XXX or by forcing -march/-mcpu via dejagnu's
> target-board), the compiler generates barrier instructions and there are no
> such errors.
>
> Ah yes, that's fine then.
>
> > For instance, here is a log with the defaults:
> >
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
> > and a log when we target cortex-m0 which is still a very small cpu but
> has barriers:
> >
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
> >
> > I somehow wanted to get rid of such errors with the default
> configuration....
>
> Yep, that makes sense, and we'll still be testing them for newer
> arches on the target, so it's not completely disabling those parts of
> the testsuite.
>
> But I'm still curious why some of those tests need this change. I
> think the ones I noted below are probably failing for some other
> reasons.
>
> Just looked at  23_containers/span/back_assert_neg.cc, the linker says it
needs
arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
./back_assert_neg-back_assert_neg.o (std::__glibcxx_assert_fail(char
const*, int, char const*, char const*))
and indeed debug.o has a reference to __sync_synchronize




>
> >>
> >> >
> >> > This patch requires the missing thread-fence effective target in the
> >> > tests that need it, making them UNSUPPORTED instead of FAIL and
> >> > UNRESOLVED.
> >>
> >> Some of the modified tests should not be using
> >> __gnu_debug::_Safe_sequence_base::_M_detach_all(), because they don't
> >> use the Debug Mode. I don't know where those linker errors come from.
> >> For example, the 23_containers/span/*assert_neg.cc and
> >> 26_numerics/valarray/* tests shouldn't use debug iterators or atomics.
> >> Neither should 25_algorithms/sample/2.cc nor
> >> 26_numerics/bit/bit.pow.two/bit_ceil_neg.cc
> >
> >
> > Ouch!  I had the feeling this patch wouldn't count as obvious :-)
> >
> > I confess I didn't analyze the linker map for every single test updated
> by this patch....
> > I can have a deeper look based on your comment below, excluding those
> that look "OK"
> >
> >>
> >> The last three in the patch shouldn't use it either:
> >>
> >> > diff --git
> a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> >> > index cb818708aef..372ed6e0c00 100644
> >> > --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> >> > +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> >> > @@ -18,6 +18,7 @@
> >> >  // { dg-do run { target c++14 } }
> >> >  // { dg-add-options libatomic }
> >> >  // { dg-xfail-if "poll not available" { *-*-rtems* } }
> >> > +// { dg-require-thread-fence "" } // needed by
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
> >> >
> >> >  #include <experimental/timer>
> >> >  #include <testsuite_hooks.h>
> >> > diff --git
> a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> >> > index ae51979c3b4..8383e0be6a4 100644
> >> > --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> >> > +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> >> > @@ -18,6 +18,7 @@
> >> >  // { dg-do run { target c++14 } }
> >> >  // { dg-add-options libatomic }
> >> >  // { dg-xfail-if "poll not available" { *-*-rtems* } }
> >> > +// { dg-require-thread-fence "" } // needed by
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
> >> >
> >> >  #include <experimental/timer>
> >> >  #include <testsuite_hooks.h>
> >> > diff --git
> a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> >> > index 960c1d253b5..42de45619a8 100644
> >> > ---
> a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> >> > +++
> b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> >> > @@ -16,6 +16,7 @@
> >> >  // <http://www.gnu.org/licenses/>.
> >> >
> >> >  // { dg-do run { target c++14 } }
> >> > +// { dg-require-thread-fence "" } // needed by
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
> >> >
> >> >  #include <experimental/memory_resource>
> >> >  #include <utility>
> >>
> >>
> >> I'm concerned with how much of the testsuite is being completely
> >> disabled for this target.
> >
> > I think that depends on which "flavour" of arm-eabi we are looking at.
> > I'm trying to cleanup some of the "obvious" failures, and that proves to
> be tedious:
> > - quite a few gcc/g++ tests have problems when overriding -mcpu/-march
> with dejagnu's target-board
> > - so I thought a first step could be to clean the default configuration,
> but as said above it targets a very old architecture
> >
> >>
> >>
> >> Any tests with "debug" in the path are probably relying on the debug
> >> mode, and any that use -D_GLIBCXX_DEBUG in dg-options are. And I
> >> suppose it's expected that 29_atomics/* tests rely on atomic
> >> synchronization, but it's unfortunate that those now can't be tested
> >> for arm-eabi, and I don't understand why it only affects eight of the
> >
> > that's only the "default" arm-eabi, it does not happen in other
> non-default arm-eabi (well I didn't check all possible cases)
> >
> >>
> >> atomics tests not all the other ones.
> >>
> >> Something doesn't seem right here.
> >>
> >
> > Thanks,
> >
> > Christophe
> >
>
>
Jonathan Wakely Sept. 11, 2023, 3:22 p.m. UTC | #5
On Mon, 11 Sept 2023 at 14:57, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
>
>
>
> On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely <jwakely@redhat.com> wrote:
>>
>> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
>> <christophe.lyon@linaro.org> wrote:
>> >
>> >
>> >
>> > On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <jwakely@redhat.com> wrote:
>> >>
>> >> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
>> >> <christophe.lyon@linaro.org> wrote:
>> >> >
>> >> > Some targets like arm-eabi with newlib and default settings rely on
>> >> > __sync_synchronize() to ensure synchronization.  Newlib does not
>> >> > implement it by default, to make users aware they have to take special
>> >> > care.
>> >> >
>> >> > This makes a few tests fail to link.
>> >>
>> >> Does this mean those features are unusable on the target, or just that
>> >> users need to provide their own __sync_synchronize to use them?
>> >
>> >
>> > IIUC the user is expected to provide them.
>> > Looks like we discussed this in the past :-)
>> > In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
>> > see the pointer to Ramana's comment: https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
>>
>> Oh yes, thanks for the reminder!
>>
>> >
>> > The default arch for arm-eabi is armv4t which is very old.
>> > When running the testsuite with something more recent (either as default by configuring GCC --with-arch=XXX or by forcing -march/-mcpu via dejagnu's target-board), the compiler generates barrier instructions and there are no such errors.
>>
>> Ah yes, that's fine then.
>>
>> > For instance, here is a log with the defaults:
>> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
>> > and a log when we target cortex-m0 which is still a very small cpu but has barriers:
>> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
>> >
>> > I somehow wanted to get rid of such errors with the default configuration....
>>
>> Yep, that makes sense, and we'll still be testing them for newer
>> arches on the target, so it's not completely disabling those parts of
>> the testsuite.
>>
>> But I'm still curious why some of those tests need this change. I
>> think the ones I noted below are probably failing for some other
>> reasons.
>>
> Just looked at  23_containers/span/back_assert_neg.cc, the linker says it needs
> arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
> ./back_assert_neg-back_assert_neg.o (std::__glibcxx_assert_fail(char const*, int, char const*, char const*))
> and indeed debug.o has a reference to __sync_synchronize

Aha, that's just because I put __glibcxx_assert_fail in debug.o, but
there are no dependencies on anything else in that file, including the
_M_detach member function that uses atomics.

This would also be solved by -Wl,--gc-sections :-)

I think it would be better to move __glibcxx_assert_fail to a new
file, so that it doesn't make every assertion unnecessarily depend on
__sync_synchronize. I'll do that now.

We could also make the atomics in debug.o conditional, so that debug
mode doesn't depend on __sync_synchronize for single-threaded targets.
Does the arm4t arch have pthreads support in newlib?  I didn't bother
making the use of atomics conditional, because performance is not
really a priority for debug mode bookkeeping. But the problem here
isn't just a slight performance overhead of atomics, it's that they
aren't even supported for arm4t.
Richard Earnshaw (lists) Sept. 11, 2023, 3:27 p.m. UTC | #6
On 11/09/2023 16:22, Jonathan Wakely via Gcc-patches wrote:
> On Mon, 11 Sept 2023 at 14:57, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
>>
>>
>>
>> On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely <jwakely@redhat.com> wrote:
>>>
>>> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
>>> <christophe.lyon@linaro.org> wrote:
>>>>
>>>>
>>>>
>>>> On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <jwakely@redhat.com> wrote:
>>>>>
>>>>> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
>>>>> <christophe.lyon@linaro.org> wrote:
>>>>>>
>>>>>> Some targets like arm-eabi with newlib and default settings rely on
>>>>>> __sync_synchronize() to ensure synchronization.  Newlib does not
>>>>>> implement it by default, to make users aware they have to take special
>>>>>> care.
>>>>>>
>>>>>> This makes a few tests fail to link.
>>>>>
>>>>> Does this mean those features are unusable on the target, or just that
>>>>> users need to provide their own __sync_synchronize to use them?
>>>>
>>>>
>>>> IIUC the user is expected to provide them.
>>>> Looks like we discussed this in the past :-)
>>>> In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
>>>> see the pointer to Ramana's comment: https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
>>>
>>> Oh yes, thanks for the reminder!
>>>
>>>>
>>>> The default arch for arm-eabi is armv4t which is very old.
>>>> When running the testsuite with something more recent (either as default by configuring GCC --with-arch=XXX or by forcing -march/-mcpu via dejagnu's target-board), the compiler generates barrier instructions and there are no such errors.
>>>
>>> Ah yes, that's fine then.
>>>
>>>> For instance, here is a log with the defaults:
>>>> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
>>>> and a log when we target cortex-m0 which is still a very small cpu but has barriers:
>>>> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
>>>>
>>>> I somehow wanted to get rid of such errors with the default configuration....
>>>
>>> Yep, that makes sense, and we'll still be testing them for newer
>>> arches on the target, so it's not completely disabling those parts of
>>> the testsuite.
>>>
>>> But I'm still curious why some of those tests need this change. I
>>> think the ones I noted below are probably failing for some other
>>> reasons.
>>>
>> Just looked at  23_containers/span/back_assert_neg.cc, the linker says it needs
>> arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
>> ./back_assert_neg-back_assert_neg.o (std::__glibcxx_assert_fail(char const*, int, char const*, char const*))
>> and indeed debug.o has a reference to __sync_synchronize
> 
> Aha, that's just because I put __glibcxx_assert_fail in debug.o, but
> there are no dependencies on anything else in that file, including the
> _M_detach member function that uses atomics.
> 
> This would also be solved by -Wl,--gc-sections :-)
> 
> I think it would be better to move __glibcxx_assert_fail to a new
> file, so that it doesn't make every assertion unnecessarily depend on
> __sync_synchronize. I'll do that now.
> 
> We could also make the atomics in debug.o conditional, so that debug
> mode doesn't depend on __sync_synchronize for single-threaded targets.
> Does the arm4t arch have pthreads support in newlib?  I didn't bother
> making the use of atomics conditional, because performance is not
> really a priority for debug mode bookkeeping. But the problem here
> isn't just a slight performance overhead of atomics, it's that they
> aren't even supported for arm4t.

I might be wrong, but I don't think newlib has any support for pthreads.

R.
>
Christophe Lyon Sept. 11, 2023, 3:39 p.m. UTC | #7
On Mon, 11 Sept 2023 at 17:22, Jonathan Wakely <jwakely@redhat.com> wrote:

> On Mon, 11 Sept 2023 at 14:57, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
> >
> >
> >
> > On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >>
> >> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
> >> <christophe.lyon@linaro.org> wrote:
> >> >
> >> >
> >> >
> >> > On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >> >>
> >> >> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
> >> >> <christophe.lyon@linaro.org> wrote:
> >> >> >
> >> >> > Some targets like arm-eabi with newlib and default settings rely on
> >> >> > __sync_synchronize() to ensure synchronization.  Newlib does not
> >> >> > implement it by default, to make users aware they have to take
> special
> >> >> > care.
> >> >> >
> >> >> > This makes a few tests fail to link.
> >> >>
> >> >> Does this mean those features are unusable on the target, or just
> that
> >> >> users need to provide their own __sync_synchronize to use them?
> >> >
> >> >
> >> > IIUC the user is expected to provide them.
> >> > Looks like we discussed this in the past :-)
> >> > In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
> >> > see the pointer to Ramana's comment:
> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
> >>
> >> Oh yes, thanks for the reminder!
> >>
> >> >
> >> > The default arch for arm-eabi is armv4t which is very old.
> >> > When running the testsuite with something more recent (either as
> default by configuring GCC --with-arch=XXX or by forcing -march/-mcpu via
> dejagnu's target-board), the compiler generates barrier instructions and
> there are no such errors.
> >>
> >> Ah yes, that's fine then.
> >>
> >> > For instance, here is a log with the defaults:
> >> >
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
> >> > and a log when we target cortex-m0 which is still a very small cpu
> but has barriers:
> >> >
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
> >> >
> >> > I somehow wanted to get rid of such errors with the default
> configuration....
> >>
> >> Yep, that makes sense, and we'll still be testing them for newer
> >> arches on the target, so it's not completely disabling those parts of
> >> the testsuite.
> >>
> >> But I'm still curious why some of those tests need this change. I
> >> think the ones I noted below are probably failing for some other
> >> reasons.
> >>
> > Just looked at  23_containers/span/back_assert_neg.cc, the linker says
> it needs
> > arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
> > ./back_assert_neg-back_assert_neg.o (std::__glibcxx_assert_fail(char
> const*, int, char const*, char const*))
> > and indeed debug.o has a reference to __sync_synchronize
>
> Aha, that's just because I put __glibcxx_assert_fail in debug.o, but
> there are no dependencies on anything else in that file, including the
> _M_detach member function that uses atomics.
>
indeed



> This would also be solved by -Wl,--gc-sections :-)
>
:-)


> I think it would be better to move __glibcxx_assert_fail to a new
> file, so that it doesn't make every assertion unnecessarily depend on
> __sync_synchronize. I'll do that now.
>
Sounds like a good idea, thanks.


> We could also make the atomics in debug.o conditional, so that debug
> mode doesn't depend on __sync_synchronize for single-threaded targets.
> Does the arm4t arch have pthreads support in newlib?  I didn't bother
>
No ( grep _GLIBCXX_HAS_GTHREADS
$objdir/arm-eabi/libstdc++-v3/include/arm-eabi/bits/c++config returns:
/* #undef _GLIBCXX_HAS_GTHREADS */

making the use of atomics conditional, because performance is not
> really a priority for debug mode bookkeeping. But the problem here
> isn't just a slight performance overhead of atomics, it's that they
> aren't even supported for arm4t.
>
OK thanks.

So finally, this uncovered at least a "bug" that  __glibcxx_assert_fail
should be in a dedicated object file :-)

I'll revisit my patch once you have moved __glibcxx_assert_fail

Thanks,

Christophe
Jonathan Wakely Sept. 11, 2023, 4:11 p.m. UTC | #8
On Mon, 11 Sept 2023 at 16:40, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
>
>
>
> On Mon, 11 Sept 2023 at 17:22, Jonathan Wakely <jwakely@redhat.com> wrote:
>>
>> On Mon, 11 Sept 2023 at 14:57, Christophe Lyon
>> <christophe.lyon@linaro.org> wrote:
>> >
>> >
>> >
>> > On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely <jwakely@redhat.com> wrote:
>> >>
>> >> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
>> >> <christophe.lyon@linaro.org> wrote:
>> >> >
>> >> >
>> >> >
>> >> > On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <jwakely@redhat.com> wrote:
>> >> >>
>> >> >> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
>> >> >> <christophe.lyon@linaro.org> wrote:
>> >> >> >
>> >> >> > Some targets like arm-eabi with newlib and default settings rely on
>> >> >> > __sync_synchronize() to ensure synchronization.  Newlib does not
>> >> >> > implement it by default, to make users aware they have to take special
>> >> >> > care.
>> >> >> >
>> >> >> > This makes a few tests fail to link.
>> >> >>
>> >> >> Does this mean those features are unusable on the target, or just that
>> >> >> users need to provide their own __sync_synchronize to use them?
>> >> >
>> >> >
>> >> > IIUC the user is expected to provide them.
>> >> > Looks like we discussed this in the past :-)
>> >> > In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
>> >> > see the pointer to Ramana's comment: https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
>> >>
>> >> Oh yes, thanks for the reminder!
>> >>
>> >> >
>> >> > The default arch for arm-eabi is armv4t which is very old.
>> >> > When running the testsuite with something more recent (either as default by configuring GCC --with-arch=XXX or by forcing -march/-mcpu via dejagnu's target-board), the compiler generates barrier instructions and there are no such errors.
>> >>
>> >> Ah yes, that's fine then.
>> >>
>> >> > For instance, here is a log with the defaults:
>> >> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
>> >> > and a log when we target cortex-m0 which is still a very small cpu but has barriers:
>> >> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
>> >> >
>> >> > I somehow wanted to get rid of such errors with the default configuration....
>> >>
>> >> Yep, that makes sense, and we'll still be testing them for newer
>> >> arches on the target, so it's not completely disabling those parts of
>> >> the testsuite.
>> >>
>> >> But I'm still curious why some of those tests need this change. I
>> >> think the ones I noted below are probably failing for some other
>> >> reasons.
>> >>
>> > Just looked at  23_containers/span/back_assert_neg.cc, the linker says it needs
>> > arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
>> > ./back_assert_neg-back_assert_neg.o (std::__glibcxx_assert_fail(char const*, int, char const*, char const*))
>> > and indeed debug.o has a reference to __sync_synchronize
>>
>> Aha, that's just because I put __glibcxx_assert_fail in debug.o, but
>> there are no dependencies on anything else in that file, including the
>> _M_detach member function that uses atomics.
>
> indeed
>
>
>>
>> This would also be solved by -Wl,--gc-sections :-)
>
> :-)
>
>>
>> I think it would be better to move __glibcxx_assert_fail to a new
>> file, so that it doesn't make every assertion unnecessarily depend on
>> __sync_synchronize. I'll do that now.
>
> Sounds like a good idea, thanks.

Done now at r14-3846-g4a2766ed00a479
>
>>
>> We could also make the atomics in debug.o conditional, so that debug
>> mode doesn't depend on __sync_synchronize for single-threaded targets.
>> Does the arm4t arch have pthreads support in newlib?  I didn't bother
>
> No ( grep _GLIBCXX_HAS_GTHREADS $objdir/arm-eabi/libstdc++-v3/include/arm-eabi/bits/c++config returns:
> /* #undef _GLIBCXX_HAS_GTHREADS */
>
>> making the use of atomics conditional, because performance is not
>> really a priority for debug mode bookkeeping. But the problem here
>> isn't just a slight performance overhead of atomics, it's that they
>> aren't even supported for arm4t.
>
> OK thanks.
>
> So finally, this uncovered at least a "bug" that  __glibcxx_assert_fail should be in a dedicated object file :-)
>
> I'll revisit my patch once you have moved __glibcxx_assert_fail

That's done (at r14-3845-gc7db9000fa7cac) and there should be no more
__sync_synchronize from src/c++11/debug.o at all now (at
r14-3846-g4a2766ed00a479). With that second change, it would have been
OK for __glibcxx_assert_fail to stay in that file, but it's not really
related so it's probably better for it to be in a separate file
anyway.

That should remove the need for most of your patch!
Christophe Lyon Sept. 12, 2023, 7:59 a.m. UTC | #9
On Mon, 11 Sept 2023 at 18:11, Jonathan Wakely <jwakely@redhat.com> wrote:

> On Mon, 11 Sept 2023 at 16:40, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
> >
> >
> >
> > On Mon, 11 Sept 2023 at 17:22, Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >>
> >> On Mon, 11 Sept 2023 at 14:57, Christophe Lyon
> >> <christophe.lyon@linaro.org> wrote:
> >> >
> >> >
> >> >
> >> > On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >> >>
> >> >> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
> >> >> <christophe.lyon@linaro.org> wrote:
> >> >> >
> >> >> >
> >> >> >
> >> >> > On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >> >> >>
> >> >> >> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
> >> >> >> <christophe.lyon@linaro.org> wrote:
> >> >> >> >
> >> >> >> > Some targets like arm-eabi with newlib and default settings
> rely on
> >> >> >> > __sync_synchronize() to ensure synchronization.  Newlib does not
> >> >> >> > implement it by default, to make users aware they have to take
> special
> >> >> >> > care.
> >> >> >> >
> >> >> >> > This makes a few tests fail to link.
> >> >> >>
> >> >> >> Does this mean those features are unusable on the target, or just
> that
> >> >> >> users need to provide their own __sync_synchronize to use them?
> >> >> >
> >> >> >
> >> >> > IIUC the user is expected to provide them.
> >> >> > Looks like we discussed this in the past :-)
> >> >> > In
> https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
> >> >> > see the pointer to Ramana's comment:
> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
> >> >>
> >> >> Oh yes, thanks for the reminder!
> >> >>
> >> >> >
> >> >> > The default arch for arm-eabi is armv4t which is very old.
> >> >> > When running the testsuite with something more recent (either as
> default by configuring GCC --with-arch=XXX or by forcing -march/-mcpu via
> dejagnu's target-board), the compiler generates barrier instructions and
> there are no such errors.
> >> >>
> >> >> Ah yes, that's fine then.
> >> >>
> >> >> > For instance, here is a log with the defaults:
> >> >> >
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
> >> >> > and a log when we target cortex-m0 which is still a very small cpu
> but has barriers:
> >> >> >
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
> >> >> >
> >> >> > I somehow wanted to get rid of such errors with the default
> configuration....
> >> >>
> >> >> Yep, that makes sense, and we'll still be testing them for newer
> >> >> arches on the target, so it's not completely disabling those parts of
> >> >> the testsuite.
> >> >>
> >> >> But I'm still curious why some of those tests need this change. I
> >> >> think the ones I noted below are probably failing for some other
> >> >> reasons.
> >> >>
> >> > Just looked at  23_containers/span/back_assert_neg.cc, the linker
> says it needs
> >> > arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
> >> > ./back_assert_neg-back_assert_neg.o (std::__glibcxx_assert_fail(char
> const*, int, char const*, char const*))
> >> > and indeed debug.o has a reference to __sync_synchronize
> >>
> >> Aha, that's just because I put __glibcxx_assert_fail in debug.o, but
> >> there are no dependencies on anything else in that file, including the
> >> _M_detach member function that uses atomics.
> >
> > indeed
> >
> >
> >>
> >> This would also be solved by -Wl,--gc-sections :-)
> >
> > :-)
> >
> >>
> >> I think it would be better to move __glibcxx_assert_fail to a new
> >> file, so that it doesn't make every assertion unnecessarily depend on
> >> __sync_synchronize. I'll do that now.
> >
> > Sounds like a good idea, thanks.
>
> Done now at r14-3846-g4a2766ed00a479
> >
> >>
> >> We could also make the atomics in debug.o conditional, so that debug
> >> mode doesn't depend on __sync_synchronize for single-threaded targets.
> >> Does the arm4t arch have pthreads support in newlib?  I didn't bother
> >
> > No ( grep _GLIBCXX_HAS_GTHREADS
> $objdir/arm-eabi/libstdc++-v3/include/arm-eabi/bits/c++config returns:
> > /* #undef _GLIBCXX_HAS_GTHREADS */
> >
> >> making the use of atomics conditional, because performance is not
> >> really a priority for debug mode bookkeeping. But the problem here
> >> isn't just a slight performance overhead of atomics, it's that they
> >> aren't even supported for arm4t.
> >
> > OK thanks.
> >
> > So finally, this uncovered at least a "bug" that  __glibcxx_assert_fail
> should be in a dedicated object file :-)
> >
> > I'll revisit my patch once you have moved __glibcxx_assert_fail
>
> That's done (at r14-3845-gc7db9000fa7cac) and there should be no more
> __sync_synchronize from src/c++11/debug.o at all now (at
> r14-3846-g4a2766ed00a479). With that second change, it would have been
> OK for __glibcxx_assert_fail to stay in that file, but it's not really
> related so it's probably better for it to be in a separate file
> anyway.
>
> That should remove the need for most of your patch!
>
>
Hi!

I've looked at the remaining undefined references to __sync_synchronize
after your commits:
29_atomics/atomic/compare_exchange_padding.cc   (from a.load())
29_atomics/atomic/cons/value_init.cc   (from a.load())
29_atomics/atomic_float/value_init.cc   (from a.load())
29_atomics/atomic_float/1.cc no problem (is_always_lock_free is false?)
29_atomics/atomic_integral/cons/value_init.cc   (from a.load())
29_atomics/atomic_ref/compare_exchange_padding.cc (from a.store())
29_atomics/atomic_ref/generic.cc
29_atomics/atomic_ref/integral.cc
29_atomics/atomic_ref/pointer.cc
experimental/net/timer/waitable/dest.cc (from
_ZNSt12experimental3net2v110io_context9_M_do_oneENSt6chrono8durationIxSt5ratioILx1ELx1000EEEE)
experimental/net/timer/waitable/ops.cc not sure why?
experimental/polymorphic_allocator/construct_pair.cc (from load, line 835
of atomic_base.h)

I've noticed several undefined references
to __glibcxx_backtrace_create_state too
19_diagnostics/stacktrace/current.cc
19_diagnostics/stacktrace/entry.cc
19_diagnostics/stacktrace/stacktrace.cc
[...]

Thanks,

Christophe
Jonathan Wakely Sept. 12, 2023, 9:07 a.m. UTC | #10
On Tue, 12 Sept 2023 at 08:59, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
>
>
>
> On Mon, 11 Sept 2023 at 18:11, Jonathan Wakely <jwakely@redhat.com> wrote:
>>
>> On Mon, 11 Sept 2023 at 16:40, Christophe Lyon
>> <christophe.lyon@linaro.org> wrote:
>> >
>> >
>> >
>> > On Mon, 11 Sept 2023 at 17:22, Jonathan Wakely <jwakely@redhat.com> wrote:
>> >>
>> >> On Mon, 11 Sept 2023 at 14:57, Christophe Lyon
>> >> <christophe.lyon@linaro.org> wrote:
>> >> >
>> >> >
>> >> >
>> >> > On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely <jwakely@redhat.com> wrote:
>> >> >>
>> >> >> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
>> >> >> <christophe.lyon@linaro.org> wrote:
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <jwakely@redhat.com> wrote:
>> >> >> >>
>> >> >> >> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
>> >> >> >> <christophe.lyon@linaro.org> wrote:
>> >> >> >> >
>> >> >> >> > Some targets like arm-eabi with newlib and default settings rely on
>> >> >> >> > __sync_synchronize() to ensure synchronization.  Newlib does not
>> >> >> >> > implement it by default, to make users aware they have to take special
>> >> >> >> > care.
>> >> >> >> >
>> >> >> >> > This makes a few tests fail to link.
>> >> >> >>
>> >> >> >> Does this mean those features are unusable on the target, or just that
>> >> >> >> users need to provide their own __sync_synchronize to use them?
>> >> >> >
>> >> >> >
>> >> >> > IIUC the user is expected to provide them.
>> >> >> > Looks like we discussed this in the past :-)
>> >> >> > In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
>> >> >> > see the pointer to Ramana's comment: https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
>> >> >>
>> >> >> Oh yes, thanks for the reminder!
>> >> >>
>> >> >> >
>> >> >> > The default arch for arm-eabi is armv4t which is very old.
>> >> >> > When running the testsuite with something more recent (either as default by configuring GCC --with-arch=XXX or by forcing -march/-mcpu via dejagnu's target-board), the compiler generates barrier instructions and there are no such errors.
>> >> >>
>> >> >> Ah yes, that's fine then.
>> >> >>
>> >> >> > For instance, here is a log with the defaults:
>> >> >> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
>> >> >> > and a log when we target cortex-m0 which is still a very small cpu but has barriers:
>> >> >> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
>> >> >> >
>> >> >> > I somehow wanted to get rid of such errors with the default configuration....
>> >> >>
>> >> >> Yep, that makes sense, and we'll still be testing them for newer
>> >> >> arches on the target, so it's not completely disabling those parts of
>> >> >> the testsuite.
>> >> >>
>> >> >> But I'm still curious why some of those tests need this change. I
>> >> >> think the ones I noted below are probably failing for some other
>> >> >> reasons.
>> >> >>
>> >> > Just looked at  23_containers/span/back_assert_neg.cc, the linker says it needs
>> >> > arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
>> >> > ./back_assert_neg-back_assert_neg.o (std::__glibcxx_assert_fail(char const*, int, char const*, char const*))
>> >> > and indeed debug.o has a reference to __sync_synchronize
>> >>
>> >> Aha, that's just because I put __glibcxx_assert_fail in debug.o, but
>> >> there are no dependencies on anything else in that file, including the
>> >> _M_detach member function that uses atomics.
>> >
>> > indeed
>> >
>> >
>> >>
>> >> This would also be solved by -Wl,--gc-sections :-)
>> >
>> > :-)
>> >
>> >>
>> >> I think it would be better to move __glibcxx_assert_fail to a new
>> >> file, so that it doesn't make every assertion unnecessarily depend on
>> >> __sync_synchronize. I'll do that now.
>> >
>> > Sounds like a good idea, thanks.
>>
>> Done now at r14-3846-g4a2766ed00a479
>> >
>> >>
>> >> We could also make the atomics in debug.o conditional, so that debug
>> >> mode doesn't depend on __sync_synchronize for single-threaded targets.
>> >> Does the arm4t arch have pthreads support in newlib?  I didn't bother
>> >
>> > No ( grep _GLIBCXX_HAS_GTHREADS $objdir/arm-eabi/libstdc++-v3/include/arm-eabi/bits/c++config returns:
>> > /* #undef _GLIBCXX_HAS_GTHREADS */
>> >
>> >> making the use of atomics conditional, because performance is not
>> >> really a priority for debug mode bookkeeping. But the problem here
>> >> isn't just a slight performance overhead of atomics, it's that they
>> >> aren't even supported for arm4t.
>> >
>> > OK thanks.
>> >
>> > So finally, this uncovered at least a "bug" that  __glibcxx_assert_fail should be in a dedicated object file :-)
>> >
>> > I'll revisit my patch once you have moved __glibcxx_assert_fail
>>
>> That's done (at r14-3845-gc7db9000fa7cac) and there should be no more
>> __sync_synchronize from src/c++11/debug.o at all now (at
>> r14-3846-g4a2766ed00a479). With that second change, it would have been
>> OK for __glibcxx_assert_fail to stay in that file, but it's not really
>> related so it's probably better for it to be in a separate file
>> anyway.
>>
>> That should remove the need for most of your patch!
>>
>
> Hi!
>
> I've looked at the remaining undefined references to __sync_synchronize after your commits:
> 29_atomics/atomic/compare_exchange_padding.cc   (from a.load())
> 29_atomics/atomic/cons/value_init.cc   (from a.load())
> 29_atomics/atomic_float/value_init.cc   (from a.load())
> 29_atomics/atomic_float/1.cc no problem (is_always_lock_free is false?)
> 29_atomics/atomic_integral/cons/value_init.cc   (from a.load())
> 29_atomics/atomic_ref/compare_exchange_padding.cc (from a.store())
> 29_atomics/atomic_ref/generic.cc
> 29_atomics/atomic_ref/integral.cc
> 29_atomics/atomic_ref/pointer.cc

These all make sense.

> experimental/net/timer/waitable/dest.cc (from _ZNSt12experimental3net2v110io_context9_M_do_oneENSt6chrono8durationIxSt5ratioILx1ELx1000EEEE)
> experimental/net/timer/waitable/ops.cc not sure why?

I think we can make those uses of atomics conditional like this

--- a/libstdc++-v3/include/experimental/io_context
+++ b/libstdc++-v3/include/experimental/io_context
@@ -562,7 +562,11 @@ inline namespace v1
       }
      };

+#ifdef _GLIBCXX_HAS_GTHREADS
    atomic<count_type>         _M_work_count;
+#else
+    count_type                 _M_work_count;
+#endif
    mutable execution_context::mutex_type              _M_mtx;
    queue<function<void()>>    _M_op;
    bool                       _M_stopped = false;




> experimental/polymorphic_allocator/construct_pair.cc (from load, line 835 of atomic_base.h)

Curious. This comes from lines 168 and 173 in src/c++17/memory_resource.cc
The logic there is:

#if ATOMIC_POINTER_LOCK_FREE == 2
    using atomic_mem_res = atomic<memory_resource*>;
#elif defined(_GLIBCXX_HAS_GTHREADS)
    // Emulate the interface of std::atomic but using a mutex.
    struct atomic_mem_res {
      memory_resource* load(memory_order);
      memory_resource* exchange(memory_resource*, memory_order);
    };
#else
    // Emulate the interface of std::atomic with no atomicity or
synchronization.
    struct atomic_mem_res {
      memory_resource* load(memory_order);
      memory_resource* exchange(memory_resource*, memory_order);
    };
#endif

So we use an atomic<T*> if that's always lock free, even for
single-threaded. It didn't occur to me that a target would have
lock-free pointer-size atomics, but trying to use them would give a
linker error.

Maybe it should be:

#ifndef _GLIBCXX_HAS_GTHREADS
  // single-threaded struct atomic_mem_res
#elif ATOMIC_POINTER_LOCK_FREE == 2
    using atomic_mem_res = atomic<memory_resource*>;
#else
  // mutex-based struct atomic_mem_res
#endif

> I've noticed several undefined references to __glibcxx_backtrace_create_state too
> 19_diagnostics/stacktrace/current.cc
> 19_diagnostics/stacktrace/entry.cc
> 19_diagnostics/stacktrace/stacktrace.cc

Odd. These were changed in r14-3812-gb96b554592c5cb to link to
libstdc++exp.a instead of libstdc++_libbacktrace.a, and
__glibcxx_backtrace_create_state should be part of libstdc++exp.a now.
If the target doesn't support libbacktrace then the symbols will be
missing from libstdc++exp.a, but then the test should fail to match
the effective target "stacktrace".
Christophe Lyon Sept. 13, 2023, 3:37 p.m. UTC | #11
On Tue, 12 Sept 2023 at 11:07, Jonathan Wakely <jwakely@redhat.com> wrote:

> On Tue, 12 Sept 2023 at 08:59, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
> >
> >
> >
> > On Mon, 11 Sept 2023 at 18:11, Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >>
> >> On Mon, 11 Sept 2023 at 16:40, Christophe Lyon
> >> <christophe.lyon@linaro.org> wrote:
> >> >
> >> >
> >> >
> >> > On Mon, 11 Sept 2023 at 17:22, Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >> >>
> >> >> On Mon, 11 Sept 2023 at 14:57, Christophe Lyon
> >> >> <christophe.lyon@linaro.org> wrote:
> >> >> >
> >> >> >
> >> >> >
> >> >> > On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >> >> >>
> >> >> >> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
> >> >> >> <christophe.lyon@linaro.org> wrote:
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely <
> jwakely@redhat.com> wrote:
> >> >> >> >>
> >> >> >> >> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
> >> >> >> >> <christophe.lyon@linaro.org> wrote:
> >> >> >> >> >
> >> >> >> >> > Some targets like arm-eabi with newlib and default settings
> rely on
> >> >> >> >> > __sync_synchronize() to ensure synchronization.  Newlib does
> not
> >> >> >> >> > implement it by default, to make users aware they have to
> take special
> >> >> >> >> > care.
> >> >> >> >> >
> >> >> >> >> > This makes a few tests fail to link.
> >> >> >> >>
> >> >> >> >> Does this mean those features are unusable on the target, or
> just that
> >> >> >> >> users need to provide their own __sync_synchronize to use them?
> >> >> >> >
> >> >> >> >
> >> >> >> > IIUC the user is expected to provide them.
> >> >> >> > Looks like we discussed this in the past :-)
> >> >> >> > In
> https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
> >> >> >> > see the pointer to Ramana's comment:
> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
> >> >> >>
> >> >> >> Oh yes, thanks for the reminder!
> >> >> >>
> >> >> >> >
> >> >> >> > The default arch for arm-eabi is armv4t which is very old.
> >> >> >> > When running the testsuite with something more recent (either
> as default by configuring GCC --with-arch=XXX or by forcing -march/-mcpu
> via dejagnu's target-board), the compiler generates barrier instructions
> and there are no such errors.
> >> >> >>
> >> >> >> Ah yes, that's fine then.
> >> >> >>
> >> >> >> > For instance, here is a log with the defaults:
> >> >> >> >
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
> >> >> >> > and a log when we target cortex-m0 which is still a very small
> cpu but has barriers:
> >> >> >> >
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
> >> >> >> >
> >> >> >> > I somehow wanted to get rid of such errors with the default
> configuration....
> >> >> >>
> >> >> >> Yep, that makes sense, and we'll still be testing them for newer
> >> >> >> arches on the target, so it's not completely disabling those
> parts of
> >> >> >> the testsuite.
> >> >> >>
> >> >> >> But I'm still curious why some of those tests need this change. I
> >> >> >> think the ones I noted below are probably failing for some other
> >> >> >> reasons.
> >> >> >>
> >> >> > Just looked at  23_containers/span/back_assert_neg.cc, the linker
> says it needs
> >> >> > arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
> >> >> > ./back_assert_neg-back_assert_neg.o
> (std::__glibcxx_assert_fail(char const*, int, char const*, char const*))
> >> >> > and indeed debug.o has a reference to __sync_synchronize
> >> >>
> >> >> Aha, that's just because I put __glibcxx_assert_fail in debug.o, but
> >> >> there are no dependencies on anything else in that file, including
> the
> >> >> _M_detach member function that uses atomics.
> >> >
> >> > indeed
> >> >
> >> >
> >> >>
> >> >> This would also be solved by -Wl,--gc-sections :-)
> >> >
> >> > :-)
> >> >
> >> >>
> >> >> I think it would be better to move __glibcxx_assert_fail to a new
> >> >> file, so that it doesn't make every assertion unnecessarily depend on
> >> >> __sync_synchronize. I'll do that now.
> >> >
> >> > Sounds like a good idea, thanks.
> >>
> >> Done now at r14-3846-g4a2766ed00a479
> >> >
> >> >>
> >> >> We could also make the atomics in debug.o conditional, so that debug
> >> >> mode doesn't depend on __sync_synchronize for single-threaded
> targets.
> >> >> Does the arm4t arch have pthreads support in newlib?  I didn't bother
> >> >
> >> > No ( grep _GLIBCXX_HAS_GTHREADS
> $objdir/arm-eabi/libstdc++-v3/include/arm-eabi/bits/c++config returns:
> >> > /* #undef _GLIBCXX_HAS_GTHREADS */
> >> >
> >> >> making the use of atomics conditional, because performance is not
> >> >> really a priority for debug mode bookkeeping. But the problem here
> >> >> isn't just a slight performance overhead of atomics, it's that they
> >> >> aren't even supported for arm4t.
> >> >
> >> > OK thanks.
> >> >
> >> > So finally, this uncovered at least a "bug" that
> __glibcxx_assert_fail should be in a dedicated object file :-)
> >> >
> >> > I'll revisit my patch once you have moved __glibcxx_assert_fail
> >>
> >> That's done (at r14-3845-gc7db9000fa7cac) and there should be no more
> >> __sync_synchronize from src/c++11/debug.o at all now (at
> >> r14-3846-g4a2766ed00a479). With that second change, it would have been
> >> OK for __glibcxx_assert_fail to stay in that file, but it's not really
> >> related so it's probably better for it to be in a separate file
> >> anyway.
> >>
> >> That should remove the need for most of your patch!
> >>
> >
> > Hi!
> >
> > I've looked at the remaining undefined references to __sync_synchronize
> after your commits:
> > 29_atomics/atomic/compare_exchange_padding.cc   (from a.load())
> > 29_atomics/atomic/cons/value_init.cc   (from a.load())
> > 29_atomics/atomic_float/value_init.cc   (from a.load())
> > 29_atomics/atomic_float/1.cc no problem (is_always_lock_free is false?)
> > 29_atomics/atomic_integral/cons/value_init.cc   (from a.load())
> > 29_atomics/atomic_ref/compare_exchange_padding.cc (from a.store())
> > 29_atomics/atomic_ref/generic.cc
> > 29_atomics/atomic_ref/integral.cc
> > 29_atomics/atomic_ref/pointer.cc
>
> These all make sense.
>
> > experimental/net/timer/waitable/dest.cc (from
> _ZNSt12experimental3net2v110io_context9_M_do_oneENSt6chrono8durationIxSt5ratioILx1ELx1000EEEE)
> > experimental/net/timer/waitable/ops.cc not sure why?
>
> I think we can make those uses of atomics conditional like this
>
> --- a/libstdc++-v3/include/experimental/io_context
> +++ b/libstdc++-v3/include/experimental/io_context
> @@ -562,7 +562,11 @@ inline namespace v1
>        }
>       };
>
> +#ifdef _GLIBCXX_HAS_GTHREADS
>     atomic<count_type>         _M_work_count;
> +#else
> +    count_type                 _M_work_count;
> +#endif
>     mutable execution_context::mutex_type              _M_mtx;
>     queue<function<void()>>    _M_op;
>     bool                       _M_stopped = false;
>
>
>
>
> > experimental/polymorphic_allocator/construct_pair.cc (from load, line
> 835 of atomic_base.h)
>
> Curious. This comes from lines 168 and 173 in src/c++17/memory_resource.cc
> The logic there is:
>
> #if ATOMIC_POINTER_LOCK_FREE == 2
>     using atomic_mem_res = atomic<memory_resource*>;
> #elif defined(_GLIBCXX_HAS_GTHREADS)
>     // Emulate the interface of std::atomic but using a mutex.
>     struct atomic_mem_res {
>       memory_resource* load(memory_order);
>       memory_resource* exchange(memory_resource*, memory_order);
>     };
> #else
>     // Emulate the interface of std::atomic with no atomicity or
> synchronization.
>     struct atomic_mem_res {
>       memory_resource* load(memory_order);
>       memory_resource* exchange(memory_resource*, memory_order);
>     };
> #endif
>
> So we use an atomic<T*> if that's always lock free, even for
> single-threaded. It didn't occur to me that a target would have
> lock-free pointer-size atomics, but trying to use them would give a
> linker error.
>
> Maybe it should be:
>
> #ifndef _GLIBCXX_HAS_GTHREADS
>   // single-threaded struct atomic_mem_res
> #elif ATOMIC_POINTER_LOCK_FREE == 2
>     using atomic_mem_res = atomic<memory_resource*>;
> #else
>   // mutex-based struct atomic_mem_res
> #endif
>
> > I've noticed several undefined references to
> __glibcxx_backtrace_create_state too
> > 19_diagnostics/stacktrace/current.cc
> > 19_diagnostics/stacktrace/entry.cc
> > 19_diagnostics/stacktrace/stacktrace.cc
>
> Odd. These were changed in r14-3812-gb96b554592c5cb to link to
> libstdc++exp.a instead of libstdc++_libbacktrace.a, and
> __glibcxx_backtrace_create_state should be part of libstdc++exp.a now.
> If the target doesn't support libbacktrace then the symbols will be
> missing from libstdc++exp.a, but then the test should fail to match
> the effective target "stacktrace".
>
> Strange, it looks like these libs were not correctly rebuilt after I
rebased to have your patches.
I've rebuilt from scratch and these undefined references are not present
indeed.

Thanks,

Christophe
Jonathan Wakely Sept. 13, 2023, 3:56 p.m. UTC | #12
On Wed, 13 Sept 2023 at 16:38, Christophe Lyon via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> On Tue, 12 Sept 2023 at 11:07, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> > On Tue, 12 Sept 2023 at 08:59, Christophe Lyon
> > <christophe.lyon@linaro.org> wrote:
> > > I've noticed several undefined references to
> > __glibcxx_backtrace_create_state too
> > > 19_diagnostics/stacktrace/current.cc
> > > 19_diagnostics/stacktrace/entry.cc
> > > 19_diagnostics/stacktrace/stacktrace.cc
> >
> > Odd. These were changed in r14-3812-gb96b554592c5cb to link to
> > libstdc++exp.a instead of libstdc++_libbacktrace.a, and
> > __glibcxx_backtrace_create_state should be part of libstdc++exp.a now.
> > If the target doesn't support libbacktrace then the symbols will be
> > missing from libstdc++exp.a, but then the test should fail to match
> > the effective target "stacktrace".
> >
> > Strange, it looks like these libs were not correctly rebuilt after I
> rebased to have your patches.
> I've rebuilt from scratch and these undefined references are not present
> indeed.

Great! Thanks for checking.

I sent a proposed patch that should remove most of the other
unnecessary uses of atomics, as suggested yesterday:
https://patchwork.sourceware.org/project/gcc/patch/20230913123226.2083892-1-jwakely@redhat.com/
Would you be able to check whether that improves the results further for arm4t?
I think with that, you should only need the dg-require-thread-fence
for the 9 or so tests under 29_atomics/ which really do require atomic
synchronization.
diff mbox series

Patch

diff --git a/libstdc++-v3/testsuite/20_util/to_address/debug.cc b/libstdc++-v3/testsuite/20_util/to_address/debug.cc
index d6eba8b5d10..558d878b3ec 100644
--- a/libstdc++-v3/testsuite/20_util/to_address/debug.cc
+++ b/libstdc++-v3/testsuite/20_util/to_address/debug.cc
@@ -17,6 +17,7 @@ 
 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { target c++2a } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/vector>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/self_move.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/self_move.cc
index def9a7fce20..3f9836fdf37 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/self_move.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/self_move.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <string>
 #include <debug/string>
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/debug/1_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string/debug/1_neg.cc
index cdf9301ad3c..03382fe1766 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/debug/1_neg.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/debug/1_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #define _GLIBCXX_DEBUG_PEDANTIC
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/debug/2_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string/debug/2_neg.cc
index baa7954b474..822eeca6d92 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/debug/2_neg.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/debug/2_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #define _GLIBCXX_DEBUG_PEDANTIC
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/debug/find1_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string/debug/find1_neg.cc
index 9a41de4dcbb..db885d7eeb0 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/debug/find1_neg.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/debug/find1_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #define _GLIBCXX_DEBUG_PEDANTIC
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/debug/find2_neg.cc b/libstdc++-v3/testsuite/21_strings/basic_string/debug/find2_neg.cc
index 9a4d30f467c..60ea80be1bf 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/debug/find2_neg.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/debug/find2_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #define _GLIBCXX_DEBUG_PEDANTIC
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/hash/debug.cc b/libstdc++-v3/testsuite/21_strings/basic_string/hash/debug.cc
index 706da53db81..306524776b4 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/hash/debug.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/hash/debug.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++17 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/string>
 #include <memory_resource>
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/citerators.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/citerators.cc
index 30aeda98e88..c150a5197c6 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/citerators.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/citerators.cc
@@ -1,5 +1,6 @@ 
 // { dg-do run { target c++11 } }
 // { dg-require-string-conversions "" }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 // Copyright (C) 2009-2023 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/basic.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/basic.cc
index 0324ae9d45f..ed5e723eb36 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/basic.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/basic.cc
@@ -1,5 +1,6 @@ 
 // { dg-do run { target c++11 } }
 // { dg-require-cstdint "" }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 // 2009-11-10  Benjamin Kosnik  <benjamin@redhat.com>
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/generation_prohibited.cc
index 209542f57e4..0db93e3f1a3 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/generation_prohibited.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/generation_prohibited.cc
@@ -1,5 +1,6 @@ 
 // { dg-do run { target c++11 } }
 // { dg-require-cstdint "" }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 // 2009-09-14  Benjamin Kosnik  <benjamin@redhat.com>
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/propagation_consistent.cc
index 805aecdab19..eb0a885b431 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/propagation_consistent.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/exception/propagation_consistent.cc
@@ -1,5 +1,6 @@ 
 // { dg-do run { target c++11 } }
 // { dg-require-cstdint "" }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 // 2009-09-14  Benjamin Kosnik  <benjamin@redhat.com>
 
diff --git a/libstdc++-v3/testsuite/21_strings/debug/shrink_to_fit.cc b/libstdc++-v3/testsuite/21_strings/debug/shrink_to_fit.cc
index c5efbb6cfe2..46ff0595f2d 100644
--- a/libstdc++-v3/testsuite/21_strings/debug/shrink_to_fit.cc
+++ b/libstdc++-v3/testsuite/21_strings/debug/shrink_to_fit.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/string>
 
diff --git a/libstdc++-v3/testsuite/23_containers/array/debug/back1_neg.cc b/libstdc++-v3/testsuite/23_containers/array/debug/back1_neg.cc
index f1bd47cf9b1..ed24c0c14c8 100644
--- a/libstdc++-v3/testsuite/23_containers/array/debug/back1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/debug/back1_neg.cc
@@ -17,6 +17,7 @@ 
 //
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { target c++14 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <array>
 
diff --git a/libstdc++-v3/testsuite/23_containers/array/debug/back2_neg.cc b/libstdc++-v3/testsuite/23_containers/array/debug/back2_neg.cc
index ce28c2c13f8..d3ba88c8e06 100644
--- a/libstdc++-v3/testsuite/23_containers/array/debug/back2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/debug/back2_neg.cc
@@ -17,6 +17,7 @@ 
 //
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { target c++14 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <array>
 
diff --git a/libstdc++-v3/testsuite/23_containers/array/debug/front1_neg.cc b/libstdc++-v3/testsuite/23_containers/array/debug/front1_neg.cc
index 5da09c6c71a..b6886066f2c 100644
--- a/libstdc++-v3/testsuite/23_containers/array/debug/front1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/debug/front1_neg.cc
@@ -17,6 +17,7 @@ 
 //
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { target c++14 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <array>
 
diff --git a/libstdc++-v3/testsuite/23_containers/array/debug/front2_neg.cc b/libstdc++-v3/testsuite/23_containers/array/debug/front2_neg.cc
index baa46274aad..f59905a4f58 100644
--- a/libstdc++-v3/testsuite/23_containers/array/debug/front2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/debug/front2_neg.cc
@@ -17,6 +17,7 @@ 
 //
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { target c++14 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <array>
 
diff --git a/libstdc++-v3/testsuite/23_containers/array/debug/square_brackets_operator1_neg.cc b/libstdc++-v3/testsuite/23_containers/array/debug/square_brackets_operator1_neg.cc
index fb3aab5de88..96d223c71b4 100644
--- a/libstdc++-v3/testsuite/23_containers/array/debug/square_brackets_operator1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/debug/square_brackets_operator1_neg.cc
@@ -17,6 +17,7 @@ 
 //
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { target c++14 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <array>
 
diff --git a/libstdc++-v3/testsuite/23_containers/array/debug/square_brackets_operator2_neg.cc b/libstdc++-v3/testsuite/23_containers/array/debug/square_brackets_operator2_neg.cc
index f240dc66ca4..ec1a4572e41 100644
--- a/libstdc++-v3/testsuite/23_containers/array/debug/square_brackets_operator2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/debug/square_brackets_operator2_neg.cc
@@ -17,6 +17,7 @@ 
 //
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { target c++14 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <array>
 
diff --git a/libstdc++-v3/testsuite/23_containers/deque/cons/self_move.cc b/libstdc++-v3/testsuite/23_containers/deque/cons/self_move.cc
index bd899b01b8a..fd3bc79a4a6 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/cons/self_move.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/cons/self_move.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <deque>
 #include <debug/deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/debug/98466.cc b/libstdc++-v3/testsuite/23_containers/deque/debug/98466.cc
index 9650b1e938d..8eb05c0a6e5 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/debug/98466.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/debug/98466.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/deque>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/debug/assign4_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/debug/assign4_neg.cc
index fae959e9730..a6386e7e517 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/debug/assign4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/debug/assign4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/deque>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/debug/construct4_neg.cc
index 4be6516246b..5faef64642f 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/deque>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/debug/insert4_neg.cc
index df6bcb7eb48..3392558e1d1 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/deque>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/1.cc
index 33fa802c288..1f2f616c74e 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/1.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/deque>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/2.cc
index fbc2c81fd12..23e731529c4 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/2.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/deque>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/3.cc b/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/3.cc
index d650f0f7637..56e82b68b73 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/3.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/deque>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/4.cc b/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/4.cc
index 9097c86e589..476b01ea2ae 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/4.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/debug/invalidation/4.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/deque>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/self_move.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/self_move.cc
index 8638223b65a..d90222cfda8 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/cons/self_move.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/self_move.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <forward_list>
 #include <debug/forward_list>
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/construct4_neg.cc
index 28fe590d6cd..e2dceb05559 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/forward_list>
 
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_assign_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_assign_neg.cc
index a8328d93d73..f3b21889dfa 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_assign_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/forward_list>
 #include <testsuite_allocator.h>
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_neg.cc
index 4f67bc0ab9a..d26857db461 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/debug/move_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/forward_list>
 
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/self_move.cc b/libstdc++-v3/testsuite/23_containers/list/cons/self_move.cc
index 10edff1c5a8..3aa1f66e7e3 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/self_move.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/self_move.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <list>
 #include <debug/list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/assign4_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/assign4_neg.cc
index 8ef90cb9c6d..1791f00b2fe 100644
--- a/libstdc++-v3/testsuite/23_containers/list/debug/assign4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/assign4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/list>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/construct4_neg.cc
index 8458d316a41..48b3c65e257 100644
--- a/libstdc++-v3/testsuite/23_containers/list/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/list>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/insert4_neg.cc
index a1b29650dda..99d5f5076fa 100644
--- a/libstdc++-v3/testsuite/23_containers/list/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/list>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/1.cc
index 4b43e10aebe..1bcee8ed8b7 100644
--- a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/1.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/list>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/2.cc
index bb9beaea316..ff77c28afb6 100644
--- a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/2.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/list>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/3.cc b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/3.cc
index 9b948640f77..010629cf319 100644
--- a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/3.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/list>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/4.cc b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/4.cc
index 0125095a2ba..11038b3977a 100644
--- a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/4.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/4.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/list>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/map/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/map/debug/construct4_neg.cc
index f14a874123a..125319f2f09 100644
--- a/libstdc++-v3/testsuite/23_containers/map/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/map/debug/construct5_neg.cc b/libstdc++-v3/testsuite/23_containers/map/debug/construct5_neg.cc
index db9f83a666b..402218f185e 100644
--- a/libstdc++-v3/testsuite/23_containers/map/debug/construct5_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/debug/construct5_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 
diff --git a/libstdc++-v3/testsuite/23_containers/map/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/map/debug/insert4_neg.cc
index 2f7517959a1..bb1e4d754c7 100644
--- a/libstdc++-v3/testsuite/23_containers/map/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/map/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/map/debug/invalidation/1.cc
index 865c8815c20..510477e4576 100644
--- a/libstdc++-v3/testsuite/23_containers/map/debug/invalidation/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/debug/invalidation/1.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/map/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/map/debug/invalidation/2.cc
index 7bf254ce0eb..4dbcb70b202 100644
--- a/libstdc++-v3/testsuite/23_containers/map/debug/invalidation/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/debug/invalidation/2.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/map/debug/move_assign_neg.cc b/libstdc++-v3/testsuite/23_containers/map/debug/move_assign_neg.cc
index 9267b644f71..2cbbbf17900 100644
--- a/libstdc++-v3/testsuite/23_containers/map/debug/move_assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/debug/move_assign_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <testsuite_allocator.h>
diff --git a/libstdc++-v3/testsuite/23_containers/map/debug/move_neg.cc b/libstdc++-v3/testsuite/23_containers/map/debug/move_neg.cc
index daabfea1c3b..4ee9977a3ff 100644
--- a/libstdc++-v3/testsuite/23_containers/map/debug/move_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/debug/move_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 
diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/end_neg.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/end_neg.cc
index bf38a677756..53cafa69c39 100644
--- a/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/end_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/end_neg.cc
@@ -17,6 +17,7 @@ 
 
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <map>
 
diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/16813.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/16813.cc
index 7a5b073b786..88b59f97030 100644
--- a/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/16813.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/16813.cc
@@ -14,6 +14,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/multimap/debug/construct4_neg.cc
index 765f5b6930a..936efbb298e 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/debug/construct5_neg.cc b/libstdc++-v3/testsuite/23_containers/multimap/debug/construct5_neg.cc
index 90d565824a5..17a0eee5357 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/debug/construct5_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/debug/construct5_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/multimap/debug/insert4_neg.cc
index 2a3fa39bc83..a96dfb4445e 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/multimap/debug/invalidation/1.cc
index 0404cdb4129..61d1f25fa39 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/debug/invalidation/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/debug/invalidation/1.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/multimap/debug/invalidation/2.cc
index 801411d120e..4764abaa223 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/debug/invalidation/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/debug/invalidation/2.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/debug/move_assign_neg.cc b/libstdc++-v3/testsuite/23_containers/multimap/debug/move_assign_neg.cc
index 31b66f1f005..8367acbd5a8 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/debug/move_assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/debug/move_assign_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 #include <testsuite_allocator.h>
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/debug/move_neg.cc b/libstdc++-v3/testsuite/23_containers/multimap/debug/move_neg.cc
index 834bf1fb162..d86df02e6eb 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/debug/move_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/debug/move_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/map>
 
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct4_neg.cc
index 0cab07bbfd2..9c40e116d9a 100644
--- a/libstdc++-v3/testsuite/23_containers/multiset/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/construct5_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct5_neg.cc
index ab8f03558f1..ab5f060bb29 100644
--- a/libstdc++-v3/testsuite/23_containers/multiset/debug/construct5_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/construct5_neg.cc
@@ -16,6 +16,8 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/insert4_neg.cc
index e3bd3a6325f..fa7dc9c7405 100644
--- a/libstdc++-v3/testsuite/23_containers/multiset/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/1.cc
index 190fa097db0..e7c8b7ef9ec 100644
--- a/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/1.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/2.cc
index 18d78e95926..0f230d88e93 100644
--- a/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/invalidation/2.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/move_assign_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/move_assign_neg.cc
index 94e0d86ee7f..1c129620ae1 100644
--- a/libstdc++-v3/testsuite/23_containers/multiset/debug/move_assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/move_assign_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 #include <testsuite_allocator.h>
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/debug/move_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/debug/move_neg.cc
index 48f5efb1790..5e00de66445 100644
--- a/libstdc++-v3/testsuite/23_containers/multiset/debug/move_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multiset/debug/move_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 
diff --git a/libstdc++-v3/testsuite/23_containers/set/cons/self_move.cc b/libstdc++-v3/testsuite/23_containers/set/cons/self_move.cc
index 8bc633a3c6e..33952a985ce 100644
--- a/libstdc++-v3/testsuite/23_containers/set/cons/self_move.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/cons/self_move.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <set>
 #include <debug/set>
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/construct4_neg.cc
index d4e26b6deb2..e29d7b4fb22 100644
--- a/libstdc++-v3/testsuite/23_containers/set/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/construct5_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/construct5_neg.cc
index 924067babf3..e32ea6a91a5 100644
--- a/libstdc++-v3/testsuite/23_containers/set/debug/construct5_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/construct5_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc
index 2a0f08123d1..f0620ed7336 100644
--- a/libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc
index b5abfcec4c8..6b7ff9554d6 100644
--- a/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc
index 18b37ed7f5b..0843ee2657a 100644
--- a/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/move_assign_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/move_assign_neg.cc
index b3ecb07d9a9..ed0910e6ca3 100644
--- a/libstdc++-v3/testsuite/23_containers/set/debug/move_assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/move_assign_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 #include <testsuite_allocator.h>
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/move_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/move_neg.cc
index e1015a0c2d0..64adf2238f1 100644
--- a/libstdc++-v3/testsuite/23_containers/set/debug/move_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/move_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/set>
 
diff --git a/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc
index 2b4dee6df9a..d168d05b67e 100644
--- a/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/cons_1_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/cons_1_assert_neg.cc
index 2f555125453..e420460cd7b 100644
--- a/libstdc++-v3/testsuite/23_containers/span/cons_1_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/cons_1_assert_neg.cc
@@ -1,6 +1,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_DEBUG
 #define _GLIBCXX_DEBUG
diff --git a/libstdc++-v3/testsuite/23_containers/span/cons_2_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/cons_2_assert_neg.cc
index efef0e608ba..75b2537c306 100644
--- a/libstdc++-v3/testsuite/23_containers/span/cons_2_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/cons_2_assert_neg.cc
@@ -1,6 +1,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_DEBUG
 #define _GLIBCXX_DEBUG
diff --git a/libstdc++-v3/testsuite/23_containers/span/first_2_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/first_2_assert_neg.cc
index 93cd095495a..59945017f47 100644
--- a/libstdc++-v3/testsuite/23_containers/span/first_2_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/first_2_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/first_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/first_assert_neg.cc
index 4ff56bf65cf..53f1712b89f 100644
--- a/libstdc++-v3/testsuite/23_containers/span/first_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/first_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/front_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/front_assert_neg.cc
index 2d4320d0fd9..f2b3e6d6627 100644
--- a/libstdc++-v3/testsuite/23_containers/span/front_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/front_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/index_op_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/index_op_assert_neg.cc
index b2633cbfaab..338708377bd 100644
--- a/libstdc++-v3/testsuite/23_containers/span/index_op_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/index_op_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/last_2_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/last_2_assert_neg.cc
index 906896911c0..5f12ee77d71 100644
--- a/libstdc++-v3/testsuite/23_containers/span/last_2_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/last_2_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc
index 59cd44acc3c..7185be6f517 100644
--- a/libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_2_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_2_assert_neg.cc
index 488b5606993..1a3749360be 100644
--- a/libstdc++-v3/testsuite/23_containers/span/subspan_2_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/subspan_2_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_3_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_3_assert_neg.cc
index 8324edfc49a..d2ef7be332a 100644
--- a/libstdc++-v3/testsuite/23_containers/span/subspan_3_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/subspan_3_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_4_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_4_assert_neg.cc
index b1dbfe6902e..d1e13cad3d0 100644
--- a/libstdc++-v3/testsuite/23_containers/span/subspan_4_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/subspan_4_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_5_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_5_assert_neg.cc
index 2102fd02cce..378a243685a 100644
--- a/libstdc++-v3/testsuite/23_containers/span/subspan_5_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/subspan_5_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_6_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_6_assert_neg.cc
index c003561032c..81201400408 100644
--- a/libstdc++-v3/testsuite/23_containers/span/subspan_6_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/subspan_6_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/subspan_assert_neg.cc b/libstdc++-v3/testsuite/23_containers/span/subspan_assert_neg.cc
index c46b78fe8bc..2ec08e9c949 100644
--- a/libstdc++-v3/testsuite/23_containers/span/subspan_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/subspan_assert_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/98466.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/98466.cc
index b3b24c36345..c2549e5f3ef 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/98466.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/98466.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct4_neg.cc
index 5bb9b192b05..e2dec8e1bef 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct5_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct5_neg.cc
index d25ef525f6e..242e469fa3f 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct5_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct5_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert4_neg.cc
index e0096a5ab96..7b059929c6c 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/move_assign_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/move_assign_neg.cc
index 28f4d1e3a81..fe8a57b60c8 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/move_assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/move_assign_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 #include <testsuite_allocator.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/move_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/move_neg.cc
index fafe8d2bcb1..1d9b029a011 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/move_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/move_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct4_neg.cc
index 3dcfe9d698e..d4d97859384 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct5_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct5_neg.cc
index 41491aaa5b7..f4306b62f4f 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct5_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/construct5_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert4_neg.cc
index 15210616a18..298611b63b2 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/move_assign_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/move_assign_neg.cc
index 35b06966951..911281991bc 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/move_assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/move_assign_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 #include <testsuite_allocator.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/move_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/move_neg.cc
index a8460e2bdf2..756f98e7f86 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/move_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/move_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_map>
 
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct4_neg.cc
index 73b30cbf055..af9950064da 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_set>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct5_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct5_neg.cc
index ba74892499d..0ee2aaaadd5 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct5_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/construct5_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_set>
 
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert4_neg.cc
index 4ddc955848b..e5e9433d88f 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_set>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/move_assign_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/move_assign_neg.cc
index 2a3bb04242d..09e4f26e740 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/move_assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/move_assign_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_set>
 #include <testsuite_allocator.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/move_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/move_neg.cc
index fe49807bbb8..c5f853de742 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/move_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/move_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_set>
 
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/self_move.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/self_move.cc
index 530a544457a..b460fa5dec6 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/self_move.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/self_move.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <unordered_set>
 #include <debug/unordered_set>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/construct4_neg.cc
index 70389b9e48a..24693ecca82 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_set>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/construct5_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/construct5_neg.cc
index f2e80bfb040..960215ada43 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/construct5_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/construct5_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_set>
 
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/insert4_neg.cc
index 3184b109b25..3f3e54b994e 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_set>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/move_assign_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/move_assign_neg.cc
index 85baa06e133..cebe482dd94 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/move_assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/move_assign_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_set>
 #include <testsuite_allocator.h>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/move_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/move_neg.cc
index 022e0e080d1..b466cb88e2a 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/move_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/move_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/unordered_set>
 
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/self_move.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/self_move.cc
index 51393fa9c95..0c129905f6b 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/cons/self_move.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/self_move.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <vector>
 #include <debug/vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc
index 520788d5cb7..b775c184e60 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc
@@ -1,6 +1,7 @@ 
 // { dg-do run { xfail *-*-* } }
 // { dg-options "-D_GLIBCXX_DEBUG_BACKTRACE -lstdc++_libbacktrace" }
 // { dg-require-effective-target stacktrace }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/vector>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_neg.cc
index 9aa48b60549..ac8258e14df 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/vector>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/construct4_neg.cc
index bea6713c9ca..78fc85ed7ca 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/construct4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/construct4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/vector>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/insert4_neg.cc
index 39bcc2484c4..af990d9b3b1 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/insert4_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/insert4_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/vector>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/insert6_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/insert6_neg.cc
index e3e4f69d9c4..f5fa8091647 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/insert6_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/insert6_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <vector>
 #include <debug/vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/insert7_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/insert7_neg.cc
index b1da7a48ff3..e50dccaf9ff 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/insert7_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/insert7_neg.cc
@@ -18,6 +18,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <memory>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/1.cc
index c21b7febd4b..1f32c740546 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/1.cc
@@ -19,6 +19,7 @@ 
 
 // We need to be pedantic about reallocations for this testcase to be correct.
 // { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #ifndef _GLIBCXX_DEBUG_PEDANTIC
 #  define _GLIBCXX_DEBUG_PEDANTIC 1
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/2.cc
index 72c14c888d1..278bc8405b0 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/2.cc
@@ -19,6 +19,7 @@ 
 
 // We need to be pedantic about reallocations for this testcase to be correct.
 // { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #ifndef _GLIBCXX_DEBUG_PEDANTIC
 #  define _GLIBCXX_DEBUG_PEDANTIC 1
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/3.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/3.cc
index fcc7f40cdfb..1727deb2330 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/3.cc
@@ -19,6 +19,7 @@ 
 
 // We need to be pedantic about reallocations for this testcase to be correct.
 // { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #ifndef _GLIBCXX_DEBUG_PEDANTIC
 #  define _GLIBCXX_DEBUG_PEDANTIC 1
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/4.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/4.cc
index b30a0058f0b..8736aa7cee1 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/4.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/4.cc
@@ -19,6 +19,7 @@ 
 
 // We need to be pedantic about reallocations for this testcase to be correct.
 // { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #ifndef _GLIBCXX_DEBUG_PEDANTIC
 #  define _GLIBCXX_DEBUG_PEDANTIC 1
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/move_assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/move_assign_neg.cc
index 58e93ddafb2..18f8ace41b2 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/move_assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/move_assign_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 //
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/vector>
 
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/move_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/move_neg.cc
index 1db769c5208..c263c90ee44 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/move_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/move_neg.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/vector>
 
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/mutex_association.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/mutex_association.cc
index b430f71361f..d927c412b76 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/mutex_association.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/mutex_association.cc
@@ -15,6 +15,7 @@ 
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 //
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <set>
 #include <debug/vector>
diff --git a/libstdc++-v3/testsuite/24_iterators/move_iterator/debug_neg.cc b/libstdc++-v3/testsuite/24_iterators/move_iterator/debug_neg.cc
index 09cb0784a90..394ee3756bc 100644
--- a/libstdc++-v3/testsuite/24_iterators/move_iterator/debug_neg.cc
+++ b/libstdc++-v3/testsuite/24_iterators/move_iterator/debug_neg.cc
@@ -16,6 +16,8 @@ 
 // You should have received a copy of the GNU General Public License along
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
+//
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/vector>
 #include <iterator>
diff --git a/libstdc++-v3/testsuite/24_iterators/normal_iterator/debug_neg.cc b/libstdc++-v3/testsuite/24_iterators/normal_iterator/debug_neg.cc
index 62bbb7cf9d9..d2a4661b63a 100644
--- a/libstdc++-v3/testsuite/24_iterators/normal_iterator/debug_neg.cc
+++ b/libstdc++-v3/testsuite/24_iterators/normal_iterator/debug_neg.cc
@@ -18,6 +18,7 @@ 
 // Requires C++11 because we check for correct output of
 // __gnu_cxx::__normal_iterator which is improved in this mode.
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/vector>
 
diff --git a/libstdc++-v3/testsuite/24_iterators/range_operations/advance_debug_neg.cc b/libstdc++-v3/testsuite/24_iterators/range_operations/advance_debug_neg.cc
index 4d363c41f7c..a0e5dc3ef0e 100644
--- a/libstdc++-v3/testsuite/24_iterators/range_operations/advance_debug_neg.cc
+++ b/libstdc++-v3/testsuite/24_iterators/range_operations/advance_debug_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a -D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { xfail *-*-* } }
 // { dg-require-effective-target c++2a }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <iterator>
 #include <testsuite_iterators.h>
diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/debug_neg.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/debug_neg.cc
index c11625190d1..19ec7ce2dd3 100644
--- a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/debug_neg.cc
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/debug_neg.cc
@@ -18,6 +18,7 @@ 
 // Requires C++11 because we check for correct output of
 // std::reverse_iterator which is improved only in this mode.
 // { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <debug/vector>
 
diff --git a/libstdc++-v3/testsuite/25_algorithms/binary_search/partitioned.cc b/libstdc++-v3/testsuite/25_algorithms/binary_search/partitioned.cc
index dd3d46b1cf8..6bdb787f2a9 100644
--- a/libstdc++-v3/testsuite/25_algorithms/binary_search/partitioned.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/binary_search/partitioned.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-D_GLIBCXX_DEBUG" }
 // { dg-do run { target c++11 } }
 // { dg-skip-if "" { *-*-* } { "-D_GLIBCXX_PARALLEL" } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <algorithm>
 #include <functional>
diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/86658.cc b/libstdc++-v3/testsuite/25_algorithms/copy/86658.cc
index e6b19c0a12a..3d4b15b5042 100644
--- a/libstdc++-v3/testsuite/25_algorithms/copy/86658.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/copy/86658.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-D_GLIBCXX_DEBUG" }
 // { dg-do run }
 // { dg-skip-if "" { *-*-* } { "-D_GLIBCXX_PARALLEL" } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <algorithm>
 #include <vector>
diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc b/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc
index 4ffa02be7d3..b46b9a75438 100644
--- a/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc
@@ -17,6 +17,7 @@ 
 
 // { dg-options "-D_GLIBCXX_DEBUG" }
 // { dg-do run }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <algorithm>
 #include <set>
diff --git a/libstdc++-v3/testsuite/25_algorithms/equal_range/partitioned.cc b/libstdc++-v3/testsuite/25_algorithms/equal_range/partitioned.cc
index 0a879edd53c..9434f9f4d38 100644
--- a/libstdc++-v3/testsuite/25_algorithms/equal_range/partitioned.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/equal_range/partitioned.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-D_GLIBCXX_DEBUG" }
 // { dg-do run { target c++11 } }
 // { dg-skip-if "" { *-*-* } { "-D_GLIBCXX_PARALLEL" } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <algorithm>
 #include <functional>
diff --git a/libstdc++-v3/testsuite/25_algorithms/for_each/for_each_n_debug.cc b/libstdc++-v3/testsuite/25_algorithms/for_each/for_each_n_debug.cc
index 1ddeae4efcc..15e3ee62b97 100644
--- a/libstdc++-v3/testsuite/25_algorithms/for_each/for_each_n_debug.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/for_each/for_each_n_debug.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++17 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <algorithm>
 #include <debug/vector>
diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound/partitioned.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound/partitioned.cc
index 557c1fada38..e5d5373780e 100644
--- a/libstdc++-v3/testsuite/25_algorithms/lower_bound/partitioned.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound/partitioned.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-D_GLIBCXX_DEBUG" }
 // { dg-do run { target c++11 } }
 // { dg-skip-if "" { *-*-* } { "-D_GLIBCXX_PARALLEL" } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <algorithm>
 #include <functional>
diff --git a/libstdc++-v3/testsuite/25_algorithms/sample/2.cc b/libstdc++-v3/testsuite/25_algorithms/sample/2.cc
index 2d0f30a110b..c766bd93fc3 100644
--- a/libstdc++-v3/testsuite/25_algorithms/sample/2.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/sample/2.cc
@@ -17,6 +17,7 @@ 
 
 // { dg-do run { target c++17 } }
 // { dg-require-cstdint "" }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #ifndef _GLIBCXX_ASSERTIONS
 // Make std::uniform_int_distribution check its parameters
diff --git a/libstdc++-v3/testsuite/25_algorithms/upper_bound/partitioned.cc b/libstdc++-v3/testsuite/25_algorithms/upper_bound/partitioned.cc
index 6d4f0ef8a90..0a1e7e06403 100644
--- a/libstdc++-v3/testsuite/25_algorithms/upper_bound/partitioned.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/upper_bound/partitioned.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-D_GLIBCXX_DEBUG" }
 // { dg-do run { target c++11 } }
 // { dg-skip-if "" { *-*-* } { "-D_GLIBCXX_PARALLEL" } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <algorithm>
 #include <functional>
diff --git a/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc b/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc
index 67aa736ac8e..eef53493ccd 100644
--- a/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc
@@ -18,6 +18,7 @@ 
 // { dg-options "-std=gnu++2a -D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { target c++2a } }
 // { dg-xfail-run-if "__glibcxx_assert in bit_ceil should fail" { *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <bit>
 #include <limits>
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/mask-1_neg.cc b/libstdc++-v3/testsuite/26_numerics/valarray/mask-1_neg.cc
index 7ef11736d96..01be43f187a 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/mask-1_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/mask-1_neg.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <valarray>
 
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/mask-2_neg.cc b/libstdc++-v3/testsuite/26_numerics/valarray/mask-2_neg.cc
index f380dba17a9..882d99f1345 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/mask-2_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/mask-2_neg.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <valarray>
 
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/mask-3_neg.cc b/libstdc++-v3/testsuite/26_numerics/valarray/mask-3_neg.cc
index 0b9e6fb366d..9e87bf48300 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/mask-3_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/mask-3_neg.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <valarray>
 
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/mask-4_neg.cc b/libstdc++-v3/testsuite/26_numerics/valarray/mask-4_neg.cc
index b996967f4ce..a01dda2fb3e 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/mask-4_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/mask-4_neg.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <valarray>
 
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/mask-5_neg.cc b/libstdc++-v3/testsuite/26_numerics/valarray/mask-5_neg.cc
index 8e708903b00..f513744de9d 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/mask-5_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/mask-5_neg.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <valarray>
 
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/mask-6_neg.cc b/libstdc++-v3/testsuite/26_numerics/valarray/mask-6_neg.cc
index cded68c45b4..f4954e5d171 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/mask-6_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/mask-6_neg.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <valarray>
 
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/mask-7_neg.cc b/libstdc++-v3/testsuite/26_numerics/valarray/mask-7_neg.cc
index 246977b8a8f..1858e594613 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/mask-7_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/mask-7_neg.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <valarray>
 
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/mask-8_neg.cc b/libstdc++-v3/testsuite/26_numerics/valarray/mask-8_neg.cc
index 70f9ea25318..0d28c800540 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/mask-8_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/mask-8_neg.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run { xfail *-*-* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <valarray>
 
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/mask.cc b/libstdc++-v3/testsuite/26_numerics/valarray/mask.cc
index cb18701033e..0312bbe9a6c 100644
--- a/libstdc++-v3/testsuite/26_numerics/valarray/mask.cc
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/mask.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-D_GLIBCXX_ASSERTIONS" }
 // { dg-do run }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <valarray>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc b/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
index c4ab876db2a..2e7ff0307bc 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-std=gnu++20" }
 // { dg-do run { target c++20 } }
+// { dg-require-thread-fence "" }
 // { dg-add-options libatomic }
 
 #include <atomic>
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc
index 47d5a5d5b28..b8019486ccf 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc
@@ -17,6 +17,7 @@ 
 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { target c++2a } }
+// { dg-require-thread-fence "" }
 
 #include <atomic>
 
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc b/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc
index 1cd1efb5422..6e89f2fc2a8 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc
@@ -17,6 +17,7 @@ 
 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { target c++2a } }
+// { dg-require-thread-fence "" }
 // { dg-add-options libatomic }
 
 #include <atomic>
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/value_init.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/value_init.cc
index 96615a7d09f..2f6a48d36d8 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/value_init.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/value_init.cc
@@ -17,6 +17,7 @@ 
 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { target c++2a } }
+// { dg-require-thread-fence "" }
 
 #include <atomic>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc
index 0dab8a23e10..8469ebf8a14 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc
@@ -1,5 +1,6 @@ 
 // { dg-options "-std=gnu++20" }
 // { dg-do run { target c++20 } }
+// { dg-require-thread-fence "" }
 // { dg-add-options libatomic }
 
 #include <atomic>
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc
index 14f417d1739..adae07f8754 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc
@@ -17,6 +17,7 @@ 
 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { target c++2a } }
+// { dg-require-thread-fence "" }
 // { dg-add-options libatomic }
 
 #include <atomic>
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/integral.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/integral.cc
index e03ca921eb9..a98adb7fbba 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/integral.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/integral.cc
@@ -17,6 +17,7 @@ 
 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { target c++2a } }
+// { dg-require-thread-fence "" }
 // { dg-add-options libatomic }
 
 #include <atomic>
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/pointer.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/pointer.cc
index 8cd0e124986..b9c7d844b8c 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/pointer.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/pointer.cc
@@ -17,6 +17,7 @@ 
 
 // { dg-options "-std=gnu++2a" }
 // { dg-do run { target c++2a } }
+// { dg-require-thread-fence "" }
 // { dg-add-options libatomic }
 
 #include <atomic>
diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
index cb818708aef..372ed6e0c00 100644
--- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
+++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
@@ -18,6 +18,7 @@ 
 // { dg-do run { target c++14 } }
 // { dg-add-options libatomic }
 // { dg-xfail-if "poll not available" { *-*-rtems* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <experimental/timer>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
index ae51979c3b4..8383e0be6a4 100644
--- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
+++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
@@ -18,6 +18,7 @@ 
 // { dg-do run { target c++14 } }
 // { dg-add-options libatomic }
 // { dg-xfail-if "poll not available" { *-*-rtems* } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <experimental/timer>
 #include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
index 960c1d253b5..42de45619a8 100644
--- a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
+++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
@@ -16,6 +16,7 @@ 
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do run { target c++14 } }
+// { dg-require-thread-fence "" } // needed by __gnu_debug::_Safe_sequence_base::_M_detach_all()
 
 #include <experimental/memory_resource>
 #include <utility>