Commit Graph

172523 Commits

Author SHA1 Message Date
Jonathan Wakely
411679568b Fix another compilation error with Clang
* include/bits/stl_iterator.h (__normal_iterator::iterator_concept):
	Guard with __cpp_lib_concepts macro.

From-SVN: r277634
2019-10-30 16:57:19 +00:00
Jonathan Wakely
0d58d88db6 Fix some missing/incorrect feature test macros
* include/std/bit (__cpp_lib_bitops): Define.
	* include/std/version (__cpp_lib_constexpr): Remove.
	(__cpp_lib_bitops, __cpp_lib_constexpr_dynamic_alloc): Define.
	* testsuite/26_numerics/bit/header.cc: New test.
	* testsuite/26_numerics/bit/header-2.cc: New test.
	* testsuite/20_util/allocator_traits/header.cc: New test.
	* testsuite/20_util/allocator_traits/header-2.cc: New test.

From-SVN: r277633
2019-10-30 16:57:13 +00:00
Nathan Sidwell
43f1814cf1 [C++ PATCH] Feature macros are long
https://gcc.gnu.org/ml/gcc-patches/2019-10/msg02157.html
	* c-cppbuiltin.c (c_cpp_builtins): Add 'L' suffix to feature
	macros.

From-SVN: r277632
2019-10-30 16:34:13 +00:00
Tobias Burnus
91ae0a46fd Fortran/OpenMP] Don't create "alloc:" for 'target exit data'
gcc/
        * gimplify.c (gimplify_scan_omp_clauses): Remove FE-generated
        GOMP_MAP_TO_PSET and GOMP_MAP_POINTER mapping for 'target update'
        and 'target exit data'.

        libgomp/
        * testsuite/libgomp.fortran/target9.f90: New.

From-SVN: r277631
2019-10-30 17:32:38 +01:00
Jonathan Wakely
d03eca30d7 Remove some more using-declarations from namespace __gnu_cxx
Similar to some recent patches, this removes using-declarations for
names from namespace std, so that they are not redeclared in __gnu_cxx.

	* include/bits/stl_iterator.h (namespace __gnu_cxx): Remove
	using-declarations for std::iterator and std::iterator_traits.
	(__gnu_cxx::__normal_iterator): Qualify iterator_traits.
	* include/ext/algorithm (namespace __gnu_cxx): Remove
	using-declarations for std names and qualify those names when used.
	Also refer to std::min in parentheses to protect against function-like
	macros.
	* include/ext/rc_string_base.h: Qualify iterator_traits.
	* include/ext/sso_string_base.h: Qualify iterator_traits.

From-SVN: r277630
2019-10-30 15:48:23 +00:00
Jonathan Wakely
9aeb3bef2c Apply C++20 changes to various iterator types
This ensures that __normal_iterator<T*, C> satisfies the
contiguous_iterator concept, by defining the iterator_concept member
type.

Also update vector<bool>'s iterators, reverse_iterator,
istreambuf_iterator and ostreambuf_iterator to meet the C++20
requirements.

	PR libstdc++/92272
	* include/bits/stl_bvector.h (_Bit_iterator::pointer)
	(_Bit_const_iterator::pointer): Define as void for C++20.
	* include/bits/stl_iterator.h (reverse_iterator::operator->()): Add
	constraints for C++20.
	(__normal_iterator::iterator_concept): Define for C++20.
	* include/bits/streambuf_iterator.h (istreambuf_iterator::pointer):
	Define as void for C++20.
	(ostreambuf_iterator::difference_type): Define as ptrdiff_t for C++20.
	(ostreambuf_iterator::ostreambuf_iterator()): Add default constructor
	for C++20.
	* testsuite/23_containers/vector/bool/iterator_c++20.cc: New test.
	* testsuite/24_iterators/bidirectional/concept.cc: New test.
	* testsuite/24_iterators/bidirectional/tag.cc: New test.
	* testsuite/24_iterators/contiguous/concept.cc: New test.
	* testsuite/24_iterators/contiguous/tag.cc: New test.
	* testsuite/24_iterators/forward/concept.cc: New test.
	* testsuite/24_iterators/forward/tag.cc: New test.
	* testsuite/24_iterators/input/concept.cc: New test.
	* testsuite/24_iterators/input/tag.cc: New test.
	* testsuite/24_iterators/istreambuf_iterator/requirements/typedefs.cc:
	New test.
	* testsuite/24_iterators/ostreambuf_iterator/requirements/typedefs.cc:
	New test.
	* testsuite/24_iterators/output/concept.cc: New test.
	* testsuite/24_iterators/output/tag.cc: New test.
	* testsuite/24_iterators/random_access/concept.cc: New test.
	* testsuite/24_iterators/random_access/tag.cc: New test.
	* testsuite/24_iterators/range_operations/advance_debug_neg.cc: New
	test.
	* testsuite/24_iterators/random_access_iterator/26020.cc: Move to ...
	* testsuite/24_iterators/operations/26020.cc: ... here.
	* testsuite/24_iterators/random_access_iterator/
	string_vector_iterators.cc: Move to ...
	* testsuite/24_iterators/random_access/string_vector_iterators.cc: ...
	here.

