Commit Graph

178627 Commits

Author SHA1 Message Date
Gerald Pfeifer
d1da25fe99 libstdc++: ParallelSTL is now part of oneAPI DPC++ Library
libstdc++-v3:
2020-07-31  Gerald Pfeifer  <gerald@pfeifer.com>

	* doc/xml/manual/status_cxx2017.xml: ParallelSTL is now part
	of oneAPI DPC++ Library on Github.
	* doc/html/manual/status.html: Regenerate.
2020-07-31 23:19:37 +02:00
François Dumont
6f00ccbad3 libstdc++: Fix and improve std::vector<bool> implementation.
Do not consider allocator noexcept qualification for vector<bool> move
constructor.
Improve swap performance using TBAA like in main vector implementation. Bypass
_M_initialize_dispatch/_M_assign_dispatch in post-c++11 modes.

libstdc++-v3/ChangeLog:

	* include/bits/stl_bvector.h
	[_GLIBCXX_INLINE_VERSION](_Bvector_impl_data::_M_start): Define as
	_Bit_type*.
	(_Bvector_impl_data(const _Bvector_impl_data&)): Default.
	(_Bvector_impl_data(_Bvector_impl_data&&)): Delegate to latter.
	(_Bvector_impl_data::operator=(const _Bvector_impl_data&)): Default.
	(_Bvector_impl_data::_M_move_data(_Bvector_impl_data&&)): Use latter.
	(_Bvector_impl_data::_M_reset()): Likewise.
	(_Bvector_impl_data::_M_swap_data): New.
	(_Bvector_impl::_Bvector_impl(_Bvector_impl&&)): Implement explicitely.
	(_Bvector_impl::_Bvector_impl(_Bit_alloc_type&&, _Bvector_impl&&)): New.
	(_Bvector_base::_Bvector_base(_Bvector_base&&, const allocator_type&)):
	New, use latter.
	(vector::vector(vector&&, const allocator_type&, true_type)): New, use
	latter.
	(vector::vector(vector&&, const allocator_type&, false_type)): New.
	(vector::vector(vector&&, const allocator_type&)): Use latters.
	(vector::vector(const vector&, const allocator_type&)): Adapt.
	[__cplusplus >= 201103](vector::vector(_InputIt, _InputIt,
	const allocator_type&)): Use _M_initialize_range.
	(vector::operator[](size_type)): Use iterator operator[].
	(vector::operator[](size_type) const): Use const_iterator operator[].
	(vector::swap(vector&)): Add assertions on allocators. Use _M_swap_data.
	[__cplusplus >= 201103](vector::insert(const_iterator, _InputIt,
	_InputIt)): Use _M_insert_range.
	(vector::_M_initialize(size_type)): Adapt.
	[__cplusplus >= 201103](vector::_M_initialize_dispatch): Remove.
	[__cplusplus >= 201103](vector::_M_insert_dispatch): Remove.
	* python/libstdcxx/v6/printers.py (StdVectorPrinter._iterator): Stop
	using start _M_offset.
	(StdVectorPrinter.to_string): Likewise.
	* testsuite/23_containers/vector/bool/allocator/swap.cc: Adapt.
	* testsuite/23_containers/vector/bool/cons/noexcept_move_construct.cc:
	Add check.
2020-07-31 23:18:51 +02:00
Jakub Jelinek
5f9669d9e2 c++: Use error_at rather than warning_at for missing return in constexpr functions [PR96182]
For C++11 we already emit an error if a constexpr function doesn't contain
a return statement, because in C++11 that is the only thing it needs to
contain, but for C++14 we would normally issue a -Wreturn-type warning.

As mentioned by Jonathan, such constexpr functions are invalid, no
diagnostics required, because there doesn't exist any arguments for
which it would result in valid constant expression.

This raises it to an error in such cases.  The !LAMBDA_TYPE_P case
is to avoid error on g++.dg/pr81194.C where the user didn't write
constexpr anywhere and the operator() is compiler generated.

2020-07-31  Jakub Jelinek  <jakub@redhat.com>

	PR c++/96182
	* decl.c (finish_function): In constexpr functions use for C++14 and
	later error instead of warning if no return statement is present and
	diagnose it regardless of warn_return_type.  Move the warn_return_type
	diagnostics earlier in the function.

	* g++.dg/cpp1y/constexpr-96182.C: New test.
	* g++.dg/other/error35.C (S<T>::g()): Add return statement.
	* g++.dg/cpp1y/pr63996.C (foo): Likewise.
	* g++.dg/cpp1y/constexpr-return2.C (f): Likewise.
	* g++.dg/cpp1y/var-templ44.C (make_array): Add throw 1.
2020-07-31 23:08:00 +02:00
Jonathan Wakely
8011f718e2 libstdc++: Fix tests that fail for C++98
libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_istream/ignore/char/94749.cc: Use 0
	instead of nullptr.
	* testsuite/27_io/basic_istream/ignore/wchar_t/94749.cc:
	Likewise.
2020-07-31 19:58:36 +01:00
Jonathan Wakely
f07fa7a31c libstdc++: Fix test that fails for C++98
Local classes have no linkage so cannot be used as template arguments in
C++98.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/specialized_algorithms/uninitialized_fill_n/sizes.cc:
	Move struct to namespace scope.
2020-07-31 19:58:03 +01:00
Jonathan Wakely
dc8c00966e libstdc++: Avoid using __float128 in strict modes
libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/numbers/float128.cc: Check
	__STRICT_ANSI__ before using __float128.
	* testsuite/std/concepts/concepts.lang/concept.arithmetic/floating_point.cc:
	Likewise.
2020-07-31 19:58:03 +01:00
Jonathan Wakely
9d613af2b4 libstdc++: Ensure c++NN effective-target present in more tests
Add effective-target keywords to tests that would fail for certain
standard modes without the -std=gnu++NN option.

libstdc++-v3/ChangeLog:

	* testsuite/18_support/set_terminate.cc: Require C++11 or
	higher.
	* testsuite/28_regex/simple_c++11.cc: Likewise.
	* testsuite/tr1/headers/c++200x/complex.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis.cc:
	Require C++14 or lower.
