Commit Graph

174624 Commits

Author SHA1 Message Date
John David Anglin
64464e5f36 Fix ICE in pa_elf_select_rtx_section.
2020-01-30  John David Anglin  <danglin@gcc.gnu.org>

	* config/pa/pa.c (pa_elf_select_rtx_section): Place function pointers
	without a DECL in .data.rel.ro.local.
2020-01-30 07:26:58 -05:00
Jakub Jelinek
efd26bbc81 arm: Fix uaddvdi4 expander [PR93494]
uaddvdi4 expander has an optimization for the low 32-bits of the 2nd input
operand known to be 0.  Unfortunately, in that case it only emits copying of
the low 32 bits to the low 32 bits of the destination, but doesn't emit the
addition with overflow detection for the high 64 bits.
Well, to be precise, it emits it, but into an RTL sequence returned by
gen_uaddvsi4, but that sequence isn't emitted anywhere.

2020-01-30  Jakub Jelinek  <jakub@redhat.com>

	PR target/93494
	* config/arm/arm.md (uaddvdi4): Actually emit what gen_uaddvsi4
	returned.

	* gcc.c-torture/execute/pr93494.c: New test.
2020-01-30 12:58:20 +01:00
Tobias Burnus
5ab5d81b36 Skip plugin-{gcn,hsa} for (-m)x32 (PR bootstrap/93409)
PR bootstrap/93409
        * plugin/configfrag.ac (enable_offload_targets): Skip
        HSA and GCN plugin besides -m32 also for -mx32.
        * configure: Regenerate.
2020-01-30 12:27:17 +01:00
Paolo Carlini
b0e9b18ed4 Add testcase of PR c++/90338, already fixed in trunk.
PR c++/90338
	* g++.dg/pr90338.C: New.
2020-01-30 11:39:04 +01:00
Jakub Jelinek
d37c81f476 i386: Optimize {,v}{,p}movmsk{b,ps,pd} followed by sign extension [PR91824]
Some time ago, patterns were added to optimize move mask followed by zero
extension from 32 bits to 64 bit.  As the testcase shows, the intrinsics
actually return int, not unsigned int, so it will happen quite often that
one actually needs sign extension instead of zero extension.  Except for
vpmovmskb with 256-bit operand, sign vs. zero extension doesn't make a
difference, as we know the bit 31 will not be set (the source will have 2 or
4 doubles, 4 or 8 floats or 16 or 32 chars).
So, for the floating point patterns, this patch just uses a code iterator
so that we handle both zero extend and sign extend, and for the byte one
adds a separate pattern for the 128-bit operand.

2020-01-30  Jakub Jelinek  <jakub@redhat.com>

	PR target/91824
	* config/i386/sse.md
	(*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext): Renamed to ...
	(*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_<u>ext): ... this.  Use
	any_extend code iterator instead of always zero_extend.
	(*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext_lt): Renamed to ...
	(*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_<u>ext_lt): ... this.
	Use any_extend code iterator instead of always zero_extend.
	(*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext_shift): Renamed to ...
	(*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_<u>ext_shift): ... this.
	Use any_extend code iterator instead of always zero_extend.
	(*sse2_pmovmskb_ext): New define_insn.
	(*sse2_pmovmskb_ext_lt): New define_insn_and_split.

	* gcc.target/i386/pr91824-2.c: New test.
2020-01-30 09:41:00 +01:00
Jakub Jelinek
b285bebe6a i386: Optimize popcnt followed by zero/sign extension [PR91824]
Like any other instruction with 32-bit GPR destination operand in 64-bit
mode, popcntl also clears the upper 32 bits of the register (and other bits
too, it can return only 0 to 32 inclusive).

During combine, the zero or sign extensions of it show up as paradoxical
subreg of the popcount & 63, there 63 is the smallest power of two - 1 mask
that can represent all the 0 to 32 inclusive values.

2020-01-30  Jakub Jelinek  <jakub@redhat.com>

	PR target/91824
	* config/i386/i386.md (*popcountsi2_zext): New define_insn_and_split.
	(*popcountsi2_zext_falsedep): New define_insn.

	* gcc.target/i386/pr91824-1.c: New test.