From-SVN: r277629
2019-10-30 15:48:11 +00:00
Jonathan Wakely
5211593c58 Fix typo in preprocessor check
* testsuite/util/testsuite_iterators.h: Fix typo in __cplusplus check.

From-SVN: r277628
2019-10-30 15:47:39 +00:00
Martin Jambor
f653eb0e44 Edges to interposable calles are possibly_call_in_translation_unit_p
2019-10-30  Martin Jambor  <mjambor@suse.cz>

	ipa/92278
	* cgraph.c (cgraph_edge::possibly_call_in_translation_unit_p): Fix
	availability comparison.

From-SVN: r277627
2019-10-30 16:47:29 +01:00
Jozef Lawrynowicz
499a39af5d msp430.c (msp430_expand_helper): Support expansion of calls to __mspabi_mpy* functions.
2019-10-30  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config/msp430/msp430.c (msp430_expand_helper): Support expansion of
	calls to __mspabi_mpy* functions.
	* config/msp430/msp430.md (mulhisi3): New define_expand.
	(umulhisi3): New define_expand.
	(*mulhisi3_inline): Use old mulhisi3 define_insn.
	(*umulhisi3_inline): Use old umulhisi3 define_insn.

From-SVN: r277624
2019-10-30 14:15:02 +00:00
Jozef Lawrynowicz
0149b1b4d7 msp430.c (msp430_check_index_not_high_mem): New.
gcc/ChangeLog:

2019-10-30  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config/msp430/msp430.c (msp430_check_index_not_high_mem): New.
	(msp430_check_plus_not_high_mem): New.
	(msp430_op_not_in_high_mem): Use new functions to check if the operand
	might be in low memory.
	Indicate that a 16-bit absolute address is in lower memory.

gcc/testsuite/ChangeLog:

2019-10-30  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* gcc.target/msp430/mlarge-use-430-insn.c: New test.

From-SVN: r277623
2019-10-30 14:01:12 +00:00
Martin Jambor
d7caa12927 Fix a call to ultimate_alias_target
2019-10-30  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.c (ipa_compute_jump_functions_for_bb): Fix the call to
	ultimate_alias_target.

From-SVN: r277622
2019-10-30 14:57:14 +01:00
Richard Biener
b81f2dafdb re PR tree-optimization/92275 (ICE: error: definition in block 11 does not dominate use in block 15 since r277566)
2019-10-30  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/92275
	* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_loops):
	Copy all loop-closed PHIs.

	* gcc.dg/torture/pr92275.c: New testcase.

From-SVN: r277621
2019-10-30 13:52:27 +00:00
Jakub Jelinek
095578b5bc * g++.dg/gomp/declare-variant-6.C: New test.
From-SVN: r277620
2019-10-30 13:17:16 +01:00
Martin Liska
3f85ff833a Use const_tree more in IPA ICF.
2019-10-30  Martin Liska  <mliska@suse.cz>

	* ipa-icf-gimple.c (func_checker::compare_ssa_name): Use
	const_tree as function argument.
	(func_checker::compare_decl): Likewise.
	(func_checker::operand_equal_p): Likewise.
	(func_checker::compare_variable_decl): Likewise.
	(func_checker::parse_labels): Likewise.
	* ipa-icf-gimple.h: Likewise.

From-SVN: r277619
2019-10-30 12:03:12 +00:00
Martin Liska
fc0e67aaa0 Remove alias set comparison.
2019-10-30  Martin Liska  <mliska@suse.cz>

	* ipa-icf-gimple.c (func_checker::compatible_types_p):
	Do not compare alias sets.  It's handled by operand_equal_p.
2019-10-30  Martin Liska  <mliska@suse.cz>

	* c-c++-common/Wstringop-truncation-4.c: Disable IPA ICF.
	* gcc.dg/tree-ssa/pr64910-2.c: Likewise.
	* gcc.dg/tree-ssa/pr79352.c: Likewise.

From-SVN: r277618
2019-10-30 12:03:00 +00:00
Martin Liska
430d1e8de0 Remove comparison for polymorphic types.
2019-10-30  Martin Liska  <mliska@suse.cz>

	* ipa-icf-gimple.c (func_checker::func_checker): Do not
	initialize m_compare_polymorphic.
	(func_checker::compare_decl): Do not compare polymorphic types.
	* ipa-icf-gimple.h (m_compare_polymorphic): Remove.
	* ipa-icf.c (sem_function::equals_private): Do not call
	compare_polymorphic_p.

From-SVN: r277617
2019-10-30 12:02:17 +00:00
Martin Liska
938bba616d IPA ICF: remove dead code
2019-10-30  Martin Liska  <mliska@suse.cz>

	* ipa-icf-gimple.c (func_checker::compare_ssa_name): Call
	compare_operand.
	(func_checker::compare_memory_operand): Remove.
	(func_checker::compare_cst_or_decl): Remove.
	(func_checker::operand_equal_valueize): Do not handle
	FIELD_DECL.
	(func_checker::compare_gimple_call): Call compare_operand.
	(func_checker::compare_gimple_assign): Likewise.
	* ipa-icf-gimple.h: Remove compare_cst_or_decl.
	* ipa-icf.c (sem_function::icf_handled_component_p): Remove.
	* ipa-icf.h (icf_handled_component_p): Remove.