2020-07-31 19:58:03 +01:00
Jonathan Wakely
a92e0f58d8 libstdc++: Add dg-require-effective-target to std::span assert tests
The current dg directives say that the tests can run for any standard
mode, but should fail for C++20. What we want is that they only run for
C++20, and are always expected to fail.

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/span/back_assert_neg.cc: Split c++2a
	effective-target from xfail selector.
	* 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.
2020-07-31 19:58:02 +01:00
Jonathan Wakely
566f422734 libstdc++: Use c++NN_only effective target to tests
Some tests really are only intended for a specific -std mode, so add a
target selector to make that explicit.

Also reorder the dg-do directives to come after the dg-options ones, so
that the target selector in the dg-do directive is applied after the
dg-options that sets the -std option.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/reference_wrapper/83427.cc: Adjust
	effective-target to specific language mode only.
	* testsuite/24_iterators/headers/iterator/range_access_c++11.cc:
	Likewise.
	* testsuite/24_iterators/headers/iterator/range_access_c++14.cc:
	Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++11.cc:
	Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++14.cc:
	Likewise.
	* testsuite/26_numerics/valarray/69116.cc:
	Likewise.
	* testsuite/30_threads/headers/condition_variable/std_c++0x_neg.cc:
	Remove whitespace at end of file.
	* testsuite/30_threads/headers/future/std_c++0x_neg.cc:
	Likewise.
2020-07-31 19:58:02 +01:00
Jonathan Wakely
6458742a15 libstdc++: Ensure c++NN effective target present in all C++17 tests
Also reorder some directives so that the dg-options setting -std=gnu++17
comes before the dg-do that requires c++17.

libstdc++-v3/ChangeLog:

	* testsuite/17_intro/headers/c++2017/all_attributes.cc: Add
	c++17 effective-target.
	* testsuite/17_intro/headers/c++2017/all_no_exceptions.cc:
	Likewise.
	* testsuite/17_intro/headers/c++2017/all_no_rtti.cc: Likewise.
	* testsuite/17_intro/headers/c++2017/all_pedantic_errors.cc:
	Likewise.
	* testsuite/17_intro/headers/c++2017/operator_names.cc:
	Likewise.
	* testsuite/17_intro/headers/c++2017/stdc++.cc: Likewise.
	* testsuite/17_intro/headers/c++2017/stdc++_multiple_inclusion.cc:
	Likewise.
	* testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc:
	Likewise.
	* testsuite/19_diagnostics/error_code/is_error_code_v.cc:
	Likewise.
	* testsuite/20_util/any/assign/1.cc: Likewise.
	* testsuite/20_util/any/assign/2.cc: Likewise.
	* testsuite/20_util/any/assign/emplace.cc: Likewise.
	* testsuite/20_util/any/assign/exception.cc: Likewise.
	* testsuite/20_util/any/assign/self.cc: Likewise.
	* testsuite/20_util/any/cons/1.cc: Likewise.
	* testsuite/20_util/any/cons/2.cc: Likewise.
	* testsuite/20_util/any/cons/aligned.cc: Likewise.
	* testsuite/20_util/any/cons/explicit.cc: Likewise.
	* testsuite/20_util/any/cons/in_place.cc: Likewise.
	* testsuite/20_util/any/cons/nontrivial.cc: Likewise.
	* testsuite/20_util/any/make_any.cc: Likewise.
	* testsuite/20_util/any/misc/any_cast.cc: Likewise.
	* testsuite/20_util/any/misc/any_cast_no_rtti.cc: Likewise.
	* testsuite/20_util/any/misc/swap.cc: Likewise.
	* testsuite/20_util/any/modifiers/1.cc: Likewise.
	* testsuite/20_util/any/observers/type.cc: Likewise.
	* testsuite/20_util/any/requirements.cc: Likewise.
	* testsuite/20_util/any/typedefs.cc: Likewise.
	* testsuite/20_util/as_const/1.cc: Likewise.
	* testsuite/20_util/as_const/rvalue_neg.cc: Likewise.
	* testsuite/20_util/bind/is_placeholder_v.cc: Likewise.
	* testsuite/20_util/bool_constant/requirements.cc: Likewise.
	* testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc:
	Likewise.
	* testsuite/20_util/duration_cast/rounding.cc: Likewise.
	* testsuite/20_util/enable_shared_from_this/members/weak_from_this.cc:
	Likewise.
	* testsuite/20_util/function_objects/invoke/59768.cc: Likewise.
	* testsuite/20_util/function_objects/not_fn/1.cc: Likewise.
	* testsuite/20_util/function_objects/searchers.cc: Likewise.
	* testsuite/20_util/in_place/requirements.cc: Likewise.
	* testsuite/20_util/is_invocable/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_invocable/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_invocable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_invocable/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_invocable/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable_with/value.cc:
	Likewise.
	* testsuite/20_util/is_swappable/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_swappable/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_swappable/value.cc: Likewise.
	* testsuite/20_util/is_swappable_with/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_swappable_with/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_swappable_with/value.cc: Likewise.
	* testsuite/20_util/logical_traits/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/logical_traits/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/logical_traits/value.cc: Likewise.
	* testsuite/20_util/optional/constexpr/make_optional.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/2.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/3.cc: Likewise.
	* testsuite/20_util/optional/hash.cc: Likewise.
	* testsuite/20_util/pair/swap_cxx17.cc: Likewise.
	* testsuite/20_util/ratio/requirements/ratio_equal_v.cc: Likewise.
	* testsuite/20_util/shared_ptr/requirements/weak_type.cc:
	Likewise.
	* testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc:
	Likewise.
	* testsuite/20_util/tuple/apply/1.cc: Likewise.
	* testsuite/20_util/tuple/make_from_tuple/1.cc: Likewise.
	* testsuite/20_util/tuple/swap_cxx17.cc: Likewise.
	* testsuite/20_util/tuple/tuple_size_v.cc: Likewise.
	* testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc:
	Likewise.
	* testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc:
	Likewise.
	* testsuite/20_util/variant/any.cc: Likewise.
	* testsuite/20_util/variant/compile.cc: Likewise.
	* testsuite/20_util/variant/hash.cc: Likewise.
	* testsuite/20_util/variant/index_type.cc: Likewise.
	* testsuite/20_util/variant/run.cc: Likewise.
	* testsuite/20_util/void_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string/79162.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/char/7.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/7.cc: Likewise.
	* testsuite/21_strings/basic_string/lwg2758.cc: Likewise.
	* testsuite/21_strings/basic_string/lwg2946.cc: Likewise.
	* testsuite/21_strings/basic_string/modifiers/append/char/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/append/wchar_t/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/assign/char/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/assign/wchar_t/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/insert/char/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/insert/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/replace/char/7.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/replace/wchar_t/7.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operations/compare/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operations/compare/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operations/data/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operations/data/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operations/find/char/5.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operations/find/wchar_t/5.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operators/char/5.cc: Likewise.
	* testsuite/21_strings/basic_string/operators/wchar_t/5.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/capacity/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/cons/char/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/cons/char/2.cc: Likewise.
	* testsuite/21_strings/basic_string_view/cons/char/3.cc: Likewise.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/char/empty.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/char/front_back.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/empty.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/front_back.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/include.cc: Likewise.
	* testsuite/21_strings/basic_string_view/inserters/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/char/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/pod/10081-out.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/literals/types-char8_t.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/literals/types.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/literals/values-char8_t.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/literals/values.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/13650.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/13650.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/copy/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/data/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/data/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/char/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/string_conversion/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/substr/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/substr/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/range_access/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char16_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char32_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char8_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/typedefs.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/typedefs.cc: Likewise.
	* testsuite/21_strings/basic_string_view/types/1.cc: Likewise.
	* testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc:
	Likewise.
	* testsuite/23_containers/map/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/map/modifiers/insert_or_assign/1.cc:
	Likewise.
	* testsuite/23_containers/map/modifiers/merge.cc: Likewise.
	* testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise.
	* testsuite/23_containers/multimap/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/multimap/modifiers/merge.cc: Likewise.
	* testsuite/23_containers/multiset/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/multiset/modifiers/merge.cc: Likewise.
	* testsuite/23_containers/set/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/set/modifiers/merge.cc: Likewise.
	* testsuite/23_containers/unordered_map/modifiers/extract.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/modifiers/insert_or_assign.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/modifiers/merge.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/modifiers/try_emplace.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/modifiers/extract.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/modifiers/merge.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/modifiers/extract.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/modifiers/merge.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/modifiers/extract.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/modifiers/merge.cc:
	Likewise.
	* testsuite/24_iterators/headers/iterator/range_access_c++17.cc:
	Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++17.cc:
	Likewise.
	* testsuite/25_algorithms/clamp/1.cc: Likewise.
	* testsuite/25_algorithms/clamp/2.cc: Likewise.
	* testsuite/25_algorithms/clamp/constexpr.cc: Likewise.
	* testsuite/25_algorithms/clamp/requirements/explicit_instantiation/1.cc:
	Likewise.
	* testsuite/25_algorithms/clamp/requirements/explicit_instantiation/pod.cc:
	Likewise.
	* testsuite/26_numerics/headers/cmath/functions_std_c++17.cc:
	Likewise.
	* testsuite/26_numerics/headers/cmath/special_functions_global.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/lwg2221.cc:
	Likewise.
	* testsuite/29_atomics/atomic/is_always_lock_free.cc: Likewise.
	* testsuite/29_atomics/atomic_integral/is_always_lock_free.cc:
	Likewise.
	* testsuite/30_threads/shared_lock/70766.cc: Likewise.
	* testsuite/30_threads/shared_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/shared_mutex/cons/assign_neg.cc:
	Likewise.
	* testsuite/30_threads/shared_mutex/cons/copy_neg.cc:
	Likewise.
	* testsuite/30_threads/shared_mutex/requirements/standard_layout.cc:
	Likewise.
	* testsuite/30_threads/shared_mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/shared_mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/shared_mutex/unlock/1.cc: Likewise.