2020-01-30 09:39:05 +01:00
Jakub Jelinek
2595f25cda fortran: Fix up ISO_Fortran_binding_15.f90 failures [PR92123]
This is something that has been discussed already a few months ago, but
seems to have stalled.  Here is Paul's patch from the PR except for the
TREE_STATIC hunk which is wrong, and does the most conservative fn spec
tweak for the problematic two builtins we are aware of (to repeat what is in
the PR, both .wR and .ww are wrong for these builtins that transform one
layout of an descriptor to another one; while the first pointer is properly
marked that we only store to what it points to, from the second pointer
we copy and reshuffle the content and store into the first one; if there
wouldn't be any pointers, ".wr" would be just fine, but as there is a
pointer and that pointer is copied to the area pointed by first argument,
the pointer effectively leaks that way, so we e.g. can't optimize stores
into what the data pointer in the descriptor points to).  I haven't
analyzed other fn spec attributes in the FE, but think it is better to
fix at least this one we have analyzed.

2020-01-30  Paul Thomas  <pault@gcc.gnu.org>
	    Jakub Jelinek  <jakub@redhat.com>

	PR fortran/92123
	* trans-decl.c (gfc_get_symbol_decl): Call gfc_defer_symbol_init for
	CFI descs.
	(gfc_build_builtin_function_decls): Use ".w." instead of ".ww" or ".wR"
	for gfor_fndecl_{cfi_to_gfc,gfc_to_cfi}.
	(convert_CFI_desc): Handle references to CFI descriptors.

Co-authored-by: Paul Thomas <pault@gcc.gnu.org>
2020-01-30 09:35:03 +01:00
Dragan Mladjenovic
e0332517f9 Regenerate configure for 54b3d52
Commit 54b3d52 ("Emit .note.GNU-stack for hard-float linux targets.")
was missing generated files.  Add them now.

gcc/ChangeLog:

2020-01-30  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>

	* config.in: Regenerated.
	* configure: Regenerated.
2020-01-30 08:56:06 +01:00
Bin Cheng
3904cc106e Use promise in coroutine frame in actor function.
By standard, coroutine body should be encapsulated in try-catch block
as following:
  try {
    // coroutine body
  } catch(...) {
    promise.unhandled_exception();
  }
Given above try-catch block is implemented in the coroutine actor
function called by coroutine ramp function, so the promise should
be accessed via actor function's coroutine frame pointer argument,
rather than the ramp function's coroutine frame variable.

This patch cleans code a bit to make fix easy.

