1. 30 Jan, 2020 7 commits
  2. 29 Jan, 2020 26 commits
    • c++: Fix attributes with lambda and trailing return type. · 245e40af
      My fix for 60503 fixed handling of C++11 attributes following the
      lambda-declarator.  My patch for 89640 re-added support for GNU attributes,
      but attributes after the trailing return type were parsed as applying to the
      return type rather than to the function.  This patch adjusts parsing of a
      trailing-return-type to ignore GNU attributes at the end of the declaration
      so that they will be applied to the declaration as a whole.
      
      I also considered parsing the attributes between the closing paren and the
      trailing-return-type, and tried a variety of approaches to implementing
      that, but I think it's better to stick with the documented rule that "An
      attribute specifier list may appear immediately before the comma, '=' or
      semicolon terminating the declaration of an identifier...."  Anyone
      disagree?
      
      Meanwhile, C++ committee discussion about the lack of any way to apply
      attributes to a lambda op() seems to have concluded that they should go
      between the introducer and declarator, so I've implemented that as well.
      
      	PR c++/90333
      	PR c++/89640
      	PR c++/60503
      	* parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
      	a trailing return type.
      	(cp_parser_lambda_declarator_opt): Parse C++11 attributes before
      	parens.
      Jason Merrill committed
    • GCN – call assembler with -mattr=-code-object-v3 (PR93409) · 165255c7
              PR bootstrap/93409
              * config/gcn/gcn-hsa.h (ASM_SPEC): Add -mattr=-code-object-v3 as
              LLVM's assembler changed the default in version 9.
      Tobias Burnus committed
    • c++: Add new test [PR88092] · 11ffae58
      This test got fixed by r10-1976-gdaaa6fcc
      so let's add it to the testsuite.
      
      	PR c++/88092
      	* g++.dg/cpp2a/nontype-class31.C: New test.
      Marek Polacek committed
    • Improve DSE which in turn eliminates the need for jump threading and block… · 0de349f1
      Improve DSE which in turn eliminates the need for jump threading and block duplication for the original testcase in pr89689 which in turn eliminates the false positive -Warray-bounds warning for the original testcase.
      
      	PR tree-optimization/89689
      	* builtins.def (BUILT_IN_OBJECT_SIZE): Make it const rather than pure.
      
      	PR tree-optimization/89689
      	* gcc.dg/pr89689.c: New test.
      Jeff Law committed
    • Revert g-465c7c89 · 2812a284
      The patch caused regressions in gcc.target/sh/pr64345-1.c on
      sh3-linux-gnu and gcc.target/m68k/pr39726.c on m68k-linux-gnu.
      It didn't look like they would be fixable in an acceptably
      non-invasive and unhacky way, so punting till future releases.
      
      2020-01-29  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	Revert:
      
      	2020-01-28  Richard Sandiford  <richard.sandiford@arm.com>
      
      	PR rtl-optimization/87763
      	* simplify-rtx.c (simplify_truncation): Extend sign/zero_extract
      	simplification to handle subregs as well as bare regs.
      	* config/i386/i386.md (*testqi_ext_3): Match QI extracts too.
      Richard Sandiford committed
    • c++: Fix template arguments comparison with class NTTP [PR91754] · e3b60da8
      Here we fail to compile the attached test, stating that the use of
      T<s> in T<s>::T() {} is "invalid use of incomplete type".  It is a
      function definition so grokdeclarator checks that the qualifying type
      is complete.
      
      When we parsed the class T, finish_struct gave the class a non-null
      TYPE_SIZE, making it COMPLETE_TYPE_P.  But then we're parsing T<s>,
      a TEMPLATE_ID, in
      
        T<s>::T() {}
      
      so try to lookup_template_class T.  This failed because we couldn't
      find such a class: comp_template_args told us that the argument lists
      don't match, because one of the args was wrapped in a VIEW_CONVERT_EXPR
      to make it look const.  It seems to me that we should see through
      these artificial wrappers and consider the args same.
      
      2020-01-29  Marek Polacek  <polacek@redhat.com>
      
      	PR c++/91754 - Fix template arguments comparison with class NTTP.
      	* pt.c (class_nttp_const_wrapper_p): New.
      	(template_args_equal): See through class_nttp_const_wrapper_p
      	arguments.
      
      	* g++.dg/cpp2a/nontype-class30.C: New test.
      Marek Polacek committed
    • c++: Fix class NTTP with template arguments [PR92948] · 42328405
      This PR points out an ICE with an alias template and class NTTP, but I
      found that there are more issues.  Trouble arise when we use a
      (non-type) template parameter as an argument to the template arg list of
      a template that accepts a class NTTP and a conversion to a class is
      involved, e.g.
      
        struct A { A(int) { } };
        template<A a> struct B { };
      
        template<int X> void fn () {
            B<X> b;
        }
      
      Normally for such a conversion we create a TARGET_EXPR with an
      AGGR_INIT_EXPR that calls a __ct_comp with some arguments, but not in
      this case: when converting X to type A in convert_nontype_argument we
      are in a template and the template parameter 'X' is value-dependent, and
      AGGR_INIT_EXPR don't work in templates.  So it just creates a TARGET_EXPR
      that contains "A::A(*this, X)", but with that overload resolution fails:
        error: no matching function for call to 'A::A(A*, int)'
      That happens because finish_call_expr for a BASELINK creates a dummy
      object, so we have 'this' twice.  I thought for the value-dependent case
      we could use IMPLICIT_CONV_EXPR, as in the patch below.  Note that I
      only do this when we convert to a different type than the type of the
      expr.  The point is to avoid the call to a converting ctor.
      
      The second issue was an ICE in tsubst_copy: when there's a conversion
      like the above involved then
       /* Wrapper to make a C++20 template parameter object const.  */
        op = tsubst_copy (op, args, complain, in_decl);
      might not produce a _ZT... VAR_DECL with const type, so the assert
        gcc_assert (CP_TYPE_CONST_P (TREE_TYPE (op)));
      fails.  Allowing IMPLICIT_CONV_EXPR there probably makes sense.
      
      And since convert_nontype_argument uses value_dependent_expression_p
      a lot, I used a dedicated bool to speed things up.
      
      2020-01-29  Marek Polacek  <polacek@redhat.com>
      
      	PR c++/92948 - Fix class NTTP with template arguments.
      	* pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
      	converting a value-dependent expression to a class type.
      	(tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
      	as the result of the tsubst_copy call.
      
      	* g++.dg/cpp2a/nontype-class28.C: New test.
      	* g++.dg/cpp2a/nontype-class29.C: New test.
      Marek Polacek committed
    • libstdc++: Fix conformance issues in <stop_token> (PR92895) · 0a8f4feb
      Fix synchronization issues in <stop_token>. Replace shared_ptr with
      _Stop_state_ref and a reference count embedded in the shared state.
      Replace std::mutex with spinlock using one bit of a std::atomic<> that
      also tracks whether a stop request has been made and how many
      stop_source objects share ownership of the state.
      
      	PR libstdc++/92895
      	* include/std/stop_token (stop_token::stop_possible()): Call new
      	_M_stop_possible() function.
      	(stop_token::stop_requested()): Do not use stop_possible().
      	(stop_token::binary_semaphore): New class, as temporary stand-in for
      	std::binary_semaphore.
      	(stop_token::_Stop_cb::_M_callback): Add noexcept to type.
      	(stop_token::_Stop_cb::_M_destroyed, stop_token::_Stop_cb::_M_done):
      	New data members for symchronization with stop_callback destruction.
      	(stop_token::_Stop_cb::_Stop_cb): Make non-template.
      	(stop_token::_Stop_cb::_M_linked, stop_token::_Stop_cb::_S_execute):
      	Remove.
      	(stop_token::_Stop_cb::_M_run): New member function.
      	(stop_token::_Stop_state::_M_stopped, stop_token::_Stop_state::_M_mtx):
      	Remove.
      	(stop_token::_Stop_state::_M_owners): New data member to track
      	reference count for ownership.
      	(stop_token::_Stop_state::_M_value): New data member combining a
      	spinlock, the stop requested flag, and the reference count for
      	associated stop_source objects.
      	(stop_token::_Stop_state::_M_requester): New data member for
      	synchronization with stop_callback destruction.
      	(stop_token::_Stop_state::_M_stop_possible()): New member function.
      	(stop_token::_Stop_state::_M_stop_requested()): Inspect relevant bit
      	of _M_value.
      	(stop_token::_Stop_state::_M_add_owner)
      	(stop_token::_Stop_state::_M_release_ownership)
      	(stop_token::_Stop_state::_M_add_ssrc)
      	(stop_token::_Stop_state::_M_sub_ssrc): New member functions for
      	updating reference counts.
      	(stop_token::_Stop_state::_M_lock, stop_token::_Stop_state::_M_unlock)
      	(stop_token::_Stop_state::_M_lock, stop_token::_Stop_state::_M_unlock)
      	(stop_token::_Stop_state::_M_try_lock)
      	(stop_token::_Stop_state::_M_try_lock_and_stop)
      	(stop_token::_Stop_state::_M_do_try_lock): New member functions for
      	managing spinlock.
      	(stop_token::_Stop_state::_M_request_stop): Use atomic operations to
      	read and update state. Release lock while running callbacks. Use new
      	data members to synchronize with callback destruction.
      	(stop_token::_Stop_state::_M_remove_callback): Likewise.
      	(stop_token::_Stop_state::_M_register_callback): Use atomic operations
      	to read and update state.
      	(stop_token::_Stop_state_ref): Handle type to manage _Stop_state,
      	replacing shared_ptr.
      	(stop_source::stop_source(const stop_source&)): Update reference count.
      	(stop_source::operator=(const stop_source&)): Likewise.
      	(stop_source::~stop_source()): Likewise.
      	(stop_source::stop_source(stop_source&&)): Define as defaulted.
      	(stop_source::operator=(stop_source&&)): Establish postcondition on
      	parameter.
      	(stop_callback): Enforce preconditions on template parameter. Replace
      	base class with data member of new _Cb_impl type.
      	(stop_callback::stop_callback(const stop_token&, Cb&&))
      	(stop_callback::stop_callback(stop_token&&, Cb&&)): Fix TOCTTOU race.
      	(stop_callback::_Cb_impl): New type wrapping _Callback member and
      	defining the _S_execute member function.
      	* testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc: New
      	test.
      	* testsuite/30_threads/stop_token/stop_callback/deadlock.cc: New test.
      	* testsuite/30_threads/stop_token/stop_callback/destroy.cc: New test.
      	* testsuite/30_threads/stop_token/stop_callback/destructible_neg.cc:
      	New test.
      	* testsuite/30_threads/stop_token/stop_callback/invocable_neg.cc: New
      	test.
      	* testsuite/30_threads/stop_token/stop_callback/invoke.cc: New test.
      	* testsuite/30_threads/stop_token/stop_source/assign.cc: New test.
      	* testsuite/30_threads/stop_token/stop_token/stop_possible.cc: New
      	test.
      Jonathan Wakely committed
    • Add acc_device_radeon to name_of_acc_device_t function · 989a5fb3
      libgomp/
      	* oacc-init.c (name_of_acc_device_t): Handle acc_device_radeon.
      
      Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
      Frederik Harwath committed
    • IRA: Revert 11b8091f to fix PR 93221 · bcf3fa7c
      A previous change to simplify LRA introduced in 11b809 (From-SVN: r279550)
      disabled hard register splitting for -O0. This causes a problem on aarch64 in
      cases where parameters are passed in multiple registers (in the bug report an OI
      passed in 2 V4SI registers). This is mandated by the AAPCS.
      
      gcc/ChangeLog:
      2020-01-29  Joel Hutton  <Joel.Hutton@arm.com>
      
      	PR target/93221
      	* ira.c (ira): Revert use of simplified LRA algorithm.
      
      gcc/testsuite/ChangeLog:
      2020-01-29  Joel Hutton  <Joel.Hutton@arm.com>
      
      	PR target/93221
      	* gcc.target/aarch64/pr93221.c: New test.
      Andre Vieira committed
    • libstdc++: Simplify constraints on std::compare_three_way · f214ffb3
      The __3way_builtin_ptr_cmp concept can use three_way_comparable_with to
      check whether <=> is valid. Doing that makes it obvious that the
      disjunction on compare_three_way::operator() is redundant, because
      the second constraint subsumes the first.
      
      The workaround for PR c++/91073 can also be removed as that bug is fixed
      now.
      
      	* libsupc++/compare (__detail::__3way_builtin_ptr_cmp): Use
      	three_way_comparable_with.
      	(__detail::__3way_cmp_with): Remove workaround for fixed bug.
      	(compare_three_way::operator()): Remove redundant constraint from
      	requires-clause.
      	(__detail::_Synth3way::operator()): Use three_way_comparable_with
      	instead of workaround.
      	* testsuite/18_support/comparisons/object/93479.cc: Prune extra
      	output due to simplified constraints on compare_three_way::operator().
      Jonathan Wakely committed
    • libstdc++: Make std::compare_three_way check if <=> is valid (PR 93479) · 83b02010
      Currently types that cannot be compared using <=> but which are
      convertible to pointers will be compared by converting to pointers
      first. They should not be comparable.
      
      	PR libstdc++/93479
      	* libsupc++/compare (__3way_builtin_ptr_cmp): Require <=> to be valid.
      	* testsuite/18_support/comparisons/object/93479.cc: New test.
      Jonathan Wakely committed
    • libstdc++: Make tests for std::ranges access functions more robust · 5cd2e126
      	* testsuite/std/ranges/access/end.cc: Do not assume test_range::end()
      	returns the same type as test_range::begin(). Add comments.
      	* testsuite/std/ranges/access/rbegin.cc: Likewise.
      	* testsuite/std/ranges/access/rend.cc: Likewise.
      	* testsuite/std/ranges/range.cc: Do not assume the sentinel for
      	test_range is the same as its iterator type.
      	* testsuite/util/testsuite_iterators.h (test_range::sentinel): Add
      	operator- overloads to satisfy sized_sentinel_for when the iterator
      	satisfies random_access_iterator.
      Jonathan Wakely committed
    • SRA: Also propagate accesses from LHS to RHS [PR92706] · 6693911f
      2020-01-29  Martin Jambor  <mjambor@suse.cz>
      
      	PR tree-optimization/92706
      	* tree-sra.c (struct access): Fields first_link, last_link,
      	next_queued and grp_queued renamed to first_rhs_link, last_rhs_link,
      	next_rhs_queued and grp_rhs_queued respectively, new fields
      	first_lhs_link, last_lhs_link, next_lhs_queued and grp_lhs_queued.
      	(struct assign_link): Field next renamed to next_rhs, new field
      	next_lhs.  Updated comment.
      	(work_queue_head): Renamed to rhs_work_queue_head.
      	(lhs_work_queue_head): New variable.
      	(add_link_to_lhs): New function.
      	(relink_to_new_repr): Also relink LHS lists.
      	(add_access_to_work_queue): Renamed to add_access_to_rhs_work_queue.
      	(add_access_to_lhs_work_queue): New function.
      	(pop_access_from_work_queue): Renamed to
      	pop_access_from_rhs_work_queue.
      	(pop_access_from_lhs_work_queue): New function.
      	(build_accesses_from_assign): Also add links to LHS lists and to LHS
      	work_queue.
      	(child_would_conflict_in_lacc): Renamed to
      	child_would_conflict_in_acc.  Adjusted parameter names.
      	(create_artificial_child_access): New parameter set_grp_read, use it.
      	(subtree_mark_written_and_enqueue): Renamed to
      	subtree_mark_written_and_rhs_enqueue.
      	(propagate_subaccesses_across_link): Renamed to
      	propagate_subaccesses_from_rhs.
      	(propagate_subaccesses_from_lhs): New function.
      	(propagate_all_subaccesses): Also propagate subaccesses from LHSs to
      	RHSs.
      
      	testsuite/
      	* gcc.dg/tree-ssa/pr92706-1.c: New test.
      Martin Jambor committed
    • SRA: Total scalarization after access propagation [PR92706] · 636e80ee
      2020-01-29  Martin Jambor  <mjambor@suse.cz>
      
      	PR tree-optimization/92706
      	* tree-sra.c (struct access): Adjust comment of
      	grp_total_scalarization.
      	(find_access_in_subtree): Look for single children spanning an entire
      	access.
      	(scalarizable_type_p): Allow register accesses, adjust callers.
      	(completely_scalarize): Remove function.
      	(scalarize_elem): Likewise.
      	(create_total_scalarization_access): Likewise.
      	(sort_and_splice_var_accesses): Do not track total scalarization
      	flags.
      	(analyze_access_subtree): New parameter totally, adjust to new meaning
      	of grp_total_scalarization.
      	(analyze_access_trees): Pass new parameter to analyze_access_subtree.
      	(can_totally_scalarize_forest_p): New function.
      	(create_total_scalarization_access): Likewise.
      	(create_total_access_and_reshape): Likewise.
      	(total_should_skip_creating_access): Likewise.
      	(totally_scalarize_subtree): Likewise.
      	(analyze_all_variable_accesses): Perform total scalarization after
      	subaccess propagation using the new functions above.
      	(initialize_constant_pool_replacements): Output initializers by
      	traversing the access tree.
      
      	testsuite/
      	* gcc.dg/tree-ssa/pr92706-2.c: New test.
      	* gcc.dg/guality/pr59776.c: Xfail tests for s2.g.
      Martin Jambor committed
    • SRA: Add verification of accesses · 5b9e89c9
      2020-01-29  Martin Jambor  <mjambor@suse.cz>
      
      	* tree-sra.c (verify_sra_access_forest): New function.
      	(verify_all_sra_access_forests): Likewise.
      	(create_artificial_child_access): Set parent.
      	(analyze_all_variable_accesses): Call the verifier.
      Martin Jambor committed
    • ipa: Fix removal of multi-target speculation. · 7c710777
      	* cgraph.c (cgraph_edge::resolve_speculation): Only lookup direct edge
      	if called on indirect edge.
      	(cgraph_edge::redirect_call_stmt_to_callee): Lookup indirect edge of
      	speculative call if needed.
      
      	* gcc.dg/tree-prof/indir-call-prof-2.c: New testcase.
      Jan Hubicka committed
    • Adjust formatting of acc_get_property tests · 87c3fcfa
      libgomp/
       * testsuite/libgomp.oacc-c-c++-common/acc_get_property.c:
       Adjust to GNU coding style.
       * testsuite/libgomp.oacc-c-c++-common/acc_get_property-aux.c: Likewise.
       * testsuite/libgomp.oacc-c-c++-common/acc_get_property-gcn.c: Likewise.
       * testsuite/libgomp.oacc-c-c++-common/acc_get_property-host.c: Likewise.
       * testsuite/libgomp.oacc-c-c++-common/acc_get_property-nvptx.c: Likewise.
      Frederik Harwath committed
    • Add OpenACC acc_get_property support for AMD GCN · 2e5ea579
      Add full support for the OpenACC 2.6 acc_get_property and
      acc_get_property_string functions to the libgomp GCN plugin.
      
      libgomp/
      	* plugin-gcn.c (struct agent_info): Add fields "name" and
      	"vendor_name" ...
      	(GOMP_OFFLOAD_init_device): ... and init from here.
      	(struct hsa_context_info): Add field "driver_version_s" ...
      	(init_hsa_contest): ... and init from here.
      	(GOMP_OFFLOAD_openacc_get_property): Replace stub with a proper
      	implementation.
      	* testsuite/libgomp.oacc-c-c++-common/acc_get_property.c:
      	Enable test execution for amdgcn and host offloading targets.
      	* testsuite/libgomp.oacc-fortran/acc_get_property.f90: Likewise.
      	* testsuite/libgomp.oacc-c-c++-common/acc_get_property-aux.c
      	(expect_device_properties): Split function into ...
      	(expect_device_string_properties): ... this new function ...
      	(expect_device_memory): ... and this new function.
      	* testsuite/libgomp.oacc-c-c++-common/acc_get_property-gcn.c:
      	Add test.
      Frederik Harwath committed
    • testsuite: XFAIL gcc.dg/torture/pr93133.c for powerpc*-*-* [PR93393] · f57ccb55
      2020-01-29  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/testsuite/
      	PR testsuite/93393
      	* gcc.dg/torture/pr93133.c: XFAIL for powerpc*-*-*.
      Richard Sandiford committed
    • openmp: c++: Consider typeinfo decls to be predetermined shared [PR91118] · 8d7c0bf8
      If the typeinfo decls appear in OpenMP default(none) regions, as we no longer
      predetermine const with no mutable members, they are diagnosed as errors,
      but it isn't something the users can actually provide explicit sharing for in
      the clauses.
      
      2020-01-29  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/91118
      	* cp-gimplify.c (cxx_omp_predetermined_sharing): Return
      	OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
      
      	* g++.dg/gomp/pr91118-1.C: New test.
      	* g++.dg/gomp/pr91118-2.C: New test.
      Jakub Jelinek committed
    • openmp: Handle rest of EXEC_OACC_* in oacc_code_to_statement [PR93463] · aa1b5696
      As the testcase shows, some EXEC_OACC_* codes weren't handled in
      oacc_code_to_statement.  Fixed thusly.
      
      2020-01-29  Jakub Jelinek  <jakub@redhat.com>
      
      	PR fortran/93463
      	* openmp.c (oacc_code_to_statement): Handle
      	EXEC_OACC_{ROUTINE,UPDATE,WAIT,CACHE,{ENTER,EXIT}_DATA,DECLARE}.
      
      	* gfortran.dg/goacc/pr93463.f90: New test.
      Jakub Jelinek committed
    • analyzer: fix build with gcc 4.4 (PR 93276) · 7892ff37
      All that is really needed is make sure you #include "diagnostic-core.h"
      before including pretty-print.h.  By including
      diagnostic-core.h first, you do:
      and then pretty-print.h will do:
      If instead pretty-print.h is included first, then it will use __gcc_diag__
      instead of __gcc_tdiag__ and thus will assume %E/%D etc. can't be handled.
      
      2020-01-29  Jakub Jelinek  <jakub@redhat.com>
      
      	* analyzer.h (PUSH_IGNORE_WFORMAT, POP_IGNORE_WFORMAT): Remove.
      	* constraint-manager.cc: Include diagnostic-core.h before graphviz.h.
      	(range::dump, equiv_class::print): Don't use PUSH_IGNORE_WFORMAT or
      	POP_IGNORE_WFORMAT.
      	* state-purge.cc: Include diagnostic-core.h before
      	gimple-pretty-print.h.
      	(state_purge_annotator::add_node_annotations, print_vec_of_names):
      	Don't use PUSH_IGNORE_WFORMAT or POP_IGNORE_WFORMAT.
      	* region-model.cc: Move diagnostic-core.h include before graphviz.h.
      	(path_var::dump, svalue::print, constant_svalue::print_details,
      	region::dump_to_pp, region::dump_child_label, region::print_fields,
      	map_region::print_fields, map_region::dump_dot_to_pp,
      	map_region::dump_child_label, array_region::print_fields,
      	array_region::dump_dot_to_pp): Don't use PUSH_IGNORE_WFORMAT or
      	POP_IGNORE_WFORMAT.
      Jakub Jelinek committed
    • tree-optimization/93428 - avoid load permutation vector clobbering · 148018bc
      With SLP now being a graph with shared nodes across instances we have
      to make sure to compute the load permutation of nodes once, not
      overwriting the result of earlier analysis.
      
      2020-01-28  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/93428
      	* tree-vect-slp.c (vect_build_slp_tree_2): Compute the load
      	permutation when the load node is created.
      	(vect_analyze_slp_instance): Re-use it here.
      
      	* gcc.dg/torture/pr93428.c: New testcase.
      Richard Biener committed
    • Fix bogus Changelog entry. · 345ea961
      	* ipa-prop.c (update_indirect_edges_after_inlining): Fix warning.
      Jan Hubicka committed
    • Daily bump. · 1e8900ea
      GCC Administrator committed
  3. 28 Jan, 2020 7 commits