2020-07-31 19:58:02 +01:00
Jonathan Wakely
8abab28bb5 libstdc++: Remove condition around friend declaration (PR 96382)
libstdc++-v3/ChangeLog:

	PR libstdc++/96382
	* include/bits/stl_iterator.h (reverse_iterator): Friend
	declaration should not depend on __cplusplus.
2020-07-31 19:55:46 +01:00
Roger Sayle
3a4a925980 nvptx: Define TARGET_TRULY_NOOP_TRUNCATION to false
Many thanks to Richard Biener for approving the midde-end
patch that cleared the way for this one.  This nvptx patch
defines the target hook TARGET_TRULY_NOOP_TRUNCATION to
false, indicating that integer truncations require explicit
instructions.  nvptx.c already defines TARGET_MODES_TIEABLE_P
and TARGET_CAN_CHANGE_MODE_CLASS to false, and as (previously)
documented that may require TARGET_TRULY_NOOP_TRUNCATION to
be defined likewise.

This patch decreases the number of unexpected failures in
the testsuite by 10, and increases the number of expected
passes by 4, including these previous FAILs/ICEs:
gcc.c-torture/compile/opout.c
gcc.dg/torture/pr79125.c
gcc.dg/tree-ssa/pr92085-1.c

Unfortunately there is one testsuite failure that used to
pass gcc.target/nvptx/v2si-cvt.c, but this isn't an ICE or
incorrect code.  This regression has been filed as PR96403,
and the failing scan-assembler directives have been replaced
by a reference to the PR.

This patch has been tested on nvptx-none hosted on
x86_64-pc-linux-gnu with "make" and "make check" with
fewer ICEs and no wrong code regressions.

2020-07-31  Roger Sayle  <roger@nextmovesoftware.com>
	    Tom de Vries  <tdevries@suse.de>

gcc/ChangeLog:

	PR target/90928
	* config/nvptx/nvptx.c (nvptx_truly_noop_truncation): Implement.
	(TARGET_TRULY_NOOP_TRUNCATION): Define.

gcc/testsuite/ChangeLog:

	* gcc.target/nvptx/v2si-cvt.c: Simplify source.  Remove
	scan-assembler directives.  Mention PR96403.
2020-07-31 19:12:25 +02:00
Jonathan Wakely
ed0b4bb29a libstdc++: Remove accidental -std=gnu++17 from test
This was probably copied from a std::filesystem test and the -std option
wasn't removed.