From-SVN: r277616
2019-10-30 12:01:45 +00:00
Martin Liska
8a319aa3c2 Integrate that for IPA ICF.
2019-10-30  Martin Liska  <mliska@suse.cz>

	* ipa-icf-gimple.c (func_checker::hash_operand): New.
	(func_checker::compare_cst_or_decl): Remove handling
	of FIELD_DECL.
	(func_checker::compare_operand): Transform to ...
	(func_checker::operand_equal_p): ... this.
	* ipa-icf-gimple.h (class func_checker): Add
	operand_equal_p and hash_operand.
	* ipa-icf.c (sem_function::equals_private): Fix
	pushing and popping of cfun.

From-SVN: r277615
2019-10-30 12:01:25 +00:00
Martin Liska
7f4a8ee03d Come up with an abstraction.
2019-10-30  Martin Liska  <mliska@suse.cz>

	* fold-const.c (operand_equal_p): Move to ...
	(operand_compare::operand_equal_p): ... here.
	(operand_compare::verify_hash_value): New.
	(add_expr): Move to ...
	(operand_compare::hash_operand): ... here.
	* fold-const.h (operand_equal_p): Move to the class.
	(class operand_compare): New.
	* tree.c (add_expr): Remove.

From-SVN: r277614
2019-10-30 12:01:03 +00:00
Jakub Jelinek
42ceec0607 cp-tree.h (omp_declare_variant_finalize, [...]): Declare.
* cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
	* decl.c: Include omp-general.h.
	(declare_simd_adjust_this): Add forward declaration.
	(omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
	function.
	(cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
	* parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
	variant id-expression and propagate enough information to
	omp_declare_variant_finalize_one in the attribute so that it can
	finalize it.
	* class.c (finish_struct): Call omp_declare_variant_finalize.
	* tree.c (build_local_temp): No longer static, remove forward
	declaration.

	* c-c++-common/gomp/declare-variant-2.c: Add a test with , before
	match clause.
	* c-c++-common/gomp/declare-variant-6.c: Expect diagnostics also from
	C++ FE and adjust regexp so that it handles C++ pretty printing of
	function names.
	* g++.dg/gomp/declare-variant-1.C: New test.
	* g++.dg/gomp/declare-variant-2.C: New test.
	* g++.dg/gomp/declare-variant-3.C: New test.
	* g++.dg/gomp/declare-variant-4.C: New test.
	* g++.dg/gomp/declare-variant-5.C: New test.

From-SVN: r277613
2019-10-30 12:58:03 +01:00
Martin Liska
96e05bf5ae operand_equal_p: add support for OBJ_TYPE_REF.
2019-10-30  Martin Liska  <mliska@suse.cz>

	* fold-const.c (operand_equal_p): Support OBJ_TYPE_REF.
	* tree.c (add_expr): Hash parts of OBJ_TYPE_REF.

From-SVN: r277612
2019-10-30 11:56:58 +00:00
Paolo Carlini
0f92815326 typeck.c (cp_build_modify_expr): Prefer error + inform to error + error in one place.
/cp
2019-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

	* typeck.c (cp_build_modify_expr): Prefer error + inform to
	error + error in one place.
	(get_delta_difference_1): Likewise.
	(get_delta_difference): Likewise, in two places.

/testsuite
2019-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/conversion/ptrmem2.C: Adjust for error + inform.
	* g++.dg/gomp/tpl-atomic-2.C: Likewise.

From-SVN: r277610
2019-10-30 11:49:21 +00:00
Tobias Burnus
c425e66b27 libgomp/testsuite – use 'stop'
libgomp/
	* testsuite/libgomp.fortran/: Replace 'STOP' by 'stop'.

From-SVN: r277609
2019-10-30 12:44:54 +01:00
Martin Liska
3c56d8d8de Use symtab_node::order in LTO sections with body.
2019-10-30  Martin Liska  <mliska@suse.cz>

	PR lto/91393
	PR lto/88220
	* cgraph.c (cgraph_node::get_create): Overwrite node->order
	from a first_clone in order to get proper LTO section
	in LTO stream.
	(cgraph_node::get_untransformed_body):
	Use lto_get_section_data where symtab_node::order
	must be provided.
	* cgraphclones.c (cgraph_node::find_replacement):
	Update also symbol order.
	* ipa-fnsummary.c (ipa_fn_summary_read):
	Use new function lto_get_summary_section_data.
	* ipa-hsa.c (ipa_hsa_read_summary): Likewise.
	* ipa-icf.c (sem_item_optimizer::read_summary):
	Likewise.
	* ipa-prop.c (ipa_prop_read_jump_functions):
	Likewise.
	(ipcp_read_transformation_summaries): Likewise.
	* ipa-sra.c (ipa_sra_read_summary): Likewise.
	* lto-cgraph.c (input_node): Add also order_base.
	(input_varpool_node): Likewise.
	(input_cgraph_1): Assign the order_base.
	(input_cgraph_opt_summary): Use new lto_get_summary_section_data.
	* lto-opts.c (lto_write_options): Pass new argument.
	* lto-section-in.c (lto_get_section_data): Add new argumente order.
	(lto_get_summary_section_data): New.
	(lto_get_raw_section_data): Add order argument.
	(lto_create_simple_input_block): Likewise.
	* lto-section-out.c (lto_destroy_simple_output_block):
	Likewise.
	* lto-streamer-in.c (lto_input_toplevel_asms):
	Use lto_get_summary_section_data.
	(lto_input_mode_table): Likewise.
	* lto-streamer-out.c (produce_asm): Pass symtab_node::order.
	(lto_output_toplevel_asms): Pass new argument.
	(copy_function_or_variable): Likewise.
	(produce_lto_section):Likewise.
	(produce_symtab): Likewise.
	(lto_write_mode_table): Likewise.
	(produce_asm_for_decls): Likewise.
	* lto-streamer.c (lto_get_section_name): Concat symbol name
	and symbol order.
	* lto-streamer.h (lto_get_section_data): Add order argument.
	(lto_get_summary_section_data): New.
	(lto_get_raw_section_data): Add order argument.
	(lto_get_section_name): Likewise.
	* varpool.c (varpool_node::get_constructor): Pass order argument.
2019-10-30  Martin Liska  <mliska@suse.cz>

	PR lto/91393
	PR lto/88220
	* lto-common.c (lto_file_finalize): Use lto_get_summary_section_data.
	(get_section_data): Add order argument.
2019-10-30  Martin Liska  <mliska@suse.cz>

	PR lto/91393
	PR lto/88220
	* gcc.dg/lto/pr91393_0.c: New test.

From-SVN: r277607
2019-10-30 10:38:52 +00:00
Tobias Burnus
01509e2f04 libgomp/testsuite – use 'stop' and 'dg-do run'
libgomp/
        * testsuite/libgomp.fortran/target-simd.f90: Use stop not abort.
        * testsuite/libgomp.fortran/use_device_ptr-optional-1.f90:
        Ditto; add 'dg-do run' for torture testing.
        * testsuite/libgomp.fortran/lastprivate1.f90:  Add 'dg-do run'.
        * testsuite/libgomp.fortran/lastprivate2.f90: Ditto.
        * testsuite/libgomp.fortran/nestedfn4.f90: Ditto.
        * testsuite/libgomp.fortran/pr25219.f90: Ditto.
        * testsuite/libgomp.fortran/pr28390.f: Ditto.
        * testsuite/libgomp.fortran/pr35130.f90: Ditto.
        * testsuite/libgomp.fortran/pr90779.f90: Ditto.
        * testsuite/libgomp.fortran/task2.f90: Ditto.
        * testsuite/libgomp.fortran/taskgroup1.f90: Ditto.
        * testsuite/libgomp.fortran/taskloop1.f90: Ditto.
        * testsuite/libgomp.fortran/use_device_addr-1.f90: Ditto.
        * testsuite/libgomp.fortran/use_device_addr-2.f90: Ditto.
        * testsuite/libgomp.fortran/workshare1.f90: Ditto.
        * testsuite/libgomp.fortran/workshare2.f90: Ditto.

From-SVN: r277606
2019-10-30 11:33:58 +01:00
Jakub Jelinek
9f33e12137 re PR tree-optimization/92262 (ICE: verify_gimple failed (error: incorrect sharing of tree nodes))
PR tree-optimization/92262
	* tree-ssa-loop-ivopts.c (get_debug_computation_at): Don't unshare
	ubase or cbase here.
	(remove_unused_ivs): Unshare comp before using it.

	* g++.dg/opt/pr92262.C: New test.

From-SVN: r277605
2019-10-30 10:52:01 +01:00
Jan Hubicka
fd776d2834 ipa-prop.c (update_jump_functions_after_inlining): Watch for missing summaries.
* ipa-prop.c (update_jump_functions_after_inlining):
	Watch for missing summaries.

From-SVN: r277604
2019-10-30 09:25:18 +00:00
Richard Biener
b4673569c2 re PR tree-optimization/65930 (Reduction with sign-change not handled)
2019-10-30  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/65930
	* tree-vect-loop.c (vect_is_simple_reduction): For reduction
	chains also allow a leading and trailing conversion.
	* tree-vect-slp.c (vect_get_and_check_slp_defs): Handle
	intermediate reduction chains.
	(vect_analyze_slp_instance): Likewise.  Build a SLP
	node for a trailing conversion manually.

	* gcc.dg/vect/pr65930-2.c: New testcase.

From-SVN: r277603
2019-10-30 09:21:09 +00:00
Mark Eggleston
91c4891af8 Suppress warning with -Wno-overwrite-recursive.
The use of -fno-automatic with -frecursive results in a warning implying
that recursion will not work. If all relevant local variable have the
automatic attribute explicitly declared recursion does work and the warning
is redundant.

From-SVN: r277602
2019-10-30 08:37:29 +00:00
Martin Liska
87f94429fe Remove cgraph_local_info structure.
2019-10-30  Martin Liska  <mliska@suse.cz>

	* cgraph.c (cgraph_node::local_info): Transform to ...
	(cgraph_node::local_info_node): ... this.
	(cgraph_node::dump): Remove cgraph_local_info and
	put its fields directly into cgraph_node.
	(cgraph_node::get_availability): Likewise.
	(cgraph_node::make_local): Likewise.
	(cgraph_node::verify_node): Likewise.
	* cgraph.h (struct GTY): Likewise.
	* cgraphclones.c (set_new_clone_decl_and_node_flags): Likewise.
	(duplicate_thunk_for_node): Likewise.
	(cgraph_node::create_clone): Likewise.
	(cgraph_node::create_virtual_clone): Likewise.
	(cgraph_node::create_version_clone): Likewise.
	* cgraphunit.c (cgraph_node::reset): Likewise.
	(cgraph_node::finalize_function): Likewise.
	(cgraph_node::add_new_function): Likewise.
	(analyze_functions): Likewise.
	* combine.c (setup_incoming_promotions): Likewise.
	* config/i386/i386.c (ix86_function_regparm): Likewise.
	(ix86_function_sseregparm): Likewise.
	(init_cumulative_args): Likewise.
	* ipa-cp.c (determine_versionability): Likewise.
	(count_callers): Likewise.
	(set_single_call_flag): Likewise.
	(initialize_node_lattices): Likewise.
	(estimate_local_effects): Likewise.
	(create_specialized_node): Likewise.
	(identify_dead_nodes): Likewise.
	* ipa-fnsummary.c (compute_fn_summary): Likewise.
	(ipa_fn_summary_generate): Likewise.
	* ipa-hsa.c (check_warn_node_versionable): Likewise.
	(process_hsa_functions): Likewise.
	* ipa-icf.c (set_local): Likewise.
	* ipa-inline-analysis.c (initialize_inline_failed): Likewise.
	* ipa-inline.c (speculation_useful_p): Likewise.
	* ipa-profile.c (ipa_propagate_frequency): Likewise.
	(ipa_profile): Likewise.
	* ipa-split.c (split_function): Likewise.
	(execute_split_functions): Likewise.
	* ipa-sra.c (ipa_sra_preliminary_function_checks): Likewise.
	(ipa_sra_ipa_function_checks): Likewise.
	* ipa-visibility.c (function_and_variable_visibility): Likewise.
	* ipa.c (symbol_table::remove_unreachable_nodes): Likewise.
	* lto-cgraph.c (lto_output_node): Likewise.
	(input_overwrite_node): Likewise.
	* multiple_target.c (expand_target_clones): Likewise.
	* omp-simd-clone.c (simd_clone_create): Likewise.
	* trans-mem.c (expand_call_tm): Likewise.
	(ipa_tm_mayenterirr_function): Likewise.
	(ipa_tm_diagnose_tm_safe): Likewise.
	(ipa_tm_diagnose_transaction): Likewise.
	(ipa_tm_create_version): Likewise.
	(ipa_tm_transform_calls_redirect): Likewise.
	(ipa_tm_execute): Likewise.
	* tree-inline.c (expand_call_inline): Likewise.

From-SVN: r277601
2019-10-30 07:56:22 +00:00
Martin Liska
a62bfab5d2 Remove cgraph_global_info.
From-SVN: r277600
2019-10-30 07:55:39 +00:00
GCC Administrator
53289de583 Daily bump.
From-SVN: r277599
2019-10-30 00:17:00 +00:00
Paolo Carlini
6c6a27379c typeck.c (build_x_unary_op): Use the location_t argument in three error_at.
/cp
2019-10-29  Paolo Carlini  <paolo.carlini@oracle.com>

	* typeck.c (build_x_unary_op): Use the location_t argument in
	three error_at.

/testsuite
2019-10-29  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/other/ptrmem8.C: Test locations too.
	* g++.dg/template/dtor6.C: Likewise.

From-SVN: r277595
2019-10-29 22:31:08 +00:00
Marek Polacek
1e2fa738e1 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
After r269667 which introduced joust_maybe_elide_copy, in C++17 we can elide
a constructor if it uses a conversion function that returns a prvalue, and
use the conversion function in its stead.

This eliding means that if we have a candidate that previously didn't have
->second_conv, it can have it after the elision.  This confused the
-Wconversion warning because it was assuming that if cand1->second_conv is
non-null, so is cand2->second_conv.  Here cand1->second_conv was non-null
but cand2->second_conv remained null, so it crashed in compare_ics.

I checked with clang that both compilers call A::operator B() in C++17 and
B::B(A const &) otherwise.

	* call.c (joust): Don't attempt to warn if ->second_conv is null.

	* g++.dg/cpp0x/overload-conv-4.C: New test.

From-SVN: r277593
2019-10-29 21:06:21 +00:00
Jakub Jelinek
6835f8a04a re PR c++/92201 (ICE: ‘verify_gimple’ failed with -std=c++2a)
PR c++/92201
	* cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
	function pointer type, re-add cast to the original one.

	* g++.dg/other/pr92201.C: New test.

From-SVN: r277592
2019-10-29 21:58:47 +01:00
Marek Polacek
0f1848002a PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
This fixes a bogus "modifying a const object" error for an array that actually
isn't declared const.  The problem was how I handled ARRAY_REFs here; we
shouldn't look at the ARRAY_REF itself, but at the array its accessing.

	* constexpr.c (cxx_eval_store_expression): Don't call
	modifying_const_object_p for ARRAY_REF.

	* g++.dg/cpp1y/constexpr-tracking-const15.C: New test.
	* g++.dg/cpp1y/constexpr-tracking-const16.C: New test.
	* g++.dg/cpp1z/constexpr-tracking-const1.C: New test.

From-SVN: r277591
2019-10-29 20:34:43 +00:00
Jonathan Wakely
6cd96bad60 Fix compilation errors with Clang
* include/bits/range_access.h (ranges::disable_sized_range)
	(ranges::begin, ranges::end, ranges::cbegin, ranges::cend)
	(ranges::rbegin, ranges::rend, ranges::crbegin, ranges::crend)
	(ranges::size, ranges::empty, ranges::data, ranges::cdata)
	(ranges::range, ranges::sized_range, ranges::advance, ranges::distance)
	(ranges::next, ranges::prev): Guard with __cpp_lib_concepts.
	* include/bits/stl_iterator.h (disable_sized_sentinel): Likewise.

From-SVN: r277589
2019-10-29 20:17:02 +00:00
Jonathan Wakely
540218dd24 Fix compilation errors with Clang
* include/bits/alloc_traits.h (__cpp_lib_constexpr_dynamic_alloc):
	Define.
	(allocator_traits::_S_construct, allocator_traits::_S_destroy)
	(__alloc_on_copy, __alloc_on_move, __alloc_on_swap): Use
	_GLIBCXX14_CONSTEXPR instead of constexpr.
	* include/bits/stl_construct.h (_Destroy): Likewise.

From-SVN: r277588
2019-10-29 20:16:57 +00:00
Jonathan Wakely
6d0dff49ca Add iterator concepts and range access customization points for C++20
This adds most of the new C++20 features to <iterator>, as well as a few
initial pieces of <ranges> (but no actual <ranges> header just yet).

	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/bits/iterator_concepts.h: New header.
	(contiguous_iterator_tag, iter_reference_t, ranges::iter_move)
	(iter_rvalue_reference_t, incrementable_traits, iter_difference_t)
	(readable_traits, iter_value_t, readable, iter_common_reference_t)
	(writable, waekly_incrementable, incrementable)
	(input_or_output_iterator, sentinel_for, disable_sized_sentinel)
	(sized_sentinel_for, input_iterator, output_iterator)
	(forward_iterator, bidirectional_iterator, random_access_iterator)
	(contiguous_iterator, indirectly_unary_invocable)
	(indirectly_regular_unary_invocable, indirect_unary_predicate)
	(indirect_relation, indirect_strict_weak_order, indirect_result_t)
	(projected, indirectly_movable, indirectly_movable_storable)
	(indirectly_copyable, indirectly_copyable_storable, ranges::iter_swap)
	(indirectly_swappable, indirectly_comparable, permutable, mergeable)
	(sortable, unreachable_sentinel_t, unreachable_sentinel)
	(default_sentinel_t, default_sentinel): Define.
	(__detail::__cpp17_iterator, __detail::__cpp17_input_iterator)
	(__detail::__cpp17_fwd_iterator, __detail::__cpp17_bidi_iterator)
	(__detail::__cpp17_randacc_iterator): Define.
	(__iterator_traits): Define constrained specializations.
	* include/bits/move.h (move): Only use old concept check for C++98.
	* include/bits/range_access.h (ranges::disable_sized_range)
	(ranges::begin, ranges::end, ranges::cbegin, ranges::cend)
	(ranges::rbegin, ranges::rend, ranges::crbegin, ranges::crend)
	(ranges::size, ranges::empty, ranges::data, ranges::cdata): Define
	new customization points for C++20.
	(ranges::range, ranges::sized_range): Define new concepts for C++20.
	(ranges::advance, ranges::distance, ranges::next, ranges::prev):
	Define new functions for C++20.
	(__adl_end, __adl_cdata, __adl_cbegin, __adl_cend, __adl_rbegin)
	(__adl_rend, __adl_crbegin, __adl_crend, __adl_cdata, __adl_size)
	(__adl_empty): Remove.
	* include/bits/stl_iterator.h (disable_sized_sentinel): Specialize
	for reverse_iterator.
	* include/bits/stl_iterator_base_types.h (contiguous_iterator_tag):
	Define new struct for C++20.
	(iterator_traits<_Tp*>): Constrain partial specialization in C++20.
	* include/std/concepts (__is_class_or_enum): Move to __detail
	namespace.
	* testsuite/20_util/forward/c_neg.cc: Adjust dg-error line number.
	* testsuite/20_util/forward/f_neg.cc: Likewise.
	* testsuite/24_iterators/associated_types/incrementable.traits.cc: New
	test.
	* testsuite/24_iterators/associated_types/readable.traits.cc: New test.
	* testsuite/24_iterators/contiguous/concept.cc: New test.
	* testsuite/24_iterators/contiguous/tag.cc: New test.
	* testsuite/24_iterators/customization_points/iter_move.cc: New test.
	* testsuite/24_iterators/customization_points/iter_swap.cc: New test.
	* testsuite/24_iterators/headers/iterator/synopsis_c++20.cc: New test.
	* testsuite/24_iterators/range_operations/advance.cc: New test.
	* testsuite/24_iterators/range_operations/distance.cc: New test.
	* testsuite/24_iterators/range_operations/next.cc: New test.
	* testsuite/24_iterators/range_operations/prev.cc: New test.
	* testsuite/26_numerics/adjacent_difference/requirements/
	explicit_instantiation/2.cc: Rename types that conflict with C++20
	concepts.
	* testsuite/26_numerics/adjacent_difference/requirements/
	explicit_instantiation/pod.cc: Likewise.
	* testsuite/26_numerics/partial_sum/requirements/
	explicit_instantiation/2.cc: Likewise.
	* testsuite/26_numerics/partial_sum/requirements/
	explicit_instantiation/pod.cc: Likewise.
	* testsuite/experimental/iterator/requirements.cc: Likewise.
	* testsuite/std/ranges/access/begin.cc: New test.
	* testsuite/std/ranges/access/cbegin.cc: New test.
	* testsuite/std/ranges/access/cdata.cc: New test.
	* testsuite/std/ranges/access/cend.cc: New test.
	* testsuite/std/ranges/access/crbegin.cc: New test.
	* testsuite/std/ranges/access/crend.cc: New test.
	* testsuite/std/ranges/access/data.cc: New test.
	* testsuite/std/ranges/access/empty.cc: New test.
	* testsuite/std/ranges/access/end.cc: New test.
	* testsuite/std/ranges/access/rbegin.cc: New test.
	* testsuite/std/ranges/access/rend.cc: New test.
	* testsuite/std/ranges/access/size.cc: New test.
	* testsuite/util/testsuite_iterators.h (contiguous_iterator_wrapper)
	(test_range, test_sized_range): New test utilities.

From-SVN: r277579
2019-10-29 17:44:18 +00:00
Jonathan Wakely
9921ac3db3 Minor improvements to testsuite iterator utilities
* testsuite/util/testsuite_iterators.h (BoundsContainer::size()): Add
	new member function.
	(WritableObject::operator=): Constrain with enable_if when available.
	(remove_cv): Use std::remove_if when available.
	(test_container::it(int)): Use size().
	(test_container::size()): Use BoundsContainer::size().

From-SVN: r277578
2019-10-29 17:15:04 +00:00
Jonathan Wakely
0ed4d40833 PR libstdc++/92267 fix ABI change in deque iterators
Defaulting the copy constructor on its first declaration made it change
from user-provided (and non-trivial) to implicitly-defined (and
trivial). This caused an ABI incompatibility between GCC 8 and GCC 9,
where functions taking a deque iterator disagree on the argument passing
convention.

	PR libstdc++/92267
	* include/bits/stl_deque.h (_Deque_iterator(const _Deque_iterator&)):
	Do not define as defaulted.
	* testsuite/23_containers/deque/types/92267.cc: New test.

From-SVN: r277577
2019-10-29 17:14:55 +00:00
Martin Sebor
668ca0509c re PR testsuite/92144 (c-c++-common/Warray-bounds-4.c still fails after r277080)
gcc/testsuite/ChangeLog:

	PR testsuite/92144
	* c-c++-common/Warray-bounds-4.c: Disable test to avoid failures
	due to PR 83543.

From-SVN: r277576
2019-10-29 10:14:18 -06:00
Paul Pluzhnikov
1c40e11956 cp-demangle.c (d_number): Avoid signed int overflow.
2019-10-29 Paul Pluzhnikov  <ppluzhnikov@google.com>

	* cp-demangle.c (d_number): Avoid signed int overflow.

From-SVN: r277575
2019-10-29 08:29:59 -07:00
Martin Liska
fd46280df1 Pass memory statistics for {symbol,call}_summary.
2019-10-29  Martin Liska  <mliska@suse.cz>

	* symbol-summary.h (function_summary): Pass memory location
	to underlaying hash_map (or vec).
	(V>::fast_function_summary): Likewise.

From-SVN: r277573
2019-10-29 13:52:57 +00:00
Martin Liska
78cd68c0af Release function and edge summaries allocated with GGC.
2019-10-29  Martin Liska  <mliska@suse.cz>

	* ggc.h (ggc_alloc_no_dtor): New function.
	* ipa-fnsummary.c (ipa_free_fn_summary): Call
	destructor and ggc_free.
	(ipa_free_size_summary): Call delete instead
	of release.
	* ipa-fnsummary.h: Use new function ggc_alloc_no_dtor.
	* ipa-prop.c (ipa_check_create_edge_args): Likewise.
	(ipa_free_all_edge_args): Call destructor and ggc_free.
	(ipa_free_all_node_params): Likewise.
	(ipcp_free_transformation_sum): Likewise.
	* ipa-prop.h (ipa_check_create_node_params):
	Call new ggc_alloc_no_dtor.
	* ipa-sra.c (ipa_sra_generate_summary): Likewise.
	(ipa_sra_analysis): Call destructor and ggc_free.
	Replace release with delete operator.
	* symbol-summary.h (release): Remove ..
	(V>::~fast_function_summary): and move logic here.
	Likewise for other classes.

From-SVN: r277572
2019-10-29 13:52:42 +00:00
Richard Biener
318bd8c60d re PR tree-optimization/92260 (ICE in exact_div, at poly-int.h:2162)
2019-10-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/92260
	* tree-vect-slp.c (vect_get_constant_vectors): Special-case
	lane-reducing ops.

	* gcc.dg/pr92260.c: New testcase.

From-SVN: r277571
2019-10-29 13:46:19 +00:00
Andre Vieira
97c1460367 [vect]PR 88915: Vectorize epilogues when versioning loops
gcc/ChangeLog:
2019-10-29  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	PR 88915
	* tree-ssa-loop-niter.h (simplify_replace_tree): Change declaration.
	* tree-ssa-loop-niter.c (simplify_replace_tree): Add context parameter
	and make the valueize function pointer also take a void pointer.
	* gcc/tree-ssa-sccvn.c (vn_valueize_wrapper): New function to wrap
	around vn_valueize, to call it without a context.
	(process_bb): Use vn_valueize_wrapper instead of vn_valueize.
	* tree-vect-loop.c (_loop_vec_info): Initialize epilogue_vinfos.
	(~_loop_vec_info): Release epilogue_vinfos.
	(vect_analyze_loop_costing): Use knowledge of main VF to estimate
	number of iterations of epilogue.
	(vect_analyze_loop_2): Adapt to analyse main loop for all supported
	vector sizes when vect-epilogues-nomask=1.  Also keep track of lowest
	versioning threshold needed for main loop.
	(vect_analyze_loop): Likewise.
	(find_in_mapping): New helper function.
	(update_epilogue_loop_vinfo): New function.
	(vect_transform_loop): When vectorizing epilogues re-use analysis done
	on main loop and call update_epilogue_loop_vinfo to update it.
	* tree-vect-loop-manip.c (vect_update_inits_of_drs): No longer insert
	stmts on loop preheader edge.
	(vect_do_peeling): Enable skip-vectors when doing loop versioning if
	we decided to vectorize epilogues.  Update epilogues NITERS and
	construct ADVANCE to update epilogues data references where needed.
	* tree-vectorizer.h (_loop_vec_info): Add epilogue_vinfos.
	(vect_do_peeling, vect_update_inits_of_drs,
	 determine_peel_for_niter, vect_analyze_loop): Add or update
	declarations.
	* tree-vectorizer.c (try_vectorize_loop_1): Make sure to use already
	created loop_vec_info's for epilogues when available.  Otherwise analyse
	epilogue separately.

From-SVN: r277569
2019-10-29 13:15:46 +00:00
Richard Biener
3ab7687743 tree-ssa.texi (Immediate Uses): Fix FOR_EACH_IMM_USE_STMT example.
2019-10-29  Richard Biener  <rguenther@suse.de>

	* doc/tree-ssa.texi (Immediate Uses): Fix FOR_EACH_IMM_USE_STMT
	example.

From-SVN: r277568
2019-10-29 11:32:04 +00:00
Richard Sandiford
1d149b7260 Fix reduc_index calculation in vectorizable_condition
Fixes ICEs in gcc.target/aarch64/sve/clastb*.

2019-10-29  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-stmts.c (vectorizable_condition): Get the reduction
	index for the COND_EXPR from stmt_info rather than reduc_info.

From-SVN: r277567
2019-10-29 10:41:45 +00:00
Richard Biener
b7ff7cef50 re PR tree-optimization/65930 (Reduction with sign-change not handled)
2019-10-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/65930
	* tree-vect-loop.c (check_reduction_path): Relax single-use
	check allowing out-of-loop uses.
	(vect_is_simple_reduction): SLP reduction chains cannot have
	intermediate stmts used outside of the loop.
	(vect_create_epilog_for_reduction): The adjustment might need
	to be converted.
	(vectorizable_reduction): Annotate live stmts of the reduction
	chain with STMT_VINFO_REDUC_DEF.
	* tree-vect-stms.c (process_use): Remove no longer true asserts.

	* gcc.dg/vect/pr65930-1.c: New testcase.

From-SVN: r277566
2019-10-29 09:33:49 +00:00