gcc/cp
    * coroutines.cc (act_des_fn): New.
    (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
    Access promise via actor function's frame pointer argument.
    (build_actor_fn, build_destroy_fn): Use frame pointer argument.
2020-01-30 12:35:53 +08:00
Bin Cheng
3b35b3d4cc Handle CO_AWAIT_EXPR in conversion in co_await_expander.
Function co_await_expander expands CO_AWAIT_EXPR and inserts expanded
code before result of co_await is used, however, it doesn't cover the
type conversion case and leads to gimplify ICE.  This patch fixes it.

gcc/cp
    * coroutines.cc (co_await_expander): Handle type conversion case.

gcc/testsuite
    * g++.dg/coroutines/co-await-syntax-09-convert.C: New test.
2020-01-30 12:35:46 +08:00
Ian Lance Taylor
66af5a226a runtime, syscall: add a couple of hurd build tags
Patch by Svante Signell.

Updates PR go/93468

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/216959
2020-01-29 16:43:57 -08:00
Ian Lance Taylor
68f3759eff runtime: update netpoll_hurd.go for go1.14beta1 changes
Patch from Svante Signell.

Updates PR go/93468

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/216958
2020-01-29 16:40:19 -08:00
Jason Merrill
e3b6c052b6 c++: Drop alignas restriction for stack variables.
Since expand_stack_vars and such know how to deal with variables aligned
beyond MAX_SUPPORTED_STACK_ALIGNMENT, we shouldn't reject alignas of large
alignments.  And if we don't do that, there's no point in having
check_cxx_fundamental_alignment_constraints at all, since
check_user_alignment already enforces MAX_OFILE_ALIGNMENT.

	PR c++/89357
	* c-attribs.c (check_cxx_fundamental_alignment_constraints): Remove.
2020-01-29 19:38:32 -05:00
GCC Administrator
8be8e32faf Daily bump. 2020-01-30 00:16:31 +00:00
Jakub Jelinek
59da7f96ff testsuite: Fix up tree-ssa/pr92706-1.c on 32-bit targets.
The test uses __int128_t, so won't work on targets that don't support it.

2020-01-30  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/92706
	* gcc.dg/tree-ssa/pr92706-1.c: Require int128 effective target.
2020-01-30 01:01:55 +01:00
Jason Merrill
245e40af4f c++: Fix attributes with lambda and trailing return type.
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.
2020-01-29 17:49:59 -05:00
Tobias Burnus
165255c7a5 GCN – call assembler with -mattr=-code-object-v3 (PR93409)
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.
2020-01-29 23:45:55 +01:00
Marek Polacek
11ffae5847 c++: Add new test [PR88092]
This test got fixed by r10-1976-gdaaa6fcc70ffe66bd56f5819ad4ee78fecd54bb6
so let's add it to the testsuite.

	PR c++/88092
	* g++.dg/cpp2a/nontype-class31.C: New test.
2020-01-29 15:19:38 -05:00
Jeff Law
0de349f108 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.
2020-01-29 12:26:35 -07:00
Richard Sandiford
2812a28418 Revert g-465c7c89e92a6d6d582173e505cb16dcb9873034
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.
2020-01-29 19:15:29 +00:00
Marek Polacek
e3b60da8e0 c++: Fix template arguments comparison with class NTTP [PR91754]
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.
2020-01-29 14:14:40 -05:00
Marek Polacek
423284053e c++: Fix class NTTP with template arguments [PR92948]
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.
2020-01-29 14:07:58 -05:00
Jonathan Wakely
0a8f4febf7 libstdc++: Fix conformance issues in <stop_token> (PR92895)
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.
2020-01-29 15:52:08 +00:00
Frederik Harwath
989a5fb3aa Add acc_device_radeon to name_of_acc_device_t function
libgomp/
	* oacc-init.c (name_of_acc_device_t): Handle acc_device_radeon.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
2020-01-29 15:52:58 +01:00
Andre Vieira
bcf3fa7cf5 IRA: Revert 11b8091fb to fix PR 93221
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.
2020-01-29 14:25:55 +00:00
Jonathan Wakely
f214ffb336 libstdc++: Simplify constraints on std::compare_three_way
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().
2020-01-29 13:56:49 +00:00
Jonathan Wakely
83b0201035 libstdc++: Make std::compare_three_way check if <=> is valid (PR 93479)
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.
2020-01-29 13:36:15 +00:00
Jonathan Wakely
5cd2e126f5 libstdc++: Make tests for std::ranges access functions more robust
* 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.
2020-01-29 13:36:15 +00:00
Martin Jambor
6693911f06 SRA: Also propagate accesses from LHS to RHS [PR92706]
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.
2020-01-29 13:13:13 +01:00
Martin Jambor
636e80eea2 SRA: Total scalarization after access propagation [PR92706]
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.
2020-01-29 13:13:13 +01:00
Martin Jambor
5b9e89c922 SRA: Add verification of accesses
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.
2020-01-29 13:13:12 +01:00
Jan Hubicka
7c7107778f ipa: Fix removal of multi-target speculation.
* 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.
2020-01-29 12:43:10 +01:00
Frederik Harwath
87c3fcfa6b Adjust formatting of acc_get_property tests
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.
2020-01-29 11:55:06 +01:00
Frederik Harwath
2e5ea57959 Add OpenACC acc_get_property support for AMD GCN
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.
2020-01-29 11:54:56 +01:00
Richard Sandiford
f57ccb55cd testsuite: XFAIL gcc.dg/torture/pr93133.c for powerpc*-*-* [PR93393]
2020-01-29  Richard Sandiford  <richard.sandiford@arm.com>

gcc/testsuite/
	PR testsuite/93393
	* gcc.dg/torture/pr93133.c: XFAIL for powerpc*-*-*.
2020-01-29 10:35:42 +00:00
Jakub Jelinek
8d7c0bf876 openmp: c++: Consider typeinfo decls to be predetermined shared [PR91118]
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.
2020-01-29 09:41:42 +01:00
Jakub Jelinek
aa1b56967d openmp: Handle rest of EXEC_OACC_* in oacc_code_to_statement [PR93463]
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.
2020-01-29 09:39:16 +01:00
Jakub Jelinek
7892ff37f4 analyzer: fix build with gcc 4.4 (PR 93276)
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.
2020-01-29 09:36:19 +01:00
Richard Biener
148018bc3f tree-optimization/93428 - avoid load permutation vector clobbering
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.
2020-01-29 09:06:08 +01:00
Jan Hubicka
345ea96111 Fix bogus Changelog entry.
* ipa-prop.c (update_indirect_edges_after_inlining): Fix warning.
2020-01-29 08:15:52 +01:00
GCC Administrator
1e8900ea4c Daily bump. 2020-01-29 00:16:37 +00:00
Martin Sebor
4dd27b527c PR middle-end/93437 - bogus -Warray-bounds on protobuf generated code
gcc/testsuite/ChangeLog:

	PR middle-end/93437
	* g++.dg/warn/Wstringop-overflow-5.C: New test.
2020-01-28 14:48:52 -07:00
Jason Merrill
a4b4b1e3ac c++: Fix return deduction of lambda in discarded stmt.
A return statement in a discarded statement is not used for return type
deduction, but we still want to do deduction for a return statement in a
lambda in a discarded statement.

	PR c++/93442
	* parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
2020-01-28 16:45:22 -05:00
Jason Merrill
25d62480c8 c++: Fix guard variable and attribute weak.
My patch for PR 91476 worked for decls that are implicitly comdat/weak due
to C++ linkage rules, but broke variables explicitly marked weak.

	PR c++/93477
	PR c++/91476
	* decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
2020-01-28 16:45:22 -05:00
Jan Hubicka
99eb1a824a ipa: fix warning in ipa-prop.c
* ipa-prop.c (update_indirect_edges_after_inlining):
2020-01-28 22:44:36 +01:00
David Malcolm
5aebfb7176 analyzer: fix ICE when longjmp isn't marked 'noreturn' (PR 93316)
Comments 11-16 within PR analyzer/93316 discuss an ICE in some setjmp
tests seen on AIX and powerpc-darwin9.

The issue turned out to be an implicit assumption that longjmp is
marked "noreturn".  There are two places in engine.cc where the code
attempted to locate the longjmp GIMPLE_CALL by finding the final stmt
within its supernode, in one place casting it via "as_a <gcall *>",
in the other using it as the location_t of the
"rewinding from longjmp..." event.

When longjmp isn't marked noreturn, its basic block and hence supernode
can have additional stmts after the longjmp; in the setjmp-3.c case
this was a GIMPLE_RETURN, leading to a ICE when casting this to a
GIMPLE_CALL.

This patch fixes the two places in question to use the
  rewind_info_t::get_longjmp_call
member function introduced by 342e14ffa3,
fixing the ICE (and ensuring the correct location_t is used for events).

gcc/analyzer/ChangeLog:
	PR analyzer/93316
	* engine.cc (rewind_info_t::update_model): Get the longjmp call
	stmt via get_longjmp_call () rather than assuming it is the last
	stmt in the longjmp's supernode.
	(rewind_info_t::add_events_to_path): Get the location_t for the
	rewind_from_longjmp_event via get_longjmp_call () rather than from
	the supernode's get_end_location ().
2020-01-28 15:52:05 -05:00
Vladimir N. Makarov
5c8a1211b9 Fix for PR93272 - LRA: EH reg allocated to hold local variable
2020-01-28  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/93272
	* ira-lives.c (process_out_of_region_eh_regs): New function.
	(process_bb_node_lives): Call it.
2020-01-28 15:47:35 -05:00
Jan Hubicka
32387f76e8 diagnostics: make error message lowercase.
* coverage.c (read_counts_file): Make error message lowercase.
2020-01-28 21:34:43 +01:00
Jan Hubicka
f7a7839cc4 * profile-count.c (profile_quality_display_names): Fix ordering. 2020-01-28 21:31:26 +01:00
Jan Hubicka
40d240315a ipa: fix handling of multiple speculations (PR93318)
This patch started as work to resole Richard's comment on quadratic lookups
in resolve_speculation. While doing it I however noticed multiple problems
in the new speuclative call code which made the patch quite big. In
particular:
 1) Before applying speculation we consider only targets with at lest
    probability 1/2.
    If profile is sane at most two targets can have probability greater or
    equal to 1/2. So the new multi-target speculation code got enabled only
    in very special scenario when there ae precisely two target with precise
    probability 1/2 (which is tested by the single testcase).

    As a conseuqence the multiple target logic got minimal test coverage and
    this made us to miss several ICEs.
 2) Profile updating in profile merging, tree-inline and indirect call
    expansion was wrong which led to inconsistent profiles (as already seen
    on the testcase).
 3) Code responsible to turn speculative call to direct call was broken for
    anything with more than one target.
 4) There were multiple cases where call_site_hash went out of sync which
    eventually leads to an ICE..
 5) Some code expects that all speculative call targets forms a sequence in
    the callee linked list but there is no code to maintain that invariant
    nor a verifier.