libstdc++-v3/ChangeLog:

	* testsuite/experimental/filesystem/filesystem_error/cons.cc:
	Remove -std=gnu++17 option.
2020-07-31 18:02:10 +01:00
Jonathan Wakely
8e2592a888 libstdc++: Adjust tests that give different results in C++20
libstdc++-v3/ChangeLog:

	* testsuite/20_util/is_aggregate/value.cc: Adjust for changes to
	definition of aggregates in C++20.
	* testsuite/20_util/optional/requirements.cc: Adjust for
	defaulted comparisons in C++20.
2020-07-31 17:51:00 +01:00
Jonathan Wakely
95edead9aa libstdc++: Add -Wno-deprecated for tests that warn in C++20
libstdc++-v3/ChangeLog:

	* testsuite/20_util/tuple/78939.cc: Suppress warnings about
	deprecation of volatile-qualified structured bindings in C++20.
	* testsuite/20_util/variable_templates_for_traits.cc: Likewise
	for deprecation of is_pod in C++20
2020-07-31 17:51:00 +01:00
Jonathan Wakely
351f60794c libstdc++: Remove duplicate dg-do directive
Also add an effective target to clarify it should only run for C++17 and
later.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/time_point_cast/rounding.cc: Remove
	duplicate dg-do directive and add c++17 effective target.
2020-07-31 17:51:00 +01:00
Iain Buclaw
844fa2de7b d: Split up the grouped compilable and runnable tests.
The majority of tests in runnable are really compilable/ICE tests, and
have have dg-do adjusted where necessary.  Tests that had a dependency
on Phobos have also been reproduced and reduced with all imports
stripped from the test.

The end result is a collection of tests that only check the compiler bug
that was being fixed, rather than the library, and a reduction in time
spent running all tests.

gcc/testsuite/ChangeLog:

	* gdc.dg/compilable.d: Removed.
	* gdc.dg/gdc108.d: New test.
	* gdc.dg/gdc115.d: New test.
	* gdc.dg/gdc121.d: New test.
	* gdc.dg/gdc122.d: New test.
	* gdc.dg/gdc127.d: New test.
	* gdc.dg/gdc131.d: New test.
	* gdc.dg/gdc133.d: New test.
	* gdc.dg/gdc141.d: New test.
	* gdc.dg/gdc142.d: New test.
	* gdc.dg/gdc15.d: New test.
	* gdc.dg/gdc17.d: New test.
	* gdc.dg/gdc170.d: New test.
	* gdc.dg/gdc171.d: New test.
	* gdc.dg/gdc179.d: New test.
	* gdc.dg/gdc183.d: New test.
	* gdc.dg/gdc186.d: New test.
	* gdc.dg/gdc187.d: New test.
	* gdc.dg/gdc19.d: New test.
	* gdc.dg/gdc191.d: New test.
	* gdc.dg/gdc194.d: New test.
	* gdc.dg/gdc196.d: New test.
	* gdc.dg/gdc198.d: New test.
	* gdc.dg/gdc200.d: New test.
	* gdc.dg/gdc204.d: New test.
	* gdc.dg/gdc210.d: New test.
	* gdc.dg/gdc212.d: New test.
	* gdc.dg/gdc213.d: New test.
	* gdc.dg/gdc218.d: New test.
	* gdc.dg/gdc223.d: New test.
	* gdc.dg/gdc231.d: New test.
	* gdc.dg/gdc239.d: New test.
	* gdc.dg/gdc24.d: New test.
	* gdc.dg/gdc240.d: New test.
	* gdc.dg/gdc241.d: New test.
	* gdc.dg/gdc242a.d: New test.
	* gdc.dg/gdc242b.d: New test.
	* gdc.dg/gdc248.d: New test.
	* gdc.dg/gdc250.d: New test.
	* gdc.dg/gdc251.d: New test.
	* gdc.dg/gdc253a.d: New test.
	* gdc.dg/gdc253b.d: New test.
	* gdc.dg/gdc255.d: New test.
	* gdc.dg/gdc256.d: New test.
	* gdc.dg/gdc261.d: New test.
	* gdc.dg/gdc27.d: New test.
	* gdc.dg/gdc273.d: New test.
	* gdc.dg/gdc280.d: New test.
	* gdc.dg/gdc284.d: New test.
	* gdc.dg/gdc285.d: New test.
	* gdc.dg/gdc286.d: New test.
	* gdc.dg/gdc300.d: New test.
	* gdc.dg/gdc309.d: New test.
	* gdc.dg/gdc31.d: New test.
	* gdc.dg/gdc35.d: New test.
	* gdc.dg/gdc36.d: New test.
	* gdc.dg/gdc37.d: New test.
	* gdc.dg/gdc4.d: New test.
	* gdc.dg/gdc43.d: New test.
	* gdc.dg/gdc47.d: New test.
	* gdc.dg/gdc51.d: New test.
	* gdc.dg/gdc57.d: New test.
	* gdc.dg/gdc66.d: New test.
	* gdc.dg/gdc67.d: New test.
	* gdc.dg/gdc71.d: New test.
	* gdc.dg/gdc77.d: New test.
	* gdc.dg/imports/gdc239.d: Remove phobos dependency.
	* gdc.dg/imports/gdc241a.d: Updated imports.
	* gdc.dg/imports/gdc241b.d: Likewise.
	* gdc.dg/imports/gdc251a.d: Likewise.
	* gdc.dg/imports/gdc253.d: Rename to...
	* gdc.dg/imports/gdc253a.d: ...this.
	* gdc.dg/imports/gdc253b.d: New.
	* gdc.dg/imports/gdc36.d: New.
	* gdc.dg/imports/runnable.d: Removed.
	* gdc.dg/link.d: Removed.
	* gdc.dg/runnable.d: Removed.
	* gdc.dg/runnable2.d: Removed.
	* gdc.dg/simd.d: Remove phobos dependency.
2020-07-31 18:43:23 +02:00
Iain Buclaw
239724956d d: Fix regression, all 32-bit execution tests FAIL: internal error printing module cycle
For 32-bit btr(), BIT_NOT_EXPR was being generated twice, something that
was not seen with the 64-bit variant.  Removed the second call to fix
the generated code.

