178649 Commits

Author SHA1 Message Date
Iain Buclaw
2b1c2a4bd9 d: Fix ICE using non-local variable: internal compiler error: Segmentation fault
Moves no frame access error to own function, adding use of it for both
when get_framedecl() cannot find a path to the outer function frame, and
guarding get_decl_tree() from recursively calling itself.

gcc/d/ChangeLog:

	PR d/96254
	* d-codegen.cc (error_no_frame_access): New.
	(get_frame_for_symbol): Use fdparent name in error message.
	(get_framedecl): Replace call to assert with error.
	* d-tree.h (error_no_frame_access): Declare.
	* decl.cc (get_decl_tree): Detect recursion and error.

gcc/testsuite/ChangeLog:

	PR d/96254
	* gdc.dg/pr96254a.d: New test.
	* gdc.dg/pr96254b.d: New test.
2020-08-03 11:18:46 +02:00
Tobias Burnus
58cfec3a6e libgfortran/caf/single.c: Fix typo.
libgfortran/ChangeLog

	* caf/single.c (_gfortran_caf_lock): Fix typo.
2020-08-03 09:41:24 +02:00
Tobias Burnus
b7dd405948 Fortran texi: Fix typos
gcc/fortran/ChangeLog

	* gfc-internals.texi: Fix typos.
	* gfortran.texi: Likewise.
	* intrinsic.texi: Likewise.
	* invoke.texi: Likewise.
2020-08-03 09:38:51 +02:00
Aldy Hernandez
4ba9fb0a3e Multi-range implementation for value_range (irange).
Implement class irange, a generic multi-range implementation for
value ranges.  This class is API compatible with value_range, and is meant
to seamlessly coexist with it.