Fixing this it became obvious that the current API of speculative_call_info is
not useful because it really builds on fact tht there are precisely three
components (direct call, ref and indirect call) in every speculative call
sequence.  I ended up replacing it with iterator API for direct call
(first_speculative_call_target, next_speculative_call_target) and accessors for
the other coponents updating comment in cgraph.h.

Finally I made the work with call site hash more effetive by updating edge
manipulation to keep them in sequence. So first one can be looked up from the
hash and then they can be iterated by callee.

There are other things that can be improved (for example the speculation should
start with most common target first), but I will try to keep that for next
stage1. This patch is mostly about getting rid of ICE and profile corruption
which is a regression from GCC 9.

Honza

gcc/ChangeLog:

2020-01-28  Jan Hubicka  <hubicka@ucw.cz>

	PR lto/93318
	* cgraph.c (cgraph_add_edge_to_call_site_hash): Update call site
	hash only when edge is first within the sequence.
	(cgraph_edge::set_call_stmt): Update handling of speculative calls.
	(symbol_table::create_edge): Do not set target_prob.
	(cgraph_edge::remove_caller): Watch for speculative calls when updating
	the call site hash.
	(cgraph_edge::make_speculative): Drop target_prob parameter.
	(cgraph_edge::speculative_call_info): Remove.
	(cgraph_edge::first_speculative_call_target): New member function.
	(update_call_stmt_hash_for_removing_direct_edge): New function.
	(cgraph_edge::resolve_speculation): Rewrite to new API.
	(cgraph_edge::speculative_call_for_target): New member function.
	(cgraph_edge::make_direct): Rewrite to new API; fix handling of
	multiple speculation targets.
	(cgraph_edge::redirect_call_stmt_to_callee): Likewise; fix updating
	of profile.
	(verify_speculative_call): Verify that targets form an interval.
	* cgraph.h (cgraph_edge::speculative_call_info): Remove.
	(cgraph_edge::first_speculative_call_target): New member function.
	(cgraph_edge::next_speculative_call_target): New member function.
	(cgraph_edge::speculative_call_target_ref): New member function.
	(cgraph_edge;:speculative_call_indirect_edge): New member funtion.
	(cgraph_edge): Remove target_prob.
	* cgraphclones.c (cgraph_node::set_call_stmt_including_clones):
	Fix handling of speculative calls.
	* ipa-devirt.c (ipa_devirt): Fix handling of speculative cals.
	* ipa-fnsummary.c (analyze_function_body): Likewise.
	* ipa-inline.c (speculation_useful_p): Use new speculative call API.
	* ipa-profile.c (dump_histogram): Fix formating.
	(ipa_profile_generate_summary): Watch for overflows.
	(ipa_profile): Do not require probablity to be 1/2; update to new API.
	* ipa-prop.c (ipa_make_edge_direct_to_target): Update to new API.
	(update_indirect_edges_after_inlining): Update to new API.
	* ipa-utils.c (ipa_merge_profiles): Rewrite merging of speculative call
	profiles.
	* profile-count.h: (profile_probability::adjusted): New.
	* tree-inline.c (copy_bb): Update to new speculative call API; fix
	updating of profile.
	* value-prof.c (gimple_ic_transform): Rename to ...
	(dump_ic_profile): ... this one; update dumping.
	(stream_in_histogram_value): Fix formating.
	(gimple_value_profile_transformations): Update.

gcc/testsuite/ChangeLog:

2020-01-28  Jan Hubicka  <hubicka@ucw.cz>

	* g++.dg/tree-prof/indir-call-prof.C: Update template.
	* gcc.dg/tree-prof/crossmodule-indircall-1.c: Add more targets.
	* gcc.dg/tree-prof/crossmodule-indircall-1a.c: Add more targets.
	* gcc.dg/tree-prof/indir-call-prof.c: Update template.
2020-01-28 21:30:14 +01:00