gcc/d/ChangeLog:

	PR d/96393
	* intrinsics.cc (expand_intrinsic_bt): Don't generate BIT_NOT_EXPR for
	btr32 intrinsic.
2020-07-31 18:43:23 +02:00
Martin Sebor
df5cf47a97 Set and test no-warning bit to avoid -Wnonnull for synthesized expressions.
Resolves:
PR c++/96003 spurious -Wnonnull calling a member on the result of static_cast

gcc/c-family/ChangeLog:

	PR c++/96003
	* c-common.c (check_function_arguments_recurse): Return early when
	no-warning bit is set.

gcc/cp/ChangeLog:

	PR c++/96003
	* class.c (build_base_path): Set no-warning bit on the synthesized
	conditional expression in static_cast.

gcc/testsuite/ChangeLog:

	PR c++/96003
	* g++.dg/warn/Wnonnull7.C: New test.
2020-07-31 10:27:33 -06:00
Jonathan Wakely
4143efc1ee libstdc++: Fix use of newlocale in std:::from_chars
libstdc++-v3/ChangeLog:

	* src/c++17/floating_from_chars.cc (from_chars_impl): Use
	LC_ALL_MASK not LC_ALL.
2020-07-31 14:36:56 +01:00
Richard Biener
c6ef9d8d3f debug/96383 - emit debug info for used external functions
This makes sure to emit full declaration DIEs including
formal parameters for used external functions.  This helps
debugging when debug information of the external entity is
not available and also helps external tools cross-checking
ABI compatibility which was the bug reporters use case.

For cc1 this affects debug information size as follows:

     VM SIZE                     FILE SIZE
 ++++++++++++++ GROWING       ++++++++++++++
  [ = ]       0 .debug_info   +1.63Mi  +1.3%
  [ = ]       0 .debug_str     +263Ki  +3.4%
  [ = ]       0 .debug_abbrev  +101Ki  +4.9%
  [ = ]       0 .debug_line   +5.71Ki  +0.0%
   +44%     +16 [Unmapped]        +48  +1.2%

 -------------- SHRINKING     --------------
  [ = ]       0 .debug_loc       -213  -0.0%
  -0.0%     -48 .text             -48  -0.0%
  [ = ]       0 .debug_ranges     -16  -0.0%

  -0.0%     -32 TOTAL         +1.99Mi  +0.6%

and DWARF compression via DWZ can only shave off minor bits
here.

Previously we emitted no DIEs for external functions at all
unless they were referenced via DW_TAG_GNU_call_site which
for some GCC revs caused a regular DIE to appear and since
GCC 4.9 only a stub without formal parameters.  This means
at -O0 we did not emit any DIE for external functions
but with optimization we emitted stubs.

2020-07-30  Richard Biener  <rguenther@suse.de>

	PR debug/96383
	* langhooks-def.h (lhd_finalize_early_debug): Declare.
	(LANG_HOOKS_FINALIZE_EARLY_DEBUG): Define.
	(LANG_HOOKS_INITIALIZER): Amend.
	* langhooks.c: Include cgraph.h and debug.h.
	(lhd_finalize_early_debug): Default implementation from
	former code in finalize_compilation_unit.
	* langhooks.h (lang_hooks::finalize_early_debug): Add.
	* cgraphunit.c (symbol_table::finalize_compilation_unit):
	Call the finalize_early_debug langhook.

gcc/c-family/
	* c-common.h (c_common_finalize_early_debug): Declare.
	* c-common.c: Include debug.h.
	(c_common_finalize_early_debug): finalize_early_debug langhook
	implementation generating debug for extern declarations.

gcc/c/
	* c-objc-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
	Define to c_common_finalize_early_debug.

gcc/cp/
	* cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
	Define to c_common_finalize_early_debug.

gcc/testsuite/
	* gcc.dg/debug/dwarf2/pr96383-1.c: New testcase.
	* gcc.dg/debug/dwarf2/pr96383-2.c: Likewise.

libstdc++-v3/
	* testsuite/20_util/assume_aligned/3.cc: Use -g0.
2020-07-31 15:19:13 +02:00
Richard Biener
14c35be3bf Amend match.pd syntax with force-simplified results
This adds a ! marker to result expressions that should simplify
(and if not fail the simplification).  This can for example be
used like

(simplify
  (plus (vec_cond:s @0 @1 @2) @3)
  (vec_cond @0 (plus! @1 @3) (plus! @2 @3)))

to make the simplification only apply in case both plus operations
in the result end up simplified to a simple operand.

2020-07-31  Richard Biener  <rguenther@suse.de>

	* genmatch.c (expr::force_leaf): Add and initialize.
	(expr::gen_transform): Honor force_leaf by passing
	NULL as sequence argument to maybe_push_res_to_seq.
	(parser::parse_expr): Allow ! marker on result expression
	operations.
	* doc/match-and-simplify.texi: Amend.
2020-07-31 15:19:00 +02:00
Kewen Lin
c89366b12f vect: Don't consider branch costs if no peeled iterations
Currently vectorizer cost modeling counts branch taken costs for
prologue and epilogue if the number of iterations is unknown.
But it isn't sensible if there are no peeled iterations.

This patch is to guard them under peel_iters_prologue > 0 or
peel_iters_epilogue > 0.

Bootstrapped/regtested on powerpc64le-linux-gnu and aarch64-linux-gnu.

gcc/ChangeLog:

	* tree-vect-loop.c (vect_get_known_peeling_cost): Don't consider branch
	taken costs for prologue and epilogue if they don't exist.
	(vect_estimate_min_profitable_iters): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/sve/cost_model_2.c: Adjust due to cost model
	change.
2020-07-31 08:16:42 -05:00
Jonathan Wakely
89db36b05e libstdc++: Add PR number to ChangeLog entry 2020-07-31 14:15:43 +01:00
Martin Liska
8bd062e8ad Do not allocate huge array in output_in_order.
We noticed that when analyzing LTRANS memory peak that happens right
after the start:
https://gist.github.com/marxin/223890df4d8d8e490b6b2918b77dacad

In case of chrome, we have symtab->order == 200M, so we allocate
16B * 200M = 3.2GB.