gcc/ChangeLog:

	* Makefile.in (GTFILES): Move value-range.h up.
	* gengtype-lex.l: Set yylval to handle GTY markers on templates.
	* ipa-cp.c (initialize_node_lattices): Call value_range
	constructor.
	(ipcp_propagate_stage): Use in-place new so value_range construct
	is called.
	* ipa-fnsummary.c (evaluate_conditions_for_known_args): Use std
	vec instead of GCC's vec<>.
	(evaluate_properties_for_edge): Adjust for std vec.
	(ipa_fn_summary_t::duplicate): Same.
	(estimate_ipcp_clone_size_and_time): Same.
	* ipa-prop.c (ipa_get_value_range): Use in-place new for
	value_range.
	* ipa-prop.h (struct GTY): Remove class keyword for m_vr.
	* range-op.cc (empty_range_check): Rename to...
	(empty_range_varying): ...this and adjust for varying.
	(undefined_shift_range_check): Adjust for irange.
	(range_operator::wi_fold): Same.
	(range_operator::fold_range): Adjust for irange.  Special case
	single pairs for performance.
	(range_operator::op1_range): Adjust for irange.
	(range_operator::op2_range): Same.
	(value_range_from_overflowed_bounds): Same.
	(value_range_with_overflow): Same.
	(create_possibly_reversed_range): Same.
	(range_true): Same.
	(range_false): Same.
	(range_true_and_false): Same.
	(get_bool_state):  Adjust for irange and tweak for performance.
	(operator_equal::fold_range): Adjust for irange.
	(operator_equal::op1_range): Same.
	(operator_equal::op2_range): Same.
	(operator_not_equal::fold_range): Same.
	(operator_not_equal::op1_range): Same.
	(operator_not_equal::op2_range): Same.
	(build_lt): Same.
	(build_le): Same.
	(build_gt): Same.
	(build_ge): Same.
	(operator_lt::fold_range): Same.
	(operator_lt::op1_range): Same.
	(operator_lt::op2_range): Same.
	(operator_le::fold_range): Same.
	(operator_le::op1_range): Same.
	(operator_le::op2_range): Same.
	(operator_gt::fold_range): Same.
	(operator_gt::op1_range): Same.
	(operator_gt::op2_range): Same.
	(operator_ge::fold_range): Same.
	(operator_ge::op1_range): Same.
	(operator_ge::op2_range): Same.
	(operator_plus::wi_fold): Same.
	(operator_plus::op1_range): Same.
	(operator_plus::op2_range): Same.
	(operator_minus::wi_fold): Same.
	(operator_minus::op1_range): Same.
	(operator_minus::op2_range): Same.
	(operator_min::wi_fold): Same.
	(operator_max::wi_fold): Same.
	(cross_product_operator::wi_cross_product): Same.
	(operator_mult::op1_range): New.
	(operator_mult::op2_range): New.
	(operator_mult::wi_fold): Adjust for irange.
	(operator_div::wi_fold): Same.
	(operator_exact_divide::op1_range): Same.
	(operator_lshift::fold_range): Same.
	(operator_lshift::wi_fold): Same.
	(operator_lshift::op1_range): New.
	(operator_rshift::op1_range): New.
	(operator_rshift::fold_range): Adjust for irange.
	(operator_rshift::wi_fold): Same.
	(operator_cast::truncating_cast_p): Abstract out from
	operator_cast::fold_range.
	(operator_cast::fold_range): Adjust for irange and tweak for
	performance.
	(operator_cast::inside_domain_p): Abstract out from fold_range.
	(operator_cast::fold_pair): Same.
	(operator_cast::op1_range): Use abstracted methods above.  Adjust
	for irange and tweak for performance.
	(operator_logical_and::fold_range): Adjust for irange.
	(operator_logical_and::op1_range): Same.
	(operator_logical_and::op2_range): Same.
	(unsigned_singleton_p): New.
	(operator_bitwise_and::remove_impossible_ranges): New.
	(operator_bitwise_and::fold_range): New.
	(wi_optimize_and_or):  Adjust for irange.
	(operator_bitwise_and::wi_fold): Same.
	(set_nonzero_range_from_mask): New.
	(operator_bitwise_and::simple_op1_range_solver): New.
	(operator_bitwise_and::op1_range): Adjust for irange.
	(operator_bitwise_and::op2_range): Same.
	(operator_logical_or::fold_range): Same.
	(operator_logical_or::op1_range): Same.
	(operator_logical_or::op2_range): Same.
	(operator_bitwise_or::wi_fold): Same.
	(operator_bitwise_or::op1_range): Same.
	(operator_bitwise_or::op2_range): Same.
	(operator_bitwise_xor::wi_fold): Same.
	(operator_bitwise_xor::op1_range): New.
	(operator_bitwise_xor::op2_range): New.
	(operator_trunc_mod::wi_fold):  Adjust for irange.
	(operator_logical_not::fold_range): Same.
	(operator_logical_not::op1_range): Same.
	(operator_bitwise_not::fold_range): Same.
	(operator_bitwise_not::op1_range): Same.
	(operator_cst::fold_range): Same.
	(operator_identity::fold_range): Same.
	(operator_identity::op1_range): Same.
	(class operator_unknown): New.
	(operator_unknown::fold_range): New.
	(class operator_abs): Adjust for irange.
	(operator_abs::wi_fold): Same.
	(operator_abs::op1_range): Same.
	(operator_absu::wi_fold): Same.
	(class operator_negate): Same.
	(operator_negate::fold_range): Same.
	(operator_negate::op1_range): Same.
	(operator_addr_expr::fold_range): Same.
	(operator_addr_expr::op1_range): Same.
	(pointer_plus_operator::wi_fold): Same.
	(pointer_min_max_operator::wi_fold): Same.
	(pointer_and_operator::wi_fold): Same.
	(pointer_or_operator::op1_range): New.
	(pointer_or_operator::op2_range): New.
	(pointer_or_operator::wi_fold):  Adjust for irange.
	(integral_table::integral_table): Add entries for IMAGPART_EXPR
	and POINTER_DIFF_EXPR.
	(range_cast):  Adjust for irange.
	(build_range3): New.
	(range3_tests): New.
	(widest_irange_tests): New.
	(multi_precision_range_tests): New.
	(operator_tests): New.
	(range_tests): New.
	* range-op.h (class range_operator): Adjust for irange.
	(range_cast): Same.
	* tree-vrp.c (range_fold_binary_symbolics_p): Adjust for irange and
	tweak for performance.
	(range_fold_binary_expr): Same.
	(masked_increment): Change to extern.
	* tree-vrp.h (masked_increment): New.
	* tree.c (cache_wide_int_in_type_cache): New function abstracted
	out from wide_int_to_tree_1.
	(wide_int_to_tree_1): Cache 0, 1, and MAX for pointers.
	* value-range-equiv.cc (value_range_equiv::deep_copy): Use kind
	method.
	(value_range_equiv::move): Same.
	(value_range_equiv::check): Adjust for irange.
	(value_range_equiv::intersect): Same.
	(value_range_equiv::union_): Same.
	(value_range_equiv::dump): Same.
	* value-range.cc (irange::operator=): Same.
	(irange::maybe_anti_range): New.
	(irange::copy_legacy_range): New.
	(irange::set_undefined): Adjust for irange.
	(irange::swap_out_of_order_endpoints): Abstract out from set().
	(irange::set_varying): Adjust for irange.
	(irange::irange_set): New.
	(irange::irange_set_anti_range): New.
	(irange::set): Adjust for irange.
	(value_range::set_nonzero): Move to header file.
	(value_range::set_zero): Move to header file.
	(value_range::check): Rename to...
	(irange::verify_range): ...this.
	(value_range::num_pairs): Rename to...
	(irange::legacy_num_pairs): ...this, and adjust for irange.
	(value_range::lower_bound): Rename to...
	(irange::legacy_lower_bound): ...this, and adjust for irange.
	(value_range::upper_bound): Rename to...
	(irange::legacy_upper_bound): ...this, and adjust for irange.
	(value_range::equal_p): Rename to...
	(irange::legacy_equal_p): ...this.
	(value_range::operator==): Move to header file.
	(irange::equal_p): New.
	(irange::symbolic_p): Adjust for irange.
	(irange::constant_p): Same.
	(irange::singleton_p): Same.
	(irange::value_inside_range): Same.
	(irange::may_contain_p): Same.
	(irange::contains_p): Same.
	(irange::normalize_addresses): Same.
	(irange::normalize_symbolics): Same.
	(irange::legacy_intersect): Same.
	(irange::legacy_union): Same.
	(irange::union_): Same.
	(irange::intersect): Same.
	(irange::irange_union): New.
	(irange::irange_intersect): New.
	(subtract_one): New.
	(irange::invert): Adjust for irange.
	(dump_bound_with_infinite_markers): New.
	(irange::dump): Adjust for irange.
	(debug): Add irange versions.
	(range_has_numeric_bounds_p): Adjust for irange.
	(vrp_val_max): Move to header file.
	(vrp_val_min): Move to header file.
	(DEFINE_INT_RANGE_GC_STUBS): New.
	(DEFINE_INT_RANGE_INSTANCE): New.
	* value-range.h (class irange): New.
	(class int_range): New.
	(class value_range): Rename to a instantiation of int_range.
	(irange::legacy_mode_p): New.
	(value_range::value_range): Remove.
	(irange::kind): New.
	(irange::num_pairs): Adjust for irange.
	(irange::type): Adjust for irange.
	(irange::tree_lower_bound): New.
	(irange::tree_upper_bound): New.
	(irange::type): Adjust for irange.
	(irange::min): Same.
	(irange::max): Same.
	(irange::varying_p): Same.
	(irange::undefined_p): Same.
	(irange::zero_p): Same.
	(irange::nonzero_p): Same.
	(irange::supports_type_p): Same.
	(range_includes_zero_p): Same.
	(gt_ggc_mx): New.
	(gt_pch_nx): New.
	(irange::irange): New.
	(int_range::int_range): New.
	(int_range::operator=): New.
	(irange::set): Moved from value-range.cc and adjusted for irange.
	(irange::set_undefined): Same.
	(irange::set_varying): Same.
	(irange::operator==): Same.
	(irange::lower_bound): Same.
	(irange::upper_bound): Same.
	(irange::union_): Same.
	(irange::intersect): Same.
	(irange::set_nonzero): Same.
	(irange::set_zero): Same.
	(irange::normalize_min_max): New.
	(vrp_val_max): Move from value-range.cc.
	(vrp_val_min): Same.
	* vr-values.c (vr_values::get_lattice_entry): Call value_range
	constructor.
2020-08-03 08:39:29 +02:00
Iain Buclaw
442b5a661e d: Merge upstream dmd c2274e56a (PR96250).
1. Fixes an ICE in the front-end if a struct symbol were to appear twice
in the compilation unit.

2. Fixes a rejects-valid bug in the front-end where `(symbol)' was being
resolved as a `var' expression, instead of `this.var'.

Reviewed-on: https://github.com/dlang/dmd/pull/11436
	     https://github.com/dlang/dmd/pull/11439

gcc/d/ChangeLog:

	PR d/96250
	* dmd/MERGE: Merge upstream dmd c2274e56a.
2020-08-03 04:40:18 +02:00
GCC Administrator
7031087cd7 Daily bump. 2020-08-03 00:16:19 +00:00
Sergei Trofimovich
6e46b3f3da var-tracking: fix uninitialised use of 'in_pending' [PR96404]
r11-2447-g:1212cfad093 ("Improve var-tracking dataflow
iteration order") changed 'in_pending' initialization
from:

    in_pending = sbitmap_alloc (last_basic_block_for_fn (cfun));
    bitmap_ones (in_pending);

to more complex partial bit population algorithm. Due to presence
of uninitialized bits gcc started injecting extra debug entries
in seemigly arbitrary locations and started failing stage2/stage3
bootstrap comparison.

valgrind detected unilitialized bits as:

  Conditional jump or move depends on uninitialised value(s)
     at 0xDBED3B: vt_find_locations() (var-tracking.c:7230)
     by 0xDBF2FB: variable_tracking_main_1() (var-tracking.c:10519)
     ...
   Uninitialised value was created by a heap allocation
     at 0x483779F: malloc (vg_replace_malloc.c:307)
     by 0x14EE80B: xmalloc (xmalloc.c:147)
     by 0x14911F9: sbitmap_alloc(unsigned int) (sbitmap.c:51)
     ...

The fix explicitly initializes 'in_pending' bitmap with zeros.

2020-08-02  Sergei Trofimovich  <siarheit@google.com>

gcc/

	PR bootstrap/96404
	* var-tracking.c (vt_find_locations): Fully initialize
	all 'in_pending' bits.
2020-08-02 19:35:47 +01:00
Paul Thomas
b3b2bf98ff Update ChangeLogs for PR96320 2020-08-02 11:03:24 +01:00
Paul Thomas
a5baf71b0a This patch fixes PR96320. See the explanatory comment in the testcase.
2020-08-01  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR target/96320
	* interface.c (gfc_check_dummy_characteristics): If a module
	procedure arrives with assumed shape in the interface and
	deferred shape in the procedure itself, update the latter and
	copy the lower bounds.

gcc/testsuite/
	PR target/96320
	* gfortran.dg/module_procedure_4.f90 : New test.
2020-08-02 10:57:59 +01:00
Paul Thomas
6912619fce Update ChangeLogs for PR96325 2020-08-02 10:44:02 +01:00
Paul Thomas
e41da82345 This patch fixes PR96325. See the explanatory comment in the testcase.
2020-08-02  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/96325
	* primary.c (gfc_match_varspec): In the case that a component
	reference is added to an intrinsic type component, emit the
	error message in this function.

gcc/testsuite/
	PR fortran/96325
	* gfortran.dg/pr96325.f90: New test.
	* gfortran.dg/pr91589.f90: Update error message.
2020-08-02 10:35:36 +01:00
GCC Administrator
4967ca2f8b Daily bump. 2020-08-02 00:16:21 +00:00
Gerald Pfeifer
8dc5f8529b Move www.stroustrup.com to https
libstdc++-v3/ChangeLog:

2020-08-02  Gerald Pfeifer  <gerald@pfeifer.com>

	* doc/xml/manual/using_exceptions.xml: Move www.stroustrup.com to
	https.
	* doc/html/manual/using_exceptions.html: Regenerate.
2020-08-02 00:26:36 +02:00
Ian Lance Taylor
f75af8c146 libgo: update to go1.15rc1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/245157
2020-08-01 11:21:40 -07:00
Jan Hubicka
75a23e5903 Verify symtab order
* symtab.c (symtab_node::verify_base): Verify order.
	(symtab_node::verify_symtab_nodes): Verify order.
2020-08-01 17:57:08 +02:00
Jan Hubicka
13cdbb6a97 Cap frequency of recursive calls by 90%
* predict.c (estimate_bb_frequencies): Cap recursive calls by 90%.
2020-08-01 17:02:24 +02:00
Richard Sandiford
7d599ad27b c: Fix bogus vector initialisation error [PR96377]
One of the problems in this PR was that if we had:

  vector_type1 array[] = { vector_value1 };

process_init_element would only treat vector_value1 as initialising
a vector_type1 if they had the same TYPE_MAIN_VARIANT.  This has
several problems:

(1) It gives confusing error messages if the vector types are
    incompatible.  (Tested by gcc.dg/pr96377-1.c.)

(2) It means that we reject code that should be valid with
    -flax-vector-conversions.  (Tested by gcc.dg/pr96377-2.c.)

(3) On arm and aarch64 targets, it means that we reject some
    initializers that mix Advanced SIMD and standard GNU vectors.
    These vectors have traditionally had different TYPE_MAIN_VARIANTs
    because they have different mangling schemes.  (Tested by
    gcc.dg/pr96377-[3-6].c.)

(4) It means that we reject SVE initializers that should be valid.
    (Tested by gcc.target/aarch64/sve/gnu_vectors_[34].c.)

(5) After r11-1741-g:31427b974ed7b7dd54e2 we reject:

      arm_neon_type1 array[] = { k ^ arm_neon_value1 };

    because applying the binary operator to arm_neon_value1 strips
    the "Advanced SIMD type" attributes that were added in that patch.
    Stripping the attributes is problematic for other reasons though,
    so that still needs to be fixed separately.

g++.target/aarch64/sve/gnu_vectors_[34].C already pass.

gcc/c/
	PR c/96377
	* c-typeck.c (process_init_element): Split test for whether to
	recurse into a record, union or array into...
	(initialize_elementwise_p): ...this new function.  Don't recurse
	into a vector type if the initialization value is also a vector.

gcc/testsuite/
	PR c/96377
	* gcc.dg/pr96377-1.c: New test.
	* gcc.dg/pr96377-2.c: Likewise.
	* gcc.dg/pr96377-3.c: Likewise.
	* gcc.dg/pr96377-4.c: Likewise.
	* gcc.dg/pr96377-5.c: Likewise.
	* gcc.dg/pr96377-6.c: Likewise.
	* gcc.target/aarch64/pr96377-1.c: Likewise.
	* gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c: Likewise.
	* gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c: Likewise.
	* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C: Likewise.
	* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C: Likewise.
2020-08-01 12:41:28 +01:00
Jojo R
197f1e8c14 C-SKY: Add -mfloat-abi= option.
gcc/ChangeLog:

	* config/csky/csky_opts.h (float_abi_type): New.
	* config/csky/csky.h (TARGET_SOFT_FLOAT): New.
	(TARGET_HARD_FLOAT): New.
	(TARGET_HARD_FLOAT_ABI): New.
	(OPTION_DEFAULT_SPECS): Use mfloat-abi.
	* config/csky/csky.opt (mfloat-abi): New.
	* doc/invoke.texi (C-SKY Options): Document -mfloat-abi=.
2020-08-01 16:10:43 +08:00
Cooper Qu
c713ad3fea C-SKY: Delete big endian CPUs' mutilib for linux gcc.
gcc/

	* config/csky/t-csky-linux: Delete big endian CPUs' multilib.
2020-08-01 15:45:34 +08:00
Hans-Peter Nilsson
d242fdaec1 gcc.dg/loop-8.c: Skip for mmix.
This test fails for mmix for (almost) the same reason it would fail
for e.g. mipsel-elf: the end-condition of the loop tests against a
register set to a constant, and that register is (one of) the
"unexpected IV" moved out of the loop "without introducing a new
temporary register" and making the dump contain more than one
"Decided", causing a non-matching loop2 dump.  The test should
probably have been restricted to just the original target for which a
problem was observed to be fixed.

gcc/testsuite:
	* gcc.dg/loop-8.c: Skip for mmix.
2020-08-01 03:24:34 +02:00
GCC Administrator
48cc2e468c Daily bump. 2020-08-01 00:16:25 +00:00
Maciej W. Rozycki
9fa4023c7a RISC-V/libgcc: Reduce the size of RV64 millicode by 6 bytes
Rewrite code sequences throughout the 64-bit RISC-V `__riscv_save_*'
routines replacing `li t1, -48', `li t1, -64', and `li t1, -80',
instructions, which do not have a compressed encoding, respectively with
`li t1, 3', `li t1, 4', and `li t1, 4', which do, and then adjusting the
remaining code accordingly observing that `sub sp, sp, t1' takes the
same amount of space as an `slli t1, t1, 4'/`add sp, sp, t1' instruction
pair does, again due to the use of compressed encodings, saving 6 bytes
total.

This change does increase code size by 4 bytes for RISC-V processors
lacking the compressed instruction set, however their users couldn't
care about the code size or they would have chosen an implementation
that does have the compressed instructions, wouldn't they?

	libgcc/
	* config/riscv/save-restore.S [__riscv_xlen == 64]
	(__riscv_save_10, __riscv_save_8, __riscv_save_6, __riscv_save_4)
	(__riscv_save_2): Replace negative immediates used for the final
	stack pointer adjustment with positive ones, right-shifted by 4.
2020-07-31 23:52:20 +01:00
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