gcc/ChangeLog:

	* cgraph.h: Remove leading empty lines.
	* cgraphunit.c (enum cgraph_order_sort_kind): Remove
	ORDER_UNDEFINED.
	(struct cgraph_order_sort): Add constructors.
	(cgraph_order_sort::process): New.
	(cgraph_order_cmp): New.
	(output_in_order): Simplify and push nodes to vector.
2020-07-31 12:14:38 +02:00
Richard Biener
10231958fc middle-end/96369 - fix missed short-circuiting during range folding
This makes the special case of constant evaluated LHS for a
short-circuiting or/and explicit rather than doing range
merging and eventually exposing a side-effect that shouldn't be
evaluated.

2020-07-31  Richard Biener  <rguenther@suse.de>

	PR middle-end/96369
	* fold-const.c (fold_range_test): Special-case constant
	LHS for short-circuiting operations.

	* c-c++-common/pr96369.c: New testcase.
2020-07-31 12:05:26 +02:00
Martin Liska
bc2b1a232b libgcov: support overloaded malloc
gcc/ChangeLog:

	* gcov-io.h (GCOV_PREALLOCATED_KVP): New.

libgcc/ChangeLog:

	* libgcov-driver.c: Add __gcov_kvp_pool
	and __gcov_kvp_pool_index variables.
	* libgcov.h (allocate_gcov_kvp): New.
	(gcov_topn_add_value): Use it.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-prof/indir-call-prof-malloc.c: New test.
2020-07-31 10:57:50 +02:00
xiezhiheng
072a8b8fb6 AArch64: Add attributes according to flags in built-in functions [PR94442]
2020-07-31  Zhiheng Xie  <xiezhiheng@huawei.com>

gcc/ChangeLog:

	* config/aarch64/aarch64-builtins.c (aarch64_general_add_builtin):
	Add new argument ATTRS.
	(aarch64_call_properties): New function.
	(aarch64_modifies_global_state_p): Likewise.
	(aarch64_reads_global_state_p): Likewise.
	(aarch64_could_trap_p): Likewise.
	(aarch64_add_attribute): Likewise.
	(aarch64_get_attributes): Likewise.
	(aarch64_init_simd_builtins): Add attributes for each built-in function.
2020-07-31 09:52:25 +01:00
Richard Biener
1212cfad09 Improve var-tracking dataflow iteration order
This builds upon the rev_post_order_and_mark_dfs_back_seme improvements
and makes vt_find_locations iterate over the dataflow problems for
each toplevel SCC separately, improving memory locality and avoiding
to process nodes after the SCC before the SCC itself stabilized.

On the asan_interceptors.cc testcase this for example reduces the
number of visited blocks from 3751 to 2867.  For stage3-gcc
this reduces the number of visited blocks by ~4%.

2020-07-28  Richard Biener  <rguenther@suse.de>

	PR debug/78288
	* var-tracking.c (vt_find_locations): Use
	rev_post_order_and_mark_dfs_back_seme and separately iterate
	over toplevel SCCs.
2020-07-31 08:22:45 +02:00
Richard Biener
3e61a20563 Compute RPO with adjacent SCC members, expose toplevel SCC extents
This produces a more optimal RPO order for iteration processing
by making sure that SCC exits are processed before SCC members
themselves..  This avoids iterating blocks unrelated to the current
iteration for RPO VN and has the chance to improve code-generation
for the non-iterative mode of RPO VN.  The patch also exposes toplevel
SCCs and gets rid of the ad-hoc max_rpo computation in RPO VN.

For simplicity it also removes the odd reverse ordering of the RPO
array returned from rev_post_order_and_mark_dfs_back_seme.

Overall reduction in the number of visited blocks isn't spectacular
for bootstrap (~2.5%) but single cases see up to a 10% reduction.

The same function can be used to optimize var-tracking iteration order
as seen in the followup.

2020-07-28  Richard Biener  <rguenther@suse.de>

	* cfganal.h (rev_post_order_and_mark_dfs_back_seme): Adjust
	prototype.
	* cfganal.c (rpoamdbs_bb_data): New struct with pre BB data.
	(tag_header): New helper.
	(cmp_edge_dest_pre): Likewise.
	(rev_post_order_and_mark_dfs_back_seme): Compute SCCs,
	find SCC exits and perform a DFS walk with extra edges to
	compute a RPO with adjacent SCC members when requesting an
	iteration optimized order and populate the toplevel SCC array.
	* tree-ssa-sccvn.c (do_rpo_vn): Remove ad-hoc computation
	of max_rpo and fill it in from SCC extent info instead.

	* gcc.dg/torture/20200727-0.c: New testcase.
2020-07-31 08:22:45 +02:00
Patrick Palka
8c00059ce0 c++: decl_constant_value and unsharing [PR96197]
In the testcase from the PR we're seeing excessive memory use (> 5GB)
during constexpr evaluation, almost all of which is due to the call to
decl_constant_value in the VAR_DECL/CONST_DECL branch of
cxx_eval_constant_expression.  We reach here every time we evaluate an
ARRAY_REF of a constexpr VAR_DECL, and from there decl_constant_value
makes an unshared copy of the VAR_DECL's initializer.  But unsharing
here is unnecessary because callers of cxx_eval_constant_expression
already unshare its result when necessary.

To fix this excessive unsharing, this patch adds a new defaulted
parameter unshare_p to decl_really_constant_value and
decl_constant_value so that callers can control whether to unshare.

As a simplification, we can also move the call to unshare_expr in
constant_value_1 outside of the loop, since doing unshare_expr on a
DECL_P is a no-op.

Now that we no longer unshare the result of decl_constant_value and
decl_really_constant_value from cxx_eval_constant_expression, memory use
during constexpr evaluation for the testcase from the PR falls from ~5GB
to 15MB according to -ftime-report.

gcc/cp/ChangeLog:

	PR c++/96197
	* constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
	Pass false to decl_constant_value and decl_really_constant_value
	so that they don't unshare their result.
	* cp-tree.h (decl_constant_value): New declaration with an added
	bool parameter.
	(decl_really_constant_value): Add bool parameter defaulting to
	true to existing declaration.
	* init.c (constant_value_1): Add bool parameter which controls
	whether to unshare the initializer before returning.  Call
	unshare_expr at most once.
	(scalar_constant_value): Pass true to constant_value_1's new
	bool parameter.
	(decl_really_constant_value): Add bool parameter and forward it
	to constant_value_1.
	(decl_constant_value): Likewise, but instead define a new
	overload with an added bool parameter.

gcc/testsuite/ChangeLog:

	PR c++/96197
	* g++.dg/cpp1y/constexpr-array8.C: New test.
2020-07-30 22:21:41 -04:00
GCC Administrator
d48cca8f21 Daily bump. 2020-07-31 00:16:26 +00:00
Iain Buclaw
7508a7e958 d: Fix associative array literals that don't have alignment holes filled
Associative array literal keys with alignment holes are now filled using
memset() prior to usage, with LTR evaluation of side-effects enforced.

gcc/d/ChangeLog:

	PR d/96152
	* d-codegen.cc (build_array_from_exprs): New function.
	* d-tree.h (build_array_from_exprs): Declare.
	* expr.cc (ExprVisitor::visit (AssocArrayLiteralExp *)): Use
	build_array_from_exprs to generate key and value arrays.

gcc/testsuite/ChangeLog:

	PR d/96152
	* gdc.dg/pr96152.d: New test.
2020-07-30 23:44:31 +02:00
Iain Buclaw
873b45d39c d: Add -Wvarargs warning flag to the D front-end
The D front-end has C-style variadic functions and va_start/va_arg, so
it is right to also have warnings for inproper use.

gcc/d/ChangeLog:

	PR d/96154
	* gdc.texi (Warnings): Document -Wvarargs.
	* lang.opt: Add -Wvarargs

gcc/testsuite/ChangeLog:

	PR d/96154
	* gdc.dg/pr96154a.d: New test.
	* gdc.dg/pr96154b.d: New test.
2020-07-30 23:44:31 +02:00
Iain Buclaw
dfc420f8d4 d: Fix ICE in expand_intrinsic_vaarg
Both intrinsics did not handle the case where the va_list object comes
from a ref parameter.

gcc/d/ChangeLog:

	PR d/96140
	* intrinsics.cc (expand_intrinsic_vaarg): Handle ref parameters as
	arguments to va_arg().
	(expand_intrinsic_vastart): Handle ref parameters as arguments to
	va_start().

gcc/testsuite/ChangeLog:

	PR d/96140
	* gdc.dg/pr96140.d: New test.
2020-07-30 23:44:31 +02:00
Jonathan Wakely
684d6ee140 libstdc++: Make COW string use allocator_traits for nested types
When compiled as C++20 the COW std::string fails due to assuming that
the allocator always defines size_type and difference_type. That has
been incorrect since C++11, but we got away with it for specializations
using std::allocator until those members were removed in C++20.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h (size_type, difference_type):
	Use allocator_traits to obtain the allocator's size_type and
	difference_type.
2020-07-30 20:58:09 +01:00
Jonathan Wakely
e513e9aa53 libstdc++: Check _GLIBCXX_USE_C99_STDLIB for strtof and strtold
On broken systems we only have strtod, not strtof and strtold. Just use
strtod for all types, even though that will produce incorrect results in
some cases.

Similarly, if _GLIBCXX_USE_C99_MATH is not defined then std::isinf won't
be declared. Just refer to it unqualified, which should find the C
library's isinf macro if that hasn't been #undef'd by <cmath>.

libstdc++-v3/ChangeLog:

	* src/c++17/floating_from_chars.cc (from_chars_impl): Use
	isinf unqualified.
	[!_GLIBCXX_USE_C99_STDLIB]: Use strtod for float and long
	double.
2020-07-30 20:55:56 +01:00
Jonathan Wakely
357beca8bc libstdc++: Fix tests using wrong allocator type
libstdc++-v3/ChangeLog:

	* testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc:
	Use allocator with the correct value type.
	* testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc:
	Likewise.
2020-07-30 18:41:59 +01:00
Will Schmidt
cf5d0fc2d1 [PATCH] RS6000 Add testlsbb by Byte operations
Add support for new instructions to test LSB by Byte.

2020-07-29  Will Schmidt  <will_schmidt@vnet.ibm.com>

gcc/ChangeLog:

	* config/rs6000/altivec.h (vec_test_lsbb_all_ones): New define.
	(vec_test_lsbb_all_zeros): New define.
	* config/rs6000/rs6000-builtin.def (BU_P10_VSX_1): New built-in
	handling macro.
	(XVTLSBB_ZEROS, XVTLSBB_ONES): New builtin defines.
	(xvtlsbb_all_zeros, xvtlsbb_all_ones): New builtin overloads.
	* config/rs6000/rs6000-call.c (P10_BUILTIN_VEC_XVTLSBB_ZEROS,
	P10_BUILTIN_VEC_XVTLSBB_ONES): New altivec_builtin_types entries.
	* config/rs6000/rs6000.md (UNSPEC_XVTLSBB):  New unspec.
	* config/rs6000/vsx.md (*xvtlsbb_internal): New instruction define.
	(xvtlsbbo, xvtlsbbz): New instruction expands.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/lsbb-runnable.c: New test.
	* gcc.target/powerpc/lsbb.c: New test.
2020-07-30 12:40:12 -05:00
Cooper Qu
c931e8d5a9 RISC-V: Add support for TLS stack protector canary access
gcc/
	* config/riscv/riscv-opts.h (stack_protector_guard): New enum.
	* config/riscv/riscv.c (riscv_option_override): Handle
	the new options.
	* config/riscv/riscv.md (stack_protect_set): New pattern to handle
	flexible stack protector guard settings.
	(stack_protect_set_<mode>): Ditto.
	(stack_protect_test): Ditto.
	(stack_protect_test_<mode>): Ditto.
	* config/riscv/riscv.opt (mstack-protector-guard=,
	mstack-protector-guard-reg=, mstack-protector-guard-offset=): New
	options.
	* doc/invoke.texi (Option Summary) [RISC-V Options]:
	Add -mstack-protector-guard=, -mstack-protector-guard-reg=, and
	-mstack-protector-guard-offset=.
	(RISC-V Options): Ditto.

Signed-off-by: cooper <cooper.qu@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
2020-07-31 00:25:52 +08:00
Iain Buclaw
febd7c43bc d: Inline bounds checking for simple array assignments.
This optimizes the code generation of simple array assignments, inlining
the array bounds checking code so there is no reliance on the library
routine _d_arraycopy(), which also deals with postblit and copy
constructors for non-trivial arrays.

gcc/d/ChangeLog:

	* expr.cc (ExprVisitor::visit (AssignExp *)): Inline bounds checking
	for simple array assignments.

gcc/testsuite/ChangeLog:

	* gdc.dg/array1.d: New test.
2020-07-30 18:02:59 +02:00
Iain Buclaw
ab0edbcb37 d: Refactor use of built-in memcmp/memcpy/memset into helper functions.
Generating calls to memset, memcpy, and memcmp is frequent enough that
it becomes beneficial to put them into their own routine.  All parts of
the front-end have been updated to call the new helper functions instead
of doing it themselves.

gcc/d/ChangeLog:

	* d-codegen.cc (build_memcmp_call): New function.
	(build_memcpy_call): New function.
	(build_memset_call): New function.
	(build_float_identity): Call build_memcmp_call.
	(lower_struct_comparison): Likewise.
	(build_struct_comparison): Likewise.
	* d-tree.h (build_memcmp_call): Declare.
	(build_memcpy_call): Declare.
	(build_memset_call): Declare.
	* expr.cc (ExprVisitor::visit (EqualExp *)): Call build_memcmp_call.
	(ExprVisitor::visit (AssignExp *)): Call build_memset_call.
	(ExprVisitor::visit (ArrayLiteralExp *)): Call build_memcpy_call.
	(ExprVisitor::visit (StructLiteralExp *)): Call build_memset_call.
2020-07-30 18:01:33 +02:00
Iain Buclaw
dc60d67674 d: Move private functions out of ExprVisitor into local statics
None of these functions need access to the context pointer of the
visitor class, so have been made free standing.

gcc/d/ChangeLog:

	* expr.cc (needs_postblit): Move out of ExprVisitor as a static
	function.  Update all callers.
	(needs_dtor): Likewise.
	(lvalue_p): Likewise.
	(binary_op): Likewise.
	(binop_assignment): Likewise.
2020-07-30 18:00:35 +02:00
Jonathan Wakely
561a19c301 libstdc++: Fix test for old string ABI
The COW string doesn't accept const_iterator arguments in insert and
related member functions. Pass a mutable iterator instead.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/from_chars/4.cc: Pass non-const iterator
	to string::insert.
2020-07-30 16:04:59 +01:00
Joe Ramsay
4451035492 MAINTAINERS: Add myself for write after approval
2020-07-30  Joe Ramsay  <joe.ramsay@arm.com>

	* MAINTAINERS (Write After Approval): Add myself.
2020-07-30 13:17:06 +00:00
H.J. Lu
4712bde3ca Require CET support only for the final GCC build
With --enable-cet, require CET support only for the final GCC build.
Don't enable CET without CET support for non-bootstrap build, in stage1
nor for build support.

config/

	PR bootstrap/96202
	* cet.m4 (GCC_CET_HOST_FLAGS): Don't enable CET without CET
	support in stage1 nor for build support.

gcc/

	PR bootstrap/96202
	* configure: Regenerated.

libbacktrace/

	PR bootstrap/96202
	* configure: Regenerated.

libcc1/

	PR bootstrap/96202
	* configure: Regenerated.

libcpp/

	PR bootstrap/96202
	* configure: Regenerated.

libdecnumber/

	PR bootstrap/96202
	* configure: Regenerated.

libiberty/

	PR bootstrap/96202
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/96202
	* configure: Regenerated.
2020-07-30 05:36:24 -07:00
Jonathan Wakely
9e67b4356e libstdc++: cv bool can't be an integer-like type (LWG 3467)
libstdc++-v3/ChangeLog:

	* include/bits/iterator_concepts.h (__detail::__cv_bool): New
	helper concept.
	(__detail::__integral_nonbool): Likewise.
	(__detail::__is_integer_like): Use __integral_nonbool.
	* testsuite/std/ranges/access/lwg3467.cc: New test.
2020-07-30 13:09:18 +01:00
Jonathan Wakely
eeb45f8a41 libstdc++: Add options for ieee float to relevant tests
libstdc++-v3/ChangeLog:

	* testsuite/20_util/from_chars/4.cc: Use dg-add-options ieee.
	* testsuite/29_atomics/atomic_float/1.cc: Likewise.
2020-07-30 12:50:03 +01:00
Jonathan Wakely
4c27c6584d libstdc++: Make testsuite usable with -fno-exceptions
Previously it was not possible to add -fno-exceptions to the testsuite
flags, because some files that are compiled by the v3-build_support
procedure failed with exceptions disabled.

This adjusts those files to still compile without exceptions (with
degraded functionality in some cases).

The sole testcase that explicitly checks for -fno-exceptions has also
been adjusted to use the more robust exceptions_enabled effective-target
keyword from gcc/testsuite/lib/target-supports.exp.

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/vector/bool/72847.cc: Use the
	exceptions_enabled effective-target keyword instead of
	checking for an explicit -fno-exceptions option.
	* testsuite/util/testsuite_abi.cc (examine_symbol): Remove
	redundant try-catch.
	* testsuite/util/testsuite_allocator.h [!__cpp_exceptions]:
	Do not define check_allocate_max_size and memory_resource.
	* testsuite/util/testsuite_containers.h: Replace comment with
	#error if wrong standard dialect used.
	* testsuite/util/testsuite_shared.cc: Likewise.
2020-07-30 12:50:02 +01:00
Iain Buclaw
7d4ee8bc58 d: Implement core.bitop.rol() and core.bitop.ror() as intrinsics.
gcc/d/ChangeLog:

	* intrinsics.cc (expand_intrinsic_rotate): Add function.
	(maybe_expand_intrinsic): Handle rol and ror intrinsics.
	* intrinsics.def (ROL): Add intrinsic.
	(ROL_TIARG): Add intrinsic.
	(ROR): Add intrinsic.
	(ROR_TIARG): Add intrinsic.

gcc/testsuite/ChangeLog:

	* gdc.dg/intrinsics.d: Add ror and rol tests.
2020-07-30 12:03:58 +02:00