platform/upstream/gcc.git
4 years agoc++: Fix convert_like in template [PR91465, PR93870, PR92031, PR94068]
Marek Polacek [Fri, 28 Feb 2020 21:57:04 +0000 (16:57 -0500)]
c++: Fix convert_like in template [PR91465, PR93870, PR92031, PR94068]

The point of this patch is to fix the recurring problem of trees
generated by convert_like while processing a template that break when
substituting.  For instance, when convert_like creates a CALL_EXPR
while in a template, substituting such a call breaks in finish_call_expr
because we have two 'this' arguments.  Another problem is that we
can create &TARGET_EXPR<> and then fail when substituting because we're
taking the address of an rvalue.  I've analyzed some of the already fixed
PRs and also some of the currently open ones:

In c++/93870 we create EnumWrapper<E>::operator E(&operator~(E)).
In c++/87145 we create S::operator int (&{N}).
In c++/92031 we create &TARGET_EXPR <0>.

The gist of the problem is when convert_like_real creates a call for
a ck_user or wraps a TARGET_EXPR in & in a template.  So in these cases
use IMPLICIT_CONV_EXPR.  In a template we shouldn't need to perform the
actual conversion, we only need it's result type.
perform_direct_initialization_if_possible and
perform_implicit_conversion_flags can also create an IMPLICIT_CONV_EXPR.

Given the change above, build_converted_constant_expr can return an
IMPLICIT_CONV_EXPR so call fold_non_dependent_expr rather than
maybe_constant_value to deal with that.

To avoid the problem of instantiating something twice in a row I'm
removing a call to instantiate_non_dependent_expr_sfinae in
compute_array_index_type_loc.  And the build_converted_constant_expr
pattern can now be simplified.

2020-03-09  Marek Polacek  <polacek@redhat.com>

PR c++/92031 - bogus taking address of rvalue error.
PR c++/91465 - ICE with template codes in check_narrowing.
PR c++/93870 - wrong error when converting template non-type arg.
PR c++/94068 - ICE with template codes in check_narrowing.
* call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
in a template when not ck_identity and we're dealing with a class.
(convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
in a template if we need a temporary.
* decl.c (compute_array_index_type_loc): Remove
instantiate_non_dependent_expr_sfinae call.  Call
fold_non_dependent_expr instead of maybe_constant_value.
(build_explicit_specifier): Don't instantiate or create a sentinel
before converting the expression.
* except.c (build_noexcept_spec): Likewise.
* pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
build_converted_constant_expr returned.
* typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
of maybe_constant_value.

* g++.dg/cpp0x/conv-tmpl2.C: New test.
* g++.dg/cpp0x/conv-tmpl3.C: New test.
* g++.dg/cpp0x/conv-tmpl4.C: New test.
* g++.dg/cpp0x/conv-tmpl5.C: New test.
* g++.dg/cpp0x/conv-tmpl6.C: New test.
* g++.dg/cpp1z/conv-tmpl1.C: New test.

4 years agolibstdc++: Handle type-changing path concatenations (PR 94063)
Jonathan Wakely [Mon, 9 Mar 2020 23:22:57 +0000 (23:22 +0000)]
libstdc++: Handle type-changing path concatenations (PR 94063)

The filesystem::path::operator+= and filesystem::path::concat functions
operate directly on the native format of the path and so can cause a
path to mutate to a completely different type.

For Windows combining a filename "x" with a filename ":" produces a
root-name "x:". Similarly, a Cygwin root-directory "/" combined with a
root-directory and filename "/x" produces a root-name "//x".

Before this patch the implemenation didn't support those kind of
mutations, assuming that concatenating two filenames would always
produce a filename and concatenating with a root-dir would still have a
root-dir.

This patch fixes it simply by checking for the problem cases and
creating a new path by re-parsing the result of the string
concatenation. This is slightly suboptimal because the argument has
already been parsed if it's a path, but more importantly it doesn't
reuse any excess capacity that the path object being modified might
already have allocated. That can be fixed later though.

PR libstdc++/94063
* src/c++17/fs_path.cc (path::operator+=(const path&)): Add kluge to
handle concatenations that change the type of the first component.
(path::operator+=(basic_string_view<value_type>)): Likewise.
* testsuite/27_io/filesystem/path/concat/94063.cc: New test.

4 years agoc++: Readd [LR]ROTATE_EXPR support to constexpr.c [PR94067]
Jakub Jelinek [Mon, 9 Mar 2020 20:52:18 +0000 (21:52 +0100)]
c++: Readd [LR]ROTATE_EXPR support to constexpr.c [PR94067]

Since r10-6527-gaaa26bf496a646778ac861aed124d960b5bf549f fold_for_warn
will perform maybe_constant_value even on some cp_fold produced trees and
so can include rotate exprs which were removed last fall from constexpr.c

2020-03-09  Jakub Jelinek  <jakub@redhat.com>

PR c++/94067
Revert
2019-10-11  Paolo Carlini  <paolo.carlini@oracle.com>

* constexpr.c (cxx_eval_constant_expression): Do not handle
RROTATE_EXPR and LROTATE_EXPR.

* g++.dg/warn/Wconversion-pr94067.C: New test.

4 years agoRevert: One more patch for PR93564: Prefer smaller hard regno when we do not honor...
Vladimir N. Makarov [Mon, 9 Mar 2020 18:05:09 +0000 (14:05 -0400)]
Revert: One more patch for PR93564: Prefer smaller hard regno when we do not honor reg alloc order.

2020-03-09  Vladimir Makarov  <vmakarov@redhat.com>

Revert:

2020-02-28  Vladimir Makarov  <vmakarov@redhat.com>

PR rtl-optimization/93564
* ira-color.c (assign_hard_reg): Prefer smaller hard regno when we
do not honor reg alloc order.

4 years agoFix 'A' operand modifier: PR inline-asm/94095
Andrew Pinski [Mon, 9 Mar 2020 16:45:23 +0000 (09:45 -0700)]
Fix 'A' operand modifier: PR inline-asm/94095

The problem here is there was a typo in the documentation
for the 'A' modifier in the table, it was recorded as 'a'
in the table on the modifier column.

Committed as obvious.

2020-03-09  Andrew Pinski  <apinski@marvell.com>

PR inline-asm/94095
* doc/extend.texi (x86 Operand Modifiers): Fix column
for 'A' modifier.

4 years agors6000: Fix -mlong-double documentation
Carl Love [Thu, 5 Mar 2020 18:52:35 +0000 (12:52 -0600)]
rs6000: Fix -mlong-double documentation

gcc/ChangeLog

2020-03-09  Carl Love  <cel@us.ibm.com>

* config/rs6000/rs6000.opt: Update the description of the
command line option.

4 years agoconfigure - build libgomp by default for amdgcn
Tobias Burnus [Mon, 9 Mar 2020 16:00:39 +0000 (17:00 +0100)]
configure - build libgomp by default for amdgcn

        * configure.ac: Build libgomp by default for amdgcn.
        * configure: Regenerate.

4 years agoc++: Fix ABI issue with alignas on armv7hl [PR94050]
Marek Polacek [Thu, 5 Mar 2020 19:07:25 +0000 (14:07 -0500)]
c++: Fix ABI issue with alignas on armv7hl [PR94050]

The static_assert in the following test was failing on armv7hl because
we were disregarding the alignas specifier on Cell.  BaseShape's data
takes up 20B on 32-bit architectures, but we failed to round up its
TYPE_SIZE.  This happens since the
<https://gcc.gnu.org/ml/gcc-patches/2019-06/msg01189.html>
patch: here, in layout_class_type for TenuredCell, we see that the size
of TenuredCell and its CLASSTYPE_AS_BASE match, so we set

  CLASSTYPE_AS_BASE (t) = t;

While TYPE_USER_ALIGN of TenuredCell was 0, because finalize_type_size
called from finish_record_layout reset it, TYPE_USER_ALIGN of its
CLASSTYPE_AS_BASE still remained 1.  After we replace it, it's no longer
1.  Then we perform layout_empty_base_or_field for TenuredCell and since
TYPE_USER_ALIGN of its CLASSTYPE_AS_BASE is now 0, we don't do this
adjustment:

  if (CLASSTYPE_USER_ALIGN (type))
    {
      rli->record_align = MAX (rli->record_align, CLASSTYPE_ALIGN (type));
      if (warn_packed)
        rli->unpacked_align = MAX (rli->unpacked_align, CLASSTYPE_ALIGN (type));
      TYPE_USER_ALIGN (rli->t) = 1;
    }

where rli->t is BaseShape.  Then finalize_record_size won't use the
correct rli->record_align and therefore
  /* Round the size up to be a multiple of the required alignment.  */
  TYPE_SIZE (rli->t) = round_up (unpadded_size, TYPE_ALIGN (rli->t));
after this we end up with the wrong size.

Since the original fix was to avoid creating extra copies for LTO
purposes, I think the following fix should be acceptable.

PR c++/94050 - ABI issue with alignas on armv7hl.
* class.c (layout_class_type): Don't replace a class's
CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.

* g++.dg/abi/align3.C: New test.

4 years ago[testsuite][arm] Fix typo in fuse-caller-save.c
Christophe Lyon [Mon, 9 Mar 2020 13:15:10 +0000 (13:15 +0000)]
[testsuite][arm] Fix typo in fuse-caller-save.c

2020-03-09  Christophe Lyon  <christophe.lyon@linaro.org>

* gcc.target/arm/fuse-caller-save.c: Fix DejaGnu typo.

4 years agoRestore alignment in rs6000 target.
Martin Liska [Mon, 9 Mar 2020 13:13:04 +0000 (14:13 +0100)]
Restore alignment in rs6000 target.

PR target/93800
* config/rs6000/rs6000.c (rs6000_option_override_internal):
Remove set of str_align_loops and str_align_jumps as these
should be set in previous 2 conditions in the function.
PR target/93800
* gcc.target/powerpc/pr93800.c: New test.

4 years agoalias: Punt after walking too many VALUEs during a toplevel find_base_term call ...
Jakub Jelinek [Mon, 9 Mar 2020 12:38:23 +0000 (13:38 +0100)]
alias: Punt after walking too many VALUEs during a toplevel find_base_term call [PR94045]

As mentioned in the PR, on a largish C++ testcase the compile time
on i686-linux is about 16 minutes on a fast box, mostly spent in
find_base_term recursive calls dealing with very deep chains of preserved
VALUEs during var-tracking.

The following patch punts after we process many VALUEs (we already have code
to punt if we run into a VALUE cycle).

I've gathered statistics on when we punt this way (with BITS_PER_WORD, TU,
function columns piped through sort | uniq -c | sort -n):
     36 32 ../../gcc/asan.c _Z29initialize_sanitizer_builtinsv.part.0
    108 32 _first_test.go reflect_test.reflect_test..import
   1005 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr85180.c foo
   1005 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr87985.c foo
   1005 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr85180.c foo
   1005 64 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr87985.c foo
   2534 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/stack-check-9.c f3
   6346 32 ../../gcc/brig/brig-lang.c brig_define_builtins
   6398 32 ../../gcc/d/d-builtins.cc d_define_builtins
   8816 32 ../../gcc/c-family/c-common.c c_common_nodes_and_builtins
   8824 32 ../../gcc/lto/lto-lang.c lto_define_builtins
  41413 32 /home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr43058.c test
Additionally, for most of these (for the builtins definitions tested just
one) I've verified with a different alias.c change which didn't punt but
in the toplevel find_base_term recorded if visited_vals reached the limit
whether the return value was NULL_RTX or something different, and in all
these cases the end result was NULL_RTX, so at least in these cases it
should just shorten the time until it returns NULL.

2020-03-09  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/94045
* params.opt (-param=max-find-base-term-values=): New option.
* alias.c (find_base_term): Add cut-off for number of visited VALUEs
in a single toplevel find_base_term call.

4 years agoInsert default return_void at the end of coroutine body
Bin Cheng [Mon, 9 Mar 2020 10:54:57 +0000 (18:54 +0800)]
Insert default return_void at the end of coroutine body

Exception in coroutine is not correctly handled because the default
return_void call is now inserted before the finish suspend point,
rather than at the end of the original coroutine body.  This patch
fixes the issue by expanding code as following:
  co_await promise.initial_suspend();
  try {
    // The original coroutine body

    promise.return_void(); // The default return_void call.
  } catch (...) {
    promise.unhandled_exception();
  }
  final_suspend:
  // ...

gcc/cp/
    * coroutines.cc (build_actor_fn): Factor out code inserting the
    default return_void call to...
    (morph_fn_to_coro): ...here, also hoist local var declarations.

gcc/testsuite/
    * g++.dg/coroutines/torture/co-ret-15-default-return_void.C: New.

4 years ago[testsuite] Fix PR94019 to check vector char when vect_hw_misalign
Kewen Lin [Mon, 9 Mar 2020 02:55:11 +0000 (21:55 -0500)]
[testsuite] Fix PR94019 to check vector char when vect_hw_misalign

As PR94019 shows, without misaligned vector access support but with
realign load, the vectorized loop will end up with realign scheme.
It generates mask (control vector) with return type vector signed
char which breaks the not check.

gcc/testsuite/ChangeLog

2020-03-09  Kewen Lin  <linkw@gcc.gnu.org>

    PR testsuite/94019
    * gcc.dg/vect/vect-over-widen-17.c: Don't expect vector char if
    it's without misaligned vector access support.

4 years ago[testsuite] Fix PR94023 to guard case under vect_hw_misalign
Kewen Lin [Mon, 9 Mar 2020 02:34:13 +0000 (21:34 -0500)]
[testsuite] Fix PR94023 to guard case under vect_hw_misalign

As PR94023 shows, the expected SLP requires misaligned vector access
support.  This patch is to guard the check under the target condition
vect_hw_misalign to ensure that.

gcc/testsuite/ChangeLog

2020-03-09  Kewen Lin  <linkw@gcc.gnu.org>

    PR testsuite/94023
    * gcc.dg/vect/slp-perm-12.c: Expect loop vectorized messages only on
    vect_hw_misalign targets.

4 years agoDaily bump.
GCC Administrator [Mon, 9 Mar 2020 00:16:14 +0000 (00:16 +0000)]
Daily bump.

4 years agoPatch and ChangeLogs for PR93581
Paul Thomas [Sun, 8 Mar 2020 18:52:35 +0000 (18:52 +0000)]
Patch and ChangeLogs for PR93581

4 years agoc++: Fix missing SFINAE when binding a bit-field to a reference (PR 93729)
Patrick Palka [Tue, 3 Mar 2020 17:27:33 +0000 (12:27 -0500)]
c++: Fix missing SFINAE when binding a bit-field to a reference (PR 93729)

We are unconditionally emitting an error here, without first checking complain.

gcc/cp/ChangeLog:

PR c++/93729
* call.c (convert_like_real): Check complain before emitting an error
about binding a bit-field to a reference.

gcc/testsuite/ChangeLog:

PR c++/93729
* g++.dg/concepts/pr93729.C: New test.

4 years agoc++: Fix pretty printing of TYPENAME_TYPEs
Patrick Palka [Fri, 6 Mar 2020 18:19:13 +0000 (13:19 -0500)]
c++: Fix pretty printing of TYPENAME_TYPEs

I noticed that in some concepts diagnostic messages, we were printing typename
types incorrectly, e.g. printing remove_reference_t<T> as

  typename remove_reference<T>::remove_reference_t

instead of

  typename remove_reference<T>::type.

Fix this by printing the TYPENAME_TYPE_FULLNAME instead of the TYPE_NAME in
cxx_pretty_printer::simple_type_specifier, which is consistent with how
dump_typename in error.c does it.

gcc/cp/ChangeLog:

* cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
[TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
TYPE_NAME.

gcc/testsuite/ChangeLog:

* g++.dg/concepts/diagnostic4.C: New test.

4 years agogcc.target/i386/pr89229-3c.c: Include "pr89229-3a.c"
H.J. Lu [Sun, 8 Mar 2020 12:01:03 +0000 (05:01 -0700)]
gcc.target/i386/pr89229-3c.c: Include "pr89229-3a.c"

PR target/89229
PR target/89346
* gcc.target/i386/pr89229-3c.c: Include "pr89229-3a.c", instead
of "pr89229-5a.c".

4 years agoDaily bump.
GCC Administrator [Sat, 7 Mar 2020 00:16:29 +0000 (00:16 +0000)]
Daily bump.

4 years agoanalyzer: improvements to region_model::get_representative_tree
David Malcolm [Fri, 6 Mar 2020 15:13:59 +0000 (10:13 -0500)]
analyzer: improvements to region_model::get_representative_tree

This patch extends region_model::get_representative_tree so that dumps
are able to refer to string literals, which I've found useful in
investigating a state-bloat issue.

Doing so uncovered a bug in the handling of views I introduced in
r10-7024-ge516294a1acb28aaaad44cfd583cc6a80354044e where the code was
erroneously using TREE_TYPE on the view region's type, rather than just
using its type, which the patch also fixes.

gcc/analyzer/ChangeLog:
* analyzer.h (class array_region): New forward decl.
* program-state.cc (selftest::test_program_state_dumping_2): New.
(selftest::analyzer_program_state_cc_tests): Call it.
* region-model.cc (array_region::constant_from_key): New.
(region_model::get_representative_tree): Handle region_svalue by
generating an ADDR_EXPR.
(region_model::get_representative_path_var): In view handling,
remove erroneous TREE_TYPE when determining the type of the tree.
Handle array regions and STRING_CST.
(selftest::assert_dump_tree_eq): New.
(ASSERT_DUMP_TREE_EQ): New macro.
(selftest::test_get_representative_tree): New selftest.
(selftest::analyzer_region_model_cc_tests): Call it.
* region-model.h (region::dyn_cast_array_region): New vfunc.
(array_region::dyn_cast_array_region): New vfunc implementation.
(array_region::constant_from_key): New decl.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/malloc-4.c: Update expected output of leak to
reflect fix to region_model::get_representative_path_var, adding
the missing "*" from the cast.

4 years agoanalyzer: improvements to state dumping
David Malcolm [Thu, 5 Mar 2020 17:06:58 +0000 (12:06 -0500)]
analyzer: improvements to state dumping

This patch fixes a bug in which summarized state dumps involving a
non-NULL pointer to a region for which get_representative_path_var
returned NULL were erroneously dumped as "NULL".

It also extends sm-state dumps so that they show representative tree
values, where available.

Finally, it adds some selftest coverage for such dumps.  Doing so
requires replacing some %qE with a dump_quoted_tree, to avoid
C vs C++ differences between "make selftest-c" and "make selftest-c++".

gcc/analyzer/ChangeLog:
* analyzer.h (dump_quoted_tree): New decl.
* engine.cc (exploded_node::dump_dot): Pass region model to
sm_state_map::print.
* program-state.cc: Include diagnostic-core.h.
(sm_state_map::print): Add "model" param and use it to print
representative trees.  Only print origin information if non-null.
(sm_state_map::dump): Pass NULL for model to print call.
(program_state::print): Pass region model to sm_state_map::print.
(program_state::dump_to_pp): Use spaces rather than newlines when
summarizing.  Pass region_model to sm_state_map::print.
(ana::selftest::assert_dump_eq): New function.
(ASSERT_DUMP_EQ): New macro.
(ana::selftest::test_program_state_dumping): New function.
(ana::selftest::analyzer_program_state_cc_tests): Call it.
* program-state.h (program_state::print): Add model param.
* region-model.cc (dump_quoted_tree): New function.
(map_region::print_fields): Use dump_quoted_tree rather than
%qE to avoid lang-dependent output.
(map_region::dump_child_label): Likewise.
(region_model::dump_summary_of_map): For SK_REGION, when
get_representative_path_var fails, print the region id rather than
erroneously printing NULL.
* sm.cc (state_machine::get_state_by_name): New function.
* sm.h (state_machine::get_state_by_name): New decl.

4 years agoFix mangling ICE [PR94027]
Nathan Sidwell [Fri, 6 Mar 2020 18:51:26 +0000 (10:51 -0800)]
Fix mangling ICE [PR94027]

PR c++/94027
* mangle.c (find_substitution): Don't call same_type_p on template
args that cannot match.

Now same_type_p rejects argument packs, we need to be more careful
calling it with template argument vector contents.

The mangler needs to do some comparisons to find the special
substitutions.  While that code looks a little ugly, this seems the
smallest fix.

4 years ago[AArch64] Use intrinsics for widening multiplies (PR91598)
Wilco Dijkstra [Fri, 6 Mar 2020 18:29:02 +0000 (18:29 +0000)]
[AArch64] Use intrinsics for widening multiplies (PR91598)

Inline assembler instructions don't have latency info and the scheduler does
not attempt to schedule them at all - it does not even honor latencies of
asm source operands.  As a result, SIMD intrinsics which are implemented using
inline assembler perform very poorly, particularly on in-order cores.
Add new patterns and intrinsics for widening multiplies, which results in a
63% speedup for the example in the PR, thus fixing the reported regression.

    gcc/
PR target/91598
* config/aarch64/aarch64-builtins.c (TYPES_TERNOPU_LANE): Add define.
* config/aarch64/aarch64-simd.md
(aarch64_vec_<su>mult_lane<Qlane>): Add new insn for widening lane mul.
(aarch64_vec_<su>mlal_lane<Qlane>): Likewise.
* config/aarch64/aarch64-simd-builtins.def: Add intrinsics.
* config/aarch64/arm_neon.h:
(vmlal_lane_s16): Expand using intrinsics rather than inline asm.
(vmlal_lane_u16): Likewise.
(vmlal_lane_s32): Likewise.
(vmlal_lane_u32): Likewise.
(vmlal_laneq_s16): Likewise.
(vmlal_laneq_u16): Likewise.
(vmlal_laneq_s32): Likewise.
(vmlal_laneq_u32): Likewise.
(vmull_lane_s16): Likewise.
(vmull_lane_u16): Likewise.
(vmull_lane_s32): Likewise.
(vmull_lane_u32): Likewise.
(vmull_laneq_s16): Likewise.
(vmull_laneq_u16): Likewise.
(vmull_laneq_s32): Likewise.
(vmull_laneq_u32): Likewise.
* config/aarch64/iterators.md (Vcondtype): New iterator for lane mul.
(Qlane): Likewise.

4 years ago[AArch64] Fix lane specifier syntax
Wilco Dijkstra [Fri, 6 Mar 2020 18:19:46 +0000 (18:19 +0000)]
[AArch64] Fix lane specifier syntax

The syntax for lane specifiers uses a vector element rather than a vector:

fmls    v0.2s, v1.2s, v1.s[1]  // rather than v1.2s[1]

Fix all the lane specifiers to use Vetype which uses the correct element type.

    gcc/
* aarch64/aarch64-simd.md (aarch64_mla_elt<mode>): Correct lane syntax.
(aarch64_mla_elt_<vswap_width_name><mode>): Likewise.
(aarch64_mls_elt<mode>): Likewise.
(aarch64_mls_elt_<vswap_width_name><mode>): Likewise.
(aarch64_fma4_elt<mode>): Likewise.
(aarch64_fma4_elt_<vswap_width_name><mode>): Likewise.
(aarch64_fma4_elt_to_64v2df): Likewise.
(aarch64_fnma4_elt<mode>): Likewise.
(aarch64_fnma4_elt_<vswap_width_name><mode>): Likewise.
(aarch64_fnma4_elt_to_64v2df): Likewise.

    testsuite/
* gcc.target/aarch64/fmla_intrinsic_1.c: Check for correct lane syntax.
* gcc.target/aarch64/fmls_intrinsic_1.c: Likewise.
* gcc.target/aarch64/mla_intrinsic_1.c: Likewise.
* gcc.target/aarch64/mls_intrinsic_1.c: Likewise.

4 years ago[AArch64][SVE] Add missing movprfx attribute to some ternary arithmetic patterns
Kyrylo Tkachov [Fri, 6 Mar 2020 16:21:33 +0000 (16:21 +0000)]
[AArch64][SVE] Add missing movprfx attribute to some ternary arithmetic patterns

The two affected SVE2 patterns in this patch output a movprfx'ed instruction in their second alternative
but don't set the "movprfx" attribute, which will result in the wrong instruction length being assumed by the midend.

This patch fixes that in the same way as the other SVE patterns in the backend.

Bootstrapped and tested on aarch64-none-linux-gnu.

2020-03-06  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

* config/aarch64/aarch64-sve2.md (@aarch64_sve_<sve_int_op><mode>:
Specify movprfx attribute.
(@aarch64_sve_<sve_int_op>_lane_<mode>): Likewise.

4 years agors6000: Correct logic to disable NO_SUM_IN_TOC and NO_FP_IN_TOC [PR94065]
David Edelsohn [Fri, 6 Mar 2020 01:41:08 +0000 (20:41 -0500)]
rs6000: Correct logic to disable NO_SUM_IN_TOC and NO_FP_IN_TOC [PR94065]

aix61.h, aix71.h and aix72.h intends to prevent SUM_IN_TOC and FP_IN_TOC
when cmodel=large.  This patch defines the variables associated with the
target options to 1 to _enable_ NO_SUM_IN_TOC and enable NO_FP_IN_TOC.

Bootstrapped on powerpc-ibm-aix7.2.0.0

2020-03-06  David Edelsohn  <dje.gcc@gmail.com>
PR target/94065
* config/rs6000/aix61.h (TARGET_NO_SUM_IN_TOC): Set to 1 for
cmodel=large.
(TARGET_NO_FP_IN_TOC): Same.
* config/rs6000/aix71.h: Same.
* config/rs6000/aix72.h: Same.

4 years agoAvoid putting a REG_NOTE on anything other than an INSN in haifa-sched.c
Andrew Pinski [Fri, 6 Mar 2020 15:34:01 +0000 (08:34 -0700)]
Avoid putting a REG_NOTE on anything other than an INSN in haifa-sched.c

PR rtl-optimization/93996
* haifa-sched.c (remove_notes): Be more careful when adding
REG_SAVE_NOTE.

4 years agoarc: Update tumaddsidi4 test.
Claudiu Zissulescu [Fri, 6 Mar 2020 14:36:23 +0000 (16:36 +0200)]
arc: Update tumaddsidi4 test.

The test is using -O1 and, the macu instruction is generated by the
combiner and not in the expand step. My previous "arc: Improve code
gen for 64bit add/sub operations." is actually splitting the 64-bit
add in the expand, leading to the impossibility to match the multiply
and accumulate on 64 bit datum by the combiner, hence, the error. This
patch is stepping up the optimization level which will generate the
macu instruction at the expand time.

xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

* gcc.target/arc/tumaddsidi4.c: Step-up optimization level.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
4 years agolibstdc++: Add missing friend declaration to join_view::_Sentinel
Patrick Palka [Thu, 5 Mar 2020 16:19:17 +0000 (11:19 -0500)]
libstdc++: Add missing friend declaration to join_view::_Sentinel

The converting constructor of join_view::_Sentinel<true> needs to be able to
access the private members of join_view::_Sentinel<false>.

libstdc++-v3/ChangeLog:

* include/std/ranges (join_view::_Sentinel<_Const>): Befriend
join_view::_Sentinel<!_Const>.
* testsuite/std/ranges/adaptors/join.cc: Augment test.

4 years agolibstdc++: Give ranges::empty() a concrete return type (PR 93978)
Patrick Palka [Thu, 5 Mar 2020 15:04:06 +0000 (10:04 -0500)]
libstdc++: Give ranges::empty() a concrete return type (PR 93978)

This works around PR 93978 by avoiding having to instantiate the body of
ranges::empty() when checking the constraints of view_interface::operator
bool().  When ranges::empty() has an auto return type, then we must instantiate
its body in order to determine whether the requires expression {
ranges::empty(_M_derived()); } is well-formed.  But this means instantiating
view_interface::empty() and hence view_interface::_M_derived(), all before we've
yet deduced the return type of join_view::end().  (The reason
view_interface::operator bool() is needed in join_view::end() in the first place
is because in this function we perform direct initialization of
join_view::_Sentinel from a join_view, and so we try to find a conversion
sequence from the latter to the former that goes through this conversion
operator.)

Giving ranges::empty() a concrete return type of bool should be safe according
to [range.prim.empty]/4 which says "whenever ranges::empty(E) is a valid
expression, it has type bool."

This fixes the test case in PR 93978 when compiling without -Wall, but with -Wall
the test case still fails due to the issue described in PR c++/94038, I think.
I still don't quite understand why the test case doesn't fail without -O.

libstdc++-v3/ChangeLog:

PR libstdc++/93978
* include/bits/range_access.h (__cust_access::_Empty::operator()):
Declare return type to be bool instead of auto.
* testsuite/std/ranges/adaptors/93978.cc: New test.

4 years agolibstdc++: Fix PR number in ChangeLog (PR 94069)
Jonathan Wakely [Fri, 6 Mar 2020 12:24:37 +0000 (12:24 +0000)]
libstdc++: Fix PR number in ChangeLog (PR 94069)

4 years agolibstdc++: Fix call to __glibcxx_rwlock_init (PR 93244)
Jonathan Wakely [Fri, 6 Mar 2020 12:03:17 +0000 (12:03 +0000)]
libstdc++: Fix call to __glibcxx_rwlock_init (PR 93244)

When the target doesn't define PTHREAD_RWLOCK_INITIALIZER we use a
wrapper around pthread_wrlock_init, but the wrapper only takes one
argument and we try to call it with two.

This went unnnoticed on most targets because they do define the
PTHREAD_RWLOCK_INITIALIZER macro, but it causes a bootstrap failure on
darwin8.

PR libstdc++/93244
* include/std/shared_mutex [!PTHREAD_RWLOCK_INITIALIZER]
(__shared_mutex_pthread::__shared_mutex_pthread()): Remove incorrect
second argument to __glibcxx_rwlock_init.
* testsuite/30_threads/shared_timed_mutex/94069.cc: New test.

4 years agoAdd missing ChangeLog entries
Andreas Krebbel [Fri, 6 Mar 2020 11:44:27 +0000 (12:44 +0100)]
Add missing ChangeLog entries

4 years agolibstdc++: Fix failing filesystem::path tests (PR 93244)
Jonathan Wakely [Fri, 6 Mar 2020 11:27:34 +0000 (11:27 +0000)]
libstdc++: Fix failing filesystem::path tests (PR 93244)

The checks for PR 93244 don't actually pass on Windows (which is the
target where the bug is present) because of a different bug, PR 94063.

This adjusts the tests to not be affected by 94063 so that they verify
that 93244 was fixed.

PR libstdc++/93244
* testsuite/27_io/filesystem/path/generic/generic_string.cc: Adjust
test to not fail due to PR 94063.
* testsuite/27_io/filesystem/path/generic/utf.cc: Likewise.
* testsuite/27_io/filesystem/path/generic/wchar_t.cc: Likewise.

4 years agolibstdc++: Deal with ENOSYS == ENOTSUP
Andreas Krebbel [Fri, 6 Mar 2020 08:37:55 +0000 (09:37 +0100)]
libstdc++: Deal with ENOSYS == ENOTSUP

zTPF uses the same numeric value for ENOSYS and ENOTSUP.

libstdc++-v3/ChangeLog:

2020-03-06  Andreas Krebbel  <krebbel@linux.ibm.com>

* src/c++11/system_error.cc: Omit the ENOTSUP case statement if it
would match ENOSYS.

4 years agoACLE intrinsics: BFloat16 load intrinsics for AArch32
Delia Burduv [Fri, 6 Mar 2020 10:38:20 +0000 (10:38 +0000)]
ACLE intrinsics: BFloat16 load intrinsics for AArch32

2020-03-06  Delia Burduv  <delia.burduv@arm.com>

* config/arm/arm_neon.h (vld2_bf16): New.
(vld2q_bf16): New.
(vld3_bf16): New.
(vld3q_bf16): New.
(vld4_bf16): New.
(vld4q_bf16): New.
(vld2_dup_bf16): New.
(vld2q_dup_bf16): New.
(vld3_dup_bf16): New.
(vld3q_dup_bf16): New.
(vld4_dup_bf16): New.
(vld4q_dup_bf16): New.
* config/arm/arm_neon_builtins.def
(vld2): Changed to VAR13 and added v4bf, v8bf
(vld2_dup): Changed to VAR8 and added v4bf, v8bf
(vld3): Changed to VAR13 and added v4bf, v8bf
(vld3_dup): Changed to VAR8 and added v4bf, v8bf
(vld4): Changed to VAR13 and added v4bf, v8bf
(vld4_dup): Changed to VAR8 and added v4bf, v8bf
* config/arm/iterators.md (VDXBF2): New iterator.
*config/arm/neon.md (neon_vld2): Use new iterators.
(neon_vld2_dup<mode): Use new iterators.
(neon_vld3<mode>): Likewise.
(neon_vld3qa<mode>): Likewise.
(neon_vld3qb<mode>): Likewise.
(neon_vld3_dup<mode>): Likewise.
(neon_vld4<mode>): Likewise.
(neon_vld4qa<mode>): Likewise.
(neon_vld4qb<mode>): Likewise.
(neon_vld4_dup<mode>): Likewise.
(neon_vld2_dupv8bf): New.
(neon_vld3_dupv8bf): Likewise.
(neon_vld4_dupv8bf): Likewise.

* gcc.target/arm/simd/bf16_vldn_1.c: New test.

4 years agoACLE intrinsics: BFloat16 store (vst<n>{q}_bf16) intrinsics for AArch32
Delia Burduv [Fri, 6 Mar 2020 10:32:20 +0000 (10:32 +0000)]
ACLE intrinsics: BFloat16 store (vst<n>{q}_bf16) intrinsics for AArch32

2020-03-06  Delia Burduv  <delia.burduv@arm.com>

* config/arm/arm_neon.h (bfloat16x4x2_t): New typedef.
(bfloat16x8x2_t): New typedef.
(bfloat16x4x3_t): New typedef.
(bfloat16x8x3_t): New typedef.
(bfloat16x4x4_t): New typedef.
(bfloat16x8x4_t): New typedef.
(vst2_bf16): New.
(vst2q_bf16): New.
(vst3_bf16): New.
(vst3q_bf16): New.
(vst4_bf16): New.
(vst4q_bf16): New.
* config/arm/arm-builtins.c (v2bf_UP): Define.
(VAR13): New.
(arm_init_simd_builtin_types): Init Bfloat16x2_t eltype.
* config/arm/arm-modes.def (V2BF): New mode.
* config/arm/arm-simd-builtin-types.def
(Bfloat16x2_t): New entry.
* config/arm/arm_neon_builtins.def
(vst2): Changed to VAR13 and added v4bf, v8bf
(vst3): Changed to VAR13 and added v4bf, v8bf
(vst4): Changed to VAR13 and added v4bf, v8bf
* config/arm/iterators.md (VDXBF): New iterator.
(VQ2BF): New iterator.
*config/arm/neon.md (neon_vst2<mode>): Used new iterators.
(neon_vst2<mode>): Used new iterators.
(neon_vst3<mode>): Used new iterators.
(neon_vst3<mode>): Used new iterators.
(neon_vst3qa<mode>): Used new iterators.
(neon_vst3qb<mode>): Used new iterators.
(neon_vst4<mode>): Used new iterators.
(neon_vst4<mode>): Used new iterators.
(neon_vst4qa<mode>): Used new iterators.
(neon_vst4qb<mode>): Used new iterators.

* gcc.target/arm/simd/bf16_vstn_1.c: New test.

4 years agoRISC-V: Fix testsuite regression due to recent IRA changes.
Kito Cheng [Fri, 6 Mar 2020 08:30:48 +0000 (16:30 +0800)]
RISC-V: Fix testsuite regression due to recent IRA changes.

4 years agoaarch64: ACLE intrinsics for BFCVTN, BFCVTN2 and BFCVT
Delia Burduv [Wed, 4 Mar 2020 19:25:09 +0000 (19:25 +0000)]
aarch64: ACLE intrinsics for BFCVTN, BFCVTN2 and BFCVT

This patch adds the Armv8.6-a ACLE intrinsics for bfcvtn, bfcvtn2 and
bfcvt as part of the BFloat16 extension.
(https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics)
The intrinsics are declared in arm_bf16.h and arm_neon.h and the RTL
patterns are defined in aarch64-simd.md.

2020-03-06  Delia Burduv  <delia.burduv@arm.com>

gcc/
* config/aarch64/aarch64-simd-builtins.def
(bfcvtn): New built-in function.
(bfcvtn_q): New built-in function.
(bfcvtn2): New built-in function.
(bfcvt): New built-in function.
* config/aarch64/aarch64-simd.md
(aarch64_bfcvtn<q><mode>): New pattern.
(aarch64_bfcvtn2v8bf): New pattern.
(aarch64_bfcvtbf): New pattern.
* config/aarch64/arm_bf16.h (float32_t): New typedef.
(vcvth_bf16_f32): New intrinsic.
* config/aarch64/arm_bf16.h (vcvt_bf16_f32): New intrinsic.
(vcvtq_low_bf16_f32): New intrinsic.
(vcvtq_high_bf16_f32): New intrinsic.
* config/aarch64/iterators.md (V4SF_TO_BF): New mode iterator.
(UNSPEC_BFCVTN): New UNSPEC.
(UNSPEC_BFCVTN2): New UNSPEC.
(UNSPEC_BFCVT): New UNSPEC.
* config/arm/types.md (bf_cvt): New type.

gcc/testsuite/
* gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c: New test.
* gcc.target/aarch64/advsimd-intrinsics/bfcvt-nobf16.c: New test.
* gcc.target/aarch64/advsimd-intrinsics/bfcvt-nosimd.c: New test.
* gcc.target/aarch64/advsimd-intrinsics/bfcvtnq2-untied.c: New test.

4 years agoFix error format string.
Andreas Krebbel [Fri, 6 Mar 2020 08:51:34 +0000 (09:51 +0100)]
Fix error format string.

gcc/ChangeLog:

2020-03-06  Andreas Krebbel  <krebbel@linux.ibm.com>

* config/s390/s390.md ("tabort"): Get rid of two consecutive
blanks in format string.

4 years agore PR tree-optimization/90883 (Generated code is worse if returned struct is unnamed)
Kito Cheng [Tue, 3 Mar 2020 06:16:42 +0000 (14:16 +0800)]
re PR tree-optimization/90883 (Generated code is worse if returned struct is unnamed)

After add --param max-inline-insns-size=1 all target will remove the
redundant store at dse1, except some targets like AArch64 and MIPS will
expand the struct initialization into loop due to CLEAR_RATIO.

Tested on cross compiler of riscv32, riscv64, x86, x86_64, mips, mips64,
aarch64, nds32 and arm.

gcc/testsuite/ChangeLog

PR tree-optimization/90883
* g++.dg/tree-ssa/pr90883.c: Add --param max-inline-insns-size=1.
Add aarch64-*-* mips*-*-* to XFAIL.

4 years agoi386: Properly encode vector registers in vector move
H.J. Lu [Fri, 6 Mar 2020 00:45:05 +0000 (16:45 -0800)]
i386: Properly encode vector registers in vector move

On x86, when AVX and AVX512 are enabled, vector move instructions can
be encoded with either 2-byte/3-byte VEX (AVX) or 4-byte EVEX (AVX512):

   0: c5 f9 6f d1           vmovdqa %xmm1,%xmm2
   4: 62 f1 fd 08 6f d1     vmovdqa64 %xmm1,%xmm2

We prefer VEX encoding over EVEX since VEX is shorter.  Also AVX512F
only supports 512-bit vector moves.  AVX512F + AVX512VL supports 128-bit
and 256-bit vector moves.  xmm16-xmm31 and ymm16-ymm31 are disallowed in
128-bit and 256-bit modes when AVX512VL is disabled.  Mode attributes on
x86 vector move patterns indicate target preferences of vector move
encoding.  For scalar register to register move, we can use 512-bit
vector move instructions to move 32-bit/64-bit scalar if AVX512VL isn't
available.  With AVX512F and AVX512VL, we should use VEX encoding for
128-bit/256-bit vector moves if upper 16 vector registers aren't used.
This patch adds a function, ix86_output_ssemov, to generate vector moves:

1. If zmm registers are used, use EVEX encoding.
2. If xmm16-xmm31/ymm16-ymm31 registers aren't used, SSE or VEX encoding
will be generated.
3. If xmm16-xmm31/ymm16-ymm31 registers are used:
   a. With AVX512VL, AVX512VL vector moves will be generated.
   b. Without AVX512VL, xmm16-xmm31/ymm16-ymm31 register to register
      move will be done with zmm register move.

There is no need to set mode attribute to XImode explicitly since
ix86_output_ssemov can properly encode xmm16-xmm31/ymm16-ymm31 registers
with and without AVX512VL.

Tested on AVX2 and AVX512 with and without --with-arch=native.

gcc/

PR target/89229
PR target/89346
* config/i386/i386-protos.h (ix86_output_ssemov): New prototype.
* config/i386/i386.c (ix86_get_ssemov): New function.
(ix86_output_ssemov): Likewise.
* config/i386/sse.md (VMOVE:mov<mode>_internal): Call
ix86_output_ssemov for TYPE_SSEMOV.  Remove TARGET_AVX512VL
check.
(*movxi_internal_avx512f): Call ix86_output_ssemov for TYPE_SSEMOV.
(*movoi_internal_avx): Call ix86_output_ssemov for TYPE_SSEMOV.
Remove ext_sse_reg_operand and TARGET_AVX512VL check.
(*movti_internal): Likewise.
(*movtf_internal): Call ix86_output_ssemov for TYPE_SSEMOV.

gcc/testsuite/

PR target/89229
PR target/89346
* gcc.target/i386/avx512vl-vmovdqa64-1.c: Updated.
* gcc.target/i386/pr89229-2a.c: New test.
* gcc.target/i386/pr89229-2b.c: Likewise.
* gcc.target/i386/pr89229-2c.c: Likewise.
* gcc.target/i386/pr89229-3a.c: Likewise.
* gcc.target/i386/pr89229-3b.c: Likewise.
* gcc.target/i386/pr89229-3c.c: Likewise.
* gcc.target/i386/pr89346.c: Likewise.

4 years agoDaily bump.
GCC Administrator [Fri, 6 Mar 2020 00:16:34 +0000 (00:16 +0000)]
Daily bump.

4 years ago[PATCH][testuite] Fix pr80481.C after epilogue vectorization
Andre Vieira [Thu, 5 Mar 2020 23:59:53 +0000 (16:59 -0700)]
[PATCH][testuite] Fix pr80481.C after epilogue vectorization

        * g++.dg/pr80481.C: Disable epilogue vectorization.

4 years agoc: ignore initializers for elements of variable-size types [PR93577]
Joseph Myers [Thu, 5 Mar 2020 23:48:06 +0000 (23:48 +0000)]
c: ignore initializers for elements of variable-size types [PR93577]

Bug 93577, apparently a regression (although it isn't very clear to me
exactly when it was introduced; tests I made with various past
compilers produced inconclusive results, including e.g. ICEs appearing
with 64-bit-host compilers for some versions but not 32-bit-host
compilers for the same versions) is an C front-end tree-checking ICE
processing initializers for structs using the VLA-in-struct extension.
There is an error for such initializers, but other processing that
still takes place for them results in the ICE.

This patch ensures that processing of initializers for variable-size
types stops earlier to avoid the code that results in the ICE (and
ensures it stops earlier for error_mark_node to avoid ICEs in the
check for variable-size types), adjusts the conditions for the "empty
scalar initializer" diagnostic to avoid consequent excess errors in
the case of a bad type name, and adds tests for a few variations on
what such initializers might look like, as well as tests for cases
identified from ICEs seen with an earlier version of this patch.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

PR c/93577
gcc/c:
* c-typeck.c (pop_init_level): Do not diagnose initializers as
empty when initialized type is error_mark_node.
(set_designator, process_init_element): Ignore initializers for
elements of a variable-size type or of error_mark_node.

gcc/testsuite:
* gcc.dg/pr93577-1.c, gcc.dg/pr93577-2.c, gcc.dg/pr93577-3.c,
gcc.dg/pr93577-4.c, gcc.dg/pr93577-5.c, gcc.dg/pr93577-6.c: New
tests.
* gcc.dg/vla-init-1.c: Expect fewer errors about VLA initializer.

4 years agoCommit correct version of gimple.c file
Jeff Law [Thu, 5 Mar 2020 21:16:02 +0000 (14:16 -0700)]
Commit correct version of gimple.c file

4 years agoFix location maybe_diag_overlap passes to diagnostics so that diagnostic pragmas...
Jeff Law [Thu, 5 Mar 2020 21:01:30 +0000 (14:01 -0700)]
Fix location maybe_diag_overlap passes to diagnostics so that diagnostic pragmas work better.

PR tree-optimization/91890
* gimple-ssa-warn-restrict.c (maybe_diag_overlap): Remove LOC argument.
Use gimple_or_expr_nonartificial_location.
(check_bounds_overlap): Drop LOC argument to maybe_diag_access_bounds.
Use gimple_or_expr_nonartificial_location.
* gimple.c (gimple_or_expr_nonartificial_location): New function.
* gimple.h (gimple_or_expr_nonartificial_location): Declare it.
* tree-ssa-strlen.c (maybe_warn_overflow): Use
gimple_or_expr_nonartificial_location.
(maybe_diag_stxncpy_trunc, handle_builtin_stxncpy_strncat): Likewise.
(maybe_warn_pointless_strcmp): Likewise.

* gcc.dg/pragma-diag-8.c: New test.

4 years agoi386: Fix some -O0 avx2intrin.h and xopintrin.h intrinsic macros [PR94046]
Jakub Jelinek [Thu, 5 Mar 2020 18:44:42 +0000 (19:44 +0100)]
i386: Fix some -O0 avx2intrin.h and xopintrin.h intrinsic macros [PR94046]

As the testcases show, the macros we have for -O0 for intrinsics that require
constant argument(s) should first cast the argument to the type the -O1+
inline uses and afterwards to whatever type e.g. a builtin needs.
The PR reported one which violated this, and I've grepped for all double-casts
and grepped out from that meaningful casts where the __m{128,256,512}{,d,i}
first cast is cast to same sized __v* type and has the same kind of element
type (float, double, integral).  These 7 macros were using different casts,
and I've double checked them against the inline function types.

2020-03-05  Jakub Jelinek  <jakub@redhat.com>

PR target/94046
* config/i386/avx2intrin.h (_mm_mask_i32gather_ps): Fix first cast of
SRC and MASK arguments to __m128 from __m128d.
(_mm256_mask_i32gather_ps): Fix first cast of MASK argument to __m256
from __m256d.
(_mm_mask_i64gather_ps): Fix first cast of MASK argument to __m128
from __m128d.
* config/i386/xopintrin.h (_mm_permute2_pd): Fix first cast of C
argument to __m128i from __m128d.
(_mm256_permute2_pd): Fix first cast of C argument to __m256i from
__m256d.
(_mm_permute2_ps): Fix first cast of C argument to __m128i from __m128.
(_mm256_permute2_ps): Fix first cast of C argument to __m256i from
__m256.

* g++.target/i386/pr94046-1.C: New test.
* g++.target/i386/pr94046-2.C: New test.

4 years ago[AArch32] ACLE intrinsics bfloat16 vmmla and vfma<b/t> for AArch32 AdvSIMD
Kyrylo Tkachov [Thu, 5 Mar 2020 17:45:58 +0000 (17:45 +0000)]
[AArch32] ACLE intrinsics bfloat16 vmmla and vfma<b/t> for AArch32 AdvSIMD

Commit rest of the 43031fbdda7d4edbd607365a4f3bbec069fe3983 content.
I screwed up on the "git add" commands there.

4 years agolibstdc++: Fix some warnings in filesystem tests
Jonathan Wakely [Thu, 5 Mar 2020 17:21:24 +0000 (17:21 +0000)]
libstdc++: Fix some warnings in filesystem tests

There's a -Wunused-but-set-variable warning in operations/all.cc which
can be fixed with [[maybe_unused]].

The statements in operations/copy.cc give -Wunused-value warnings. I
think I meant to use |= rather than !=.

And operations/file_size.cc gets -Wsign-compare warnings.

* testsuite/27_io/filesystem/operations/all.cc: Mark unused variable.
* testsuite/27_io/filesystem/operations/copy.cc: Fix typo.
* testsuite/experimental/filesystem/operations/copy.cc: Likewise.
* testsuite/27_io/filesystem/operations/file_size.cc: Use correct type
for return value, and in comparison.
* testsuite/experimental/filesystem/operations/file_size.cc: Likewise.

4 years agotestsuite: Compile asan_test.C with -Wno-alloc-size-larger-than
Uros Bizjak [Thu, 5 Mar 2020 16:51:11 +0000 (17:51 +0100)]
testsuite: Compile asan_test.C with -Wno-alloc-size-larger-than

asan_test.cc tries to allocate 0xf0000000 bytes for 32bit targets in
a disabled DISABLED_DemoOOM test.  Since the testcase is compiled with
-Werror, the compilation fails with:

error: argument 1 value '4026531840' exceeds maximum object size 2147483647

Compile with -Wno-alloc-size-larger-than to avoid compilation failure.

* g++.dg/asan/asan_test.C (dg-options): Add
-Wno-alloc-size-larger-than.

4 years agolibstdc++: allow string_view insertion to work with <iosfwd> (PR 94051)
Jonathan Wakely [Thu, 5 Mar 2020 16:46:28 +0000 (16:46 +0000)]
libstdc++: allow string_view insertion to work with <iosfwd> (PR 94051)

I don't think this is actually required to compile, because using
operator<< without a definition of the ostream doesn't seem valid to me.
But it's easy to make it work.

PR libstdc++/94051
* include/std/string_view: Include <bits/ostream_insert.h>.
* testsuite/21_strings/basic_string_view/inserters/94051.cc: New test.

4 years agotestsuite: Add testcase for already fixed PR [PR90311]
Jakub Jelinek [Thu, 5 Mar 2020 15:59:58 +0000 (16:59 +0100)]
testsuite: Add testcase for already fixed PR [PR90311]

2020-03-05  Jakub Jelinek  <jakub@redhat.com>

PR target/90311
* gcc.c-torture/execute/pr90311.c: New test.

4 years agoFuture proofing this test.
Jeff Law [Thu, 5 Mar 2020 15:46:20 +0000 (08:46 -0700)]
Future proofing this test.

* gcc.target/arm/fuse-caller-save.c: Generalize expected output.

4 years agoc++: Add test for PR91607.
Jason Merrill [Thu, 5 Mar 2020 15:11:36 +0000 (10:11 -0500)]
c++: Add test for PR91607.

     PR c++/91607
     * g++.dg/cpp0x/constexpr-const3.C: New.

4 years agoFortran: ICE in gfc_code2string PR93792
Steven G. Kargl [Thu, 5 Mar 2020 11:41:14 +0000 (11:41 +0000)]
Fortran: ICE in gfc_code2string PR93792

A BOZ constant can not appear as a component inialiser for a derived
type.

gcc/fortran/ChangeLog:

PR93792
* decl.c (variable_decl): If param and initializer check
for BOZ, if found,  output an error, set m to MATCH_ERROR
and goto cleanup.

gcc/testsuite/ChangeLog:

PR93792
* gfortran.dg/pr93792.f90:  New test.

4 years ago[AArch32] ACLE intrinsics bfloat16 vmmla and vfma<b/t> for AArch32 AdvSIMD
Delia Burduv [Thu, 5 Mar 2020 11:18:04 +0000 (11:18 +0000)]
[AArch32] ACLE intrinsics bfloat16 vmmla and vfma<b/t> for AArch32 AdvSIMD

This patch adds the ARMv8.6 ACLE intrinsics for vmmla, vfmab and vfmat
as part of the BFloat16 extension.
(https://developer.arm.com/docs/101028/latest.)
The intrinsics are declared in arm_neon.h and the RTL patterns are
defined in neon.md.
Two new tests are added to check assembler output and lane indices.

2020-03-05  Delia Burduv  <delia.burduv@arm.com>

* config/arm/arm_neon.h (vbfmmlaq_f32): New.
(vbfmlalbq_f32): New.
(vbfmlaltq_f32): New.
(vbfmlalbq_lane_f32): New.
(vbfmlaltq_lane_f32): New.
(vbfmlalbq_laneq_f32): New.
(vbfmlaltq_laneq_f32): New.
* config/arm/arm_neon_builtins.def (vmmla): New.
(vfmab): New.
(vfmat): New.
(vfmab_lane): New.
(vfmat_lane): New.
(vfmab_laneq): New.
(vfmat_laneq): New.
* config/arm/iterators.md (BF_MA): New int iterator.
(bt): New int attribute.
(VQXBF): Copy of VQX with V8BF.
* config/arm/neon.md (neon_vmmlav8bf): New insn.
(neon_vfma<bt>v8bf): New insn.
(neon_vfma<bt>_lanev8bf): New insn.
(neon_vfma<bt>_laneqv8bf): New expand.
(neon_vget_high<mode>): Changed iterator to VQXBF.
* config/arm/unspecs.md (UNSPEC_BFMMLA): New UNSPEC.
(UNSPEC_BFMAB): New UNSPEC.
(UNSPEC_BFMAT): New UNSPEC.

2020-03-05  Delia Burduv  <delia.burduv@arm.com>

* gcc.target/arm/simd/bf16_ma_1.c: New test.
* gcc.target/arm/simd/bf16_ma_2.c: New test.
* gcc.target/arm/simd/bf16_mmla_1.c: New test.

4 years ago[PATCH][GCC]: Add myself to MAINTAINERS
Srinath Parvathaneni [Thu, 5 Mar 2020 11:07:11 +0000 (11:07 +0000)]
[PATCH][GCC]: Add myself to MAINTAINERS

4 years agoprint-rtl: Fix printing of CONST_STRING in DEBUG_INSNs [PR93399]
Jakub Jelinek [Thu, 5 Mar 2020 08:12:44 +0000 (09:12 +0100)]
print-rtl: Fix printing of CONST_STRING in DEBUG_INSNs [PR93399]

The following testcase fails to assemble, as CONST_STRING in the DEBUG_INSNs
is printed as is, so if it contains \n and/or \r, we are in trouble:
        .loc 1 14 3
        # DEBUG haystack => [si]
        # DEBUG needle => "
"
In the gimple dumps we print those (STRING_CSTs) as
  # DEBUG haystack => D#1
  # DEBUG needle => "\n"
so this patch uses what we use in tree printing for the CONST_STRINGs too.

2020-03-05  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/93399
* tree-pretty-print.h (pretty_print_string): Declare.
* tree-pretty-print.c (pretty_print_string): Remove forward
declaration, no longer static.  Change nbytes parameter type
from unsigned to size_t.
* print-rtl.c (print_value) <case CONST_STRING>: Use
pretty_print_string and for shrink way too long strings.

* gcc.dg/pr93399.c: New test.

4 years agoKeep .GCC.command.line sections of LTO objetcs
Richard Biener [Thu, 5 Mar 2020 07:44:11 +0000 (08:44 +0100)]
Keep .GCC.command.line sections of LTO objetcs

This patch is for .GCC.command.line sections in LTO objects to be copied
into the final objects as in the following example:

[egeyar@localhost lto]$ gcc -flto -O3 demo.c -c -g --record-gcc-command-line
[egeyar@localhost lto]$ gcc -flto -O2 demo2.c -c -g --record-gcc-command-line -DFORTIFY=2
[egeyar@localhost lto]$ gcc demo.o demo2.o -o a.out
[egeyar@localhost lto]$ readelf -p .GCC.command.line a.out

String dump of section '.GCC.command.line':
  [     0]  10.0.1 20200227 (experimental) : gcc -flto -O3 demo.c -c -g --record-gcc-command-line
  [    56]  10.0.1 20200227 (experimental) : gcc -flto -O2 demo2.c -c -g --record-gcc-command-line -DFORTIFY=2

2020-03-05  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

* simple-object.c (handle_lto_debug_sections): Name
".GCC.command.line" among debug sections to be copied over
from lto objects.

4 years agosccvn: Fix handling of POINTER_PLUS_EXPR in memset offset [PR93582]
Jakub Jelinek [Thu, 5 Mar 2020 07:00:04 +0000 (08:00 +0100)]
sccvn: Fix handling of POINTER_PLUS_EXPR in memset offset [PR93582]

> > where POINTER_PLUS_EXPR last operand has sizetype type, thus unsigned,
> > and in the testcase gimple_assign_rhs2 (def) is thus 0xf000000000000001ULL
> > which multiplied by 8 doesn't fit into signed HWI.  If it would be treated
> > as signed offset instead, it would fit (-0xfffffffffffffffLL, multiplied
> > by 8 is -0x7ffffffffffffff8LL).  Unfortunately with the poly_int obfuscation
> > I'm not sure how to convert it from unsigned to signed poly_int.
>
> mem_ref_offset provides a boiler-plate for this:
>
> poly_offset_int::from (wi::to_poly_wide (TREE_OPERAND (t, 1)), SIGNED);

Thanks, that seems to work.
The test now works on both big-endian and little-endian.

2020-03-05  Richard Biener  <rguenther@suse.de>
    Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/93582
* tree-ssa-sccvn.c (vn_reference_lookup_3): Treat POINTER_PLUS_EXPR
last operand as signed when looking for memset offset.  Formatting
fix.

* gcc.dg/tree-ssa/pr93582-11.c: New test.

Co-authored-by: Richard Biener <rguenther@suse.de>
4 years agoPR c++/90938 - Initializing array with {1} works but not {0}
Martin Sebor [Thu, 5 Mar 2020 01:19:31 +0000 (18:19 -0700)]
PR c++/90938 - Initializing array with {1} works but not {0}

gcc/cp/ChangeLog:

PR c++/90938
* tree.c (type_initializer_zero_p): Fail for structs initialized
with non-structs.

gcc/testsuite/ChangeLog:

PR c++/90938
* g++.dg/init/array55.C: New test.
* g++.dg/init/array56.C: New test.
* g++.dg/cpp2a/nontype-class33.C: New test.

4 years agoDaily bump.
GCC Administrator [Thu, 5 Mar 2020 00:16:34 +0000 (00:16 +0000)]
Daily bump.

4 years agoFix format warning which showed up on FreeBSD 11.3.
Jeff Law [Wed, 4 Mar 2020 23:25:11 +0000 (16:25 -0700)]
Fix format warning which showed up on FreeBSD 11.3.

PR bootstrap/93962
* value-prof.c (dump_histogram_value): Use std::abs.

4 years agoc++: Fix [[no_unique_address]] and default mem-init [PR90432]
Jason Merrill [Wed, 4 Mar 2020 17:08:42 +0000 (12:08 -0500)]
c++: Fix [[no_unique_address]] and default mem-init [PR90432]

output_constructor doesn't like two consecutive entries with fields at the
same position; let's avoid adding the one for the empty field.

gcc/cp/ChangeLog
2020-03-04  Jason Merrill  <jason@redhat.com>

PR c++/90432
* init.c (perform_member_init): Don't do aggregate initialization of
empty field.
* constexpr.c (cx_check_missing_mem_inits): Don't enforce
initialization of empty field.

4 years agoPR tree-optimization/93986 - ICE on mixed-precision wide_int arguments
Martin Sebor [Wed, 4 Mar 2020 22:14:49 +0000 (15:14 -0700)]
PR tree-optimization/93986 - ICE on mixed-precision wide_int arguments

gcc/testsuite/ChangeLog:

PR tree-optimization/93986
        * gcc.dg/pr93986.c: New test.

gcc/ChangeLog:

PR tree-optimization/93986
        * tree-ssa-strlen.c (maybe_warn_overflow): Convert all wide_int
        operands to the same precision widest_int to avoid ICEs.

4 years agoanalyzer: validate region subclasses
David Malcolm [Thu, 20 Feb 2020 13:44:23 +0000 (08:44 -0500)]
analyzer: validate region subclasses

This patch converts region::validate to a vfunc, implementing
additional checking per subclass: verifying that various
region_id fields within map_region, array_region, stack_region and
root_region are valid, rather than just those within the base class.

Doing so caught bugs earlier in follow-up work I have on
canonicalization and purging of region_model.

gcc/analyzer/ChangeLog:
* region-model.cc (region::validate): Convert model param from ptr
to reference.  Update comment to reflect that it's now a vfunc.
(map_region::validate): New vfunc implementation.
(array_region::validate): New vfunc implementation.
(stack_region::validate): New vfunc implementation.
(root_region::validate): New vfunc implementation.
(region_model::validate): Pass a reference rather than a pointer
to the region::validate vfunc.
* region-model.h (region::validate): Make virtual.  Convert model
param from ptr to reference.
(map_region::validate): New vfunc decl.
(array_region::validate): New vfunc decl.
(stack_region::validate): New vfunc decl.
(root_region::validate): New vfunc decl.

4 years agoanalyzer: add regression test for fixed ICE [PR94028]
David Malcolm [Wed, 4 Mar 2020 17:10:34 +0000 (12:10 -0500)]
analyzer: add regression test for fixed ICE [PR94028]

The C++ reproducer for PR analyzer/94028 generates a similar ICE
to that of the Fortran reproducer for PR analyzer/93993 and, like
it, was fixed by r10-7023-g3d66e153b40ed000af30a9e569a05f34d5d576aa.

This patch adds the C++ reproducer as a regression test.

gcc/testsuite/ChangeLog:
PR analyzer/94028
* g++.dg/analyzer/pr94028.C: New test.

4 years agoPR middle-end/81401 - false positive -Wformat-overflow in a loop
Martin Sebor [Wed, 4 Mar 2020 17:23:49 +0000 (10:23 -0700)]
PR middle-end/81401 - false positive -Wformat-overflow in a loop

gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/builtin-sprintf-warn-24.c: New test.

4 years agoRemove unnecessary XFAILs from existing testcase 20050603-3.c.
Will Schmidt [Wed, 4 Mar 2020 16:11:45 +0000 (10:11 -0600)]
Remove unnecessary XFAILs from existing testcase 20050603-3.c.

  The XFAILs in this testcase (20050603-3.c) are no longer necessary
  since the fix to PR68803 was committed with svn revision r242681.

2020-03-04  Will Schmidt  <will_schmidt@vnet.ibm.com>

testsuite

        * gcc.target/powerpc/20050603-3.c: Remove XFAILS.

4 years agoAdd dg-require to existing powerpc/pr93122.c test
Will Schmidt [Wed, 4 Mar 2020 16:05:17 +0000 (10:05 -0600)]
Add dg-require to existing powerpc/pr93122.c test

2020-03-04  Will Schmidt  <will_schmidt@vnet.ibm.com>

* gcc.target/powerpc/pr93122.c: Add dg-require.

4 years agoanalyzer: handle __builtin_expect [PR93993]
David Malcolm [Tue, 3 Mar 2020 21:36:13 +0000 (16:36 -0500)]
analyzer: handle __builtin_expect [PR93993]

The false warning:
 pr93993.f90:19:0:

   19 |     allocate (tm) ! { dg-warning "dereference of possibly-NULL" }
      |
 Warning: dereference of possibly-NULL â€˜_6’ [CWE-690] [-Wanalyzer-possible-null-dereference]

in the reproducer for PR analyzer/93993 is due to a BUILTIN_EXPECT in
the chain of SSA expressions between the malloc and the condition
guarding the edge: the analyzer didn't "know" about the relationship
between initial argument to BUILTIN_EXPECT and the return value.

This patch implements support for BUILTIN_EXPECT so that the return
value is known to be equal to the initial argument.  This adds
constraints when exploring the CFG edges, eliminating the above
false positive.

Doing so also eliminated the leak warning from the reproducer.  The
issue was that leaked_pvs was empty within
impl_region_model_context::on_state_leak, due to the leaking region
being a view, of type struct Pdtet_8 *, of a region of type
struct pdtet_8 *, which led region_model::get_representative_path_var to
return a NULL_TREE value.

Hence the patch also implements view support for
region_model::get_representative_path_var, restoring the leak
diagnostic, albeit changing the wording to:

  Warning: leak of â€˜(struct Pdtet_8) qb’ [CWE-401] [-Wanalyzer-malloc-leak]

It's not clear to me if we should emit leaks at a fortran "end program"
(currently we suppress them for leaks at the end of main).

gcc/analyzer/ChangeLog:
PR analyzer/93993
* region-model.cc (region_model::on_call_pre): Handle
BUILT_IN_EXPECT and its variants.
(region_model::add_any_constraints_from_ssa_def_stmt): Split out
gassign handling into add_any_constraints_from_gassign; add gcall
handling.
(region_model::add_any_constraints_from_gassign): New function,
based on the above.  Add handling for NOP_EXPR.
(region_model::add_any_constraints_from_gcall): New function.
(region_model::get_representative_path_var): Handle views.
* region-model.h
(region_model::add_any_constraints_from_ssa_def_stmt): New decl.
(region_model::add_any_constraints_from_gassign): New decl.

gcc/testsuite/ChangeLog:
PR analyzer/93993
* gcc.dg/analyzer/expect-1.c: New test.
* gcc.dg/analyzer/malloc-4.c: New test.
* gfortran.dg/analyzer/pr93993.f90: Remove xfail from dg-bogus.
Move location of leak warning and update message.

4 years agoanalyzer: fix ICE on non-lvalue in prune_for_sm_diagnostic [PR93993]
David Malcolm [Tue, 3 Mar 2020 15:53:04 +0000 (10:53 -0500)]
analyzer: fix ICE on non-lvalue in prune_for_sm_diagnostic [PR93993]

PR analyzer/93993 reports another ICE within
diagnostic_manager::prune_for_sm_diagnostic in which the expression
of interest becomes a non-lvalue (similar to PR 93544, PR 93647, and
PR 93950), due to attempting to get an lvalue for a non-lvalue with a
NULL context, leading to an ICE when the failure is reported to
make_region_for_unexpected_tree_code.  The tree in question is
an ADDR_EXPR of a VAR_DECL, due to:
  event 11: switching var of interest from â€˜tm’ in callee to â€˜&qb’ in caller

This patch adds more bulletproofing to the routine by introducing
a tentative_region_model_context class that can be passed in such
circumstances which records that an error occurred, and then
checking to see if an error was recorded, thus avoiding the ICE.
This is papering over the problem, but a better solution seems more
like stage 1 material.

The patch also refactors the error-checking for CONSTANT_CLASS_P.

The testcase pr93993.f90 has a false positive:

 pr93993.f90:19:0:

    19 |     allocate (tm) ! { dg-warning "dereference of possibly-NULL" }
       |
 Warning: dereference of possibly-NULL â€˜_6’ [CWE-690] [-Wanalyzer-possible-null-dereference]

which appears to be a pre-existing bug affecting any allocate call in
Fortran, which I will fix in a followup.

gcc/analyzer/ChangeLog:
PR analyzer/93993
* checker-path.h (state_change_event::get_lvalue): Add ctxt param
and pass it to region_model::get_value call.
* diagnostic-manager.cc (get_any_origin): Pass a
tentative_region_model_context to the calls to get_lvalue and reject
the comparison if errors occur.
(can_be_expr_of_interest_p): New function.
(diagnostic_manager::prune_for_sm_diagnostic): Replace checks for
CONSTANT_CLASS_P with calls to update_for_unsuitable_sm_exprs.
Pass a tentative_region_model_context to the calls to
state_change_event::get_lvalue and reject the comparison if errors
occur.
(diagnostic_manager::update_for_unsuitable_sm_exprs): New.
* diagnostic-manager.h
(diagnostic_manager::update_for_unsuitable_sm_exprs): New decl.
* region-model.h (class tentative_region_model_context): New class.

gcc/testsuite/ChangeLog:
PR analyzer/93993
* gfortran.dg/analyzer/pr93993.f90: New test.

4 years agoanalyzer: remove unused private fields
David Malcolm [Tue, 3 Mar 2020 21:45:56 +0000 (16:45 -0500)]
analyzer: remove unused private fields

gcc/analyzer/ChangeLog:
* engine.cc (worklist::worklist): Remove unused field m_eg.
(class viz_callgraph_edge): Remove unused field m_call_sedge.
(class viz_callgraph): Remove unused field m_sg.
* exploded-graph.h (worklist::::m_eg): Remove unused field.

4 years agolibstdc++: Fix comment on __memcpyable
Jonathan Wakely [Wed, 4 Mar 2020 15:34:05 +0000 (15:34 +0000)]
libstdc++: Fix comment on __memcpyable

The discussion of iterator_traits<volatile T*>::value_type and  the
example with three tempalte arguments related to an earlier version of
the patch, not the one committed.

Also improve the comment on __memcmpable.

* include/bits/cpp_type_traits.h (__memcpyable): Fix comment.

4 years agors6000: Fix -mpower9-vector -mno-altivec ICE (PR87560)
Bill Schmidt [Wed, 4 Mar 2020 13:30:29 +0000 (07:30 -0600)]
rs6000: Fix -mpower9-vector -mno-altivec ICE (PR87560)

PR87560 reports an ICE when a test case is compiled with -mpower9-vector
and -mno-altivec.  This patch terminates compilation with an error when
this combination (and other unreasonable ones) are requested.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no
regressions.  Reported error is now:

f951: Error: '-mno-altivec' turns off '-mpower9-vector'

2020-03-02  Bill Schmidt  <wschmidt@linux.ibm.com>

PR target/87560
* rs6000-cpus.def (OTHER_ALTIVEC_MASKS): New #define.
* rs6000.c (rs6000_disable_incompatible_switches): Add table entry
for OPTION_MASK_ALTIVEC.

4 years agoIBM Z: zTPF: Include glibc-stdint.h to get __UINTPTR_TYPE__ defined
Andreas Krebbel [Wed, 4 Mar 2020 12:29:39 +0000 (13:29 +0100)]
IBM Z: zTPF: Include glibc-stdint.h to get __UINTPTR_TYPE__ defined

Building a zTPF cross currently fails when building libstdc++
complaining about the __UINTPTR_TYPE__ to be missing.

Fixed by including the glibc-stdint.h header.

2020-03-04  Andreas Krebbel  <krebbel@linux.ibm.com>

* config.gcc: Include the glibc-stdint.h header for zTPF.

4 years agoIBM Z: zTPF: Prevent FPR usage
Andreas Krebbel [Wed, 4 Mar 2020 12:29:39 +0000 (13:29 +0100)]
IBM Z: zTPF: Prevent FPR usage

For the zTPF we must not use floating point registers.

gcc/ChangeLog:

2020-03-04  Andreas Krebbel  <krebbel@linux.ibm.com>

* config/s390/s390.c (s390_secondary_memory_needed): Disallow
direct FPR-GPR copies.
(s390_register_info_gprtofpr): Disallow GPR content to be saved in
FPRs.

4 years agoIBM Z: zTPF: Build libgcc with -mtpf-trace-skip
Andreas Krebbel [Wed, 4 Mar 2020 12:29:38 +0000 (13:29 +0100)]
IBM Z: zTPF: Build libgcc with -mtpf-trace-skip

libgcc is supposed to be built with the trace skip flags and branch
targets.  Add a zTPF header file fragment and add the -mtpf-trace-skip
option.

libgcc/ChangeLog:

2020-03-04  Andreas Krebbel  <krebbel@linux.ibm.com>

* config.host: Include the new makefile fragment.
* config/s390/t-tpf: New file.

4 years agoIBM Z: zTPF: Add tpf trace customization options
Andreas Krebbel [Wed, 4 Mar 2020 12:29:38 +0000 (13:29 +0100)]
IBM Z: zTPF: Add tpf trace customization options

The zTPF OS implements a tracing facility for function entry and exit
which uses global flags and trace function addresses. The addresses of
the flags as well as the trace functions are currently hard-coded in
the zTPF specific GCC parts of the IBM Z back-end.

With this patch these addresses can be changed at compile-time using
the new command line options.  For convenience one additional command
line option (-mtpf-trace-skip) implements a new set of hard-coded
addresses.

gcc/ChangeLog:

2020-03-04  Andreas Krebbel  <krebbel@linux.ibm.com>

* config/s390/s390.c (s390_emit_prologue): Specify the 2 new
operands to the prologue_tpf expander.
(s390_emit_epilogue): Likewise.
(s390_option_override_internal): Do error checking and setup for
the new options.
* config/s390/tpf.h (TPF_TRACE_PROLOGUE_CHECK)
(TPF_TRACE_EPILOGUE_CHECK, TPF_TRACE_PROLOGUE_TARGET)
(TPF_TRACE_EPILOGUE_TARGET, TPF_TRACE_PROLOGUE_SKIP_TARGET)
(TPF_TRACE_EPILOGUE_SKIP_TARGET): New macro definitions.
* config/s390/tpf.md ("prologue_tpf", "epilogue_tpf"): Add two new
operands for the check flag and the branch target.
* config/s390/tpf.opt ("mtpf-trace-hook-prologue-check")
("mtpf-trace-hook-prologue-target")
("mtpf-trace-hook-epilogue-check")
("mtpf-trace-hook-epilogue-target", "mtpf-trace-skip"): New
options.
* doc/invoke.texi: Document -mtpf-trace-skip option. The other
options are for debugging purposes and will not be documented
here.

4 years agoAdd -fcommon to a test-case to re-trigger it.
Martin Liska [Wed, 4 Mar 2020 12:05:21 +0000 (13:05 +0100)]
Add -fcommon to a test-case to re-trigger it.

* gcc.target/i386/pr91623.c: Add -fcommon in order
to re-trigger the needed code for the test-case which
was added in r10-2910-g9151048d854e352a9b83b771c6711b8221c73f7e.

4 years agoinliner: Copy DECL_BY_REFERENCE in copy_decl_to_var [PR93888]
Jakub Jelinek [Wed, 4 Mar 2020 11:59:04 +0000 (12:59 +0100)]
inliner: Copy DECL_BY_REFERENCE in copy_decl_to_var [PR93888]

In the following testcase we emit wrong debug info for the karg
parameter in the DW_TAG_inlined_subroutine into main.
The problem is that the karg PARM_DECL is DECL_BY_REFERENCE and thus
in the IL has const K & type, but in the source just const K.
When the function is inlined, we create a VAR_DECL for it, but don't
set DECL_BY_REFERENCE, so when emitting DW_AT_location, we treat it like
a const K & typed variable, but it has DW_AT_abstract_origin which has
just the const K type and thus the debugger thinks the variable has
const K type.

Fixed by copying the DECL_BY_REFERENCE flag.  Not doing it in
copy_decl_for_dup_finish, because copy_decl_no_change already copies
that flag through copy_node and in copy_result_decl_to_var it is
undesirable, as we handle DECL_BY_REFERENCE in that case instead
by changing the type.

2020-03-04  Jakub Jelinek  <jakub@redhat.com>

PR debug/93888
* tree-inline.c (copy_decl_to_var): Copy DECL_BY_REFERENCE flag.

* g++.dg/guality/pr93888.C: New test.

4 years agosccvn: Avoid overflows in push_partial_def
Jakub Jelinek [Wed, 4 Mar 2020 11:46:31 +0000 (12:46 +0100)]
sccvn: Avoid overflows in push_partial_def

The following patch attempts to avoid dangerous overflows in the various
push_partial_def HOST_WIDE_INT computations.
This is achieved by performing the subtraction offset2i - offseti in
the push_partial_def function and before doing that doing some tweaks.
If a constant store (non-CONSTRUCTOR) is too large (perhaps just
hypothetical case), native_encode_expr would fail for it, but we don't
necessarily need to fail right away, instead we can treat it like
non-constant store and if it is already shadowed, we can ignore it.
Otherwise, if it at most 64-byte and the caller ensured that there is
a range overlap and push_partial_def ensures the load is at most 64-byte,
I think we should be fine, offset (relative to the load)
can be from -64*8+1 to 64*8-1 only and size at most 64*8, so no risks of
overflowing HOST_WIDE_INT computations.
For CONSTRUCTOR (or non-constant) stores, those can be indeed arbitrarily
large, the caller just checks that both the absolute offset and size fit
into signed HWI.  But, we store the same bytes in that case over and over
(both in the {} case where it is all 0, and in the hypothetical future case
where we handle in push_partial_def also memset (, 123, )), so we can tweak
the write range for our purposes.  For {} store we could just cap it at the
start offset and/or offset+size because all the bits are 0, but I wrote it
in anticipation of the memset case and so the relative offset can now be
down to -7 and similarly size can grow up to 64 bytes + 14 bits, all this
trying to preserve the offset difference % BITS_PER_UNIT or end as well.

2020-03-04  Jakub Jelinek  <jakub@redhat.com>

* tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Add offseti
argument.  Change pd argument so that it can be modified.  Turn
constant non-CONSTRUCTOR store into non-constant if it is too large.
Adjust offset and size of CONSTRUCTOR or non-constant store to avoid
overflows.
(vn_walk_cb_data::vn_walk_cb_data, vn_reference_lookup_3): Adjust
callers.

4 years agotree-optimization/93964 - adjust ISL code generation for pointer params
Richard Biener [Wed, 4 Mar 2020 09:40:32 +0000 (10:40 +0100)]
tree-optimization/93964 - adjust ISL code generation for pointer params

Pointers eventually need intermediate conversions in code generation.
Allowing them is much easier than fending them off since niter
and scev expansion easily drag those in.

2020-02-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/93964
* graphite-isl-ast-to-gimple.c
(gcc_expression_from_isl_ast_expr_id): Add intermediate
conversion for pointer to integer converts.
* graphite-scop-detection.c (assign_parameter_index_in_region):
Relax assert.

* gcc.dg/graphite/pr93964.c: New testcase.

4 years agoClear --help=language and --help=common interaction.
Martin Liska [Wed, 4 Mar 2020 08:31:55 +0000 (09:31 +0100)]
Clear --help=language and --help=common interaction.

PR c/93886
PR c/93887
* doc/invoke.texi: Clarify --help=language and --help=common
interaction.

4 years agoWrap array in ctor with braces.
Martin Liska [Wed, 4 Mar 2020 08:31:05 +0000 (09:31 +0100)]
Wrap array in ctor with braces.

* method.c: Wrap array in ctor with braces in order
to silent clang warnings.

4 years agotailcall: Fix up process_assignment [PR94001]
Jakub Jelinek [Wed, 4 Mar 2020 08:01:59 +0000 (09:01 +0100)]
tailcall: Fix up process_assignment [PR94001]

When a function returns void or the return value is ignored, ass_var
is NULL_TREE.  The tail recursion handling generally assumes DCE has been
performed and so doesn't expect to encounter useless assignments after the
call and expects them to be part of the return value adjustment that need
to be changed into tail recursion additions/multiplications.
process_assignment does some verification and has a way to tell the caller
to try to move dead or whatever other stmts that don't participate in the
return value modifications before it is returned.
For binary rhs assignments it is just fine, neither op0 nor op1 will be
NULL_TREE and thus if *ass_var is NULL_TREE, it will not match, but unary
rhs is handled by only setting op0 to rhs1 and setting op1 to NULL_TREE.
And at this point, NULL_TREE == NULL_TREE and thus we think e.g. the
  c_2 = -e_3(D);
dead stmt is actually a return value modification, so we queue it as
multiplication and then create a void type SSA_NAME accumulator for it
and ICE shortly after.

Fixed by making sure op1 == *ass_var comparison is done only if *ass_var.

2020-03-04  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/94001
* tree-tailcall.c (process_assignment): Before comparing op1 to
*ass_var, verify *ass_var is non-NULL.

* gcc.dg/pr94001.c: New test.

4 years agoPR target/93995 ICE in patch_jump_insn, at cfgrtl.c:1290 on riscv64-linux-gnu
Kito Cheng [Tue, 3 Mar 2020 06:16:34 +0000 (14:16 +0800)]
PR target/93995 ICE in patch_jump_insn, at cfgrtl.c:1290 on riscv64-linux-gnu

Last code gen change of LTGT didn't consider the situation of cbranch with LTGT,
branch only support few compare codes.

gcc/ChangeLog

* config/riscv/riscv.c (riscv_emit_float_compare): Using NE to compare
the result of IOR.

gcc/testsuite/ChangeLog

* gcc.dg/pr93995.c: New.

4 years agoc++: Fix mismatch in template argument deduction [PR90505]
Marek Polacek [Tue, 3 Mar 2020 22:56:44 +0000 (17:56 -0500)]
c++: Fix mismatch in template argument deduction [PR90505]

My GCC 9 patch for C++20 P0846R0 (ADL and function templates) tweaked
cp_parser_template_name to only return an identifier if name lookup
didn't find anything.  In the deduce4.C case it means that we now
return an OVERLOAD.  That means that cp_parser_template_id will call
lookup_template_function whereby producing a TEMPLATE_ID_EXPR with
unknown_type_node.  Previously, we created a TEMPLATE_ID_EXPR with
no type, making it type-dependent.  What we have now is no longer
type-dependent.  And so, when we call finish_call_expr after we've
parsed "foo<int>(10)", even though we're in a template, we still do
the normal processing, thus perform overload resolution.  When adding
the template candidate foo we need to deduce the template arguments,
and that is where things go downhill.

When fn_type_unification sees that we have explicit template arguments,
but they aren't complete, it will use them to substitute the function
type.  So we substitute e.g. "void <T33d> (U)".  But the explicit
template argument was for a different parameter so we don't actually
substitute anything.  But the problem here was that we reduced the
template level of 'U' anyway.  So then when we're actually deducing
the template arguments via type_unification_real, we fail in unify:
22932       if (TEMPLATE_TYPE_LEVEL (parm)
22933           != template_decl_level (tparm))
22934         /* The PARM is not one we're trying to unify.  Just check
22935            to see if it matches ARG.  */
because 'parm' has been reduced but 'tparm' has not yet.

Therefore we shouldn't reduce the template level of template parameters
when tf_partial aka template argument deduction substitution.  But we
can only return after performing the cp_build_qualified_type etc.
business otherwise things break horribly.

2020-03-03  Jason Merrill  <jason@redhat.com>
    Marek Polacek  <polacek@redhat.com>

PR c++/90505 - mismatch in template argument deduction.
* pt.c (tsubst): Don't reduce the template level of template
parameters when tf_partial.

* g++.dg/template/deduce4.C: New test.
* g++.dg/template/deduce5.C: New test.
* g++.dg/template/deduce6.C: New test.
* g++.dg/template/deduce7.C: New test.

4 years agolibstdc++: Fix incorrect use of memset in ranges::fill_n (PR 94017)
Patrick Palka [Tue, 3 Mar 2020 21:16:05 +0000 (16:16 -0500)]
libstdc++: Fix incorrect use of memset in ranges::fill_n (PR 94017)

When deciding whether to perform the memset optimization in ranges::fill_n, we
were crucially neglecting to check that the output pointer's value type is a
byte type.  This patch adds such a check to the problematic condition in
ranges::fill_n.

At the same time, this patch relaxes the overly conservative
__is_byte<_Tp>::__value check that requires the fill type be a byte type.  It's
overly conservative because it means we won't enable the memset optimization in
the following example

  char c[100];
  ranges::fill(c, 37);

because the fill type is deduced to be int here.  Rather than requiring that the
fill type be a byte type, it seems safe to just require the fill type be an
integral type, which is what this patch does.

libstdc++-v3/ChangeLog:

PR libstdc++/94017
* include/bits/ranges_algobase.h (__fill_n_fn::operator()): Refine
condition for when to use memset, making sure to additionally check that
the output pointer's value type is a non-volatile byte type.  Instead of
requiring that the fill type is a byte type, just require that it's an
integral type.
* testsuite/20_util/specialized_algorithms/uninitialized_fill/94017.cc:
New test.
* testsuite/20_util/specialized_algorithms/uninitialized_fill_n/94017.cc:
New test.
* testsuite/25_algorithms/fill/94013.cc: Uncomment part that was blocked
by PR 94017.
* testsuite/25_algorithms/fill/94017.cc: New test.
* testsuite/25_algorithms/fill_n/94017.cc: New test.

4 years agolibstdc++: Move-only input iterator support in <memory> algorithms (LWG 3355)
Patrick Palka [Tue, 3 Mar 2020 00:39:46 +0000 (19:39 -0500)]
libstdc++: Move-only input iterator support in <memory> algorithms (LWG 3355)

This adds support for move-only input iterators in the ranges::unitialized_*
algorithms defined in <memory>, as per LWG 3355.  The only changes needed are to
add calls to std::move in the appropriate places and to use operator- instead of
ranges::distance because the latter cannot be used with a move-only iterator
that has a sized sentinel, as is the case here.  (This issue with
ranges::distance is LWG 3392.)

libstdc++-v3/ChangeLog:

LWG 3355 The memory algorithms should support move-only input iterators
introduced by P1207
* include/bits/ranges_uninitialized.h
(__uninitialized_copy_fn::operator()): Use std::move to avoid attempting
to copy __ifirst, which could be a move-only input iterator.  Use
operator- instead of ranges::distance to compute distance from a sized
sentinel.
(__uninitialized_copy_n_fn::operator()): Likewise.
(__uninitialized_move_fn::operator()): Likewise.
(__uninitialized_move_n_fn::operator()): Likewise.
(__uninitialized_destroy_fn::operator()): Use std::move to avoid
attempting to copy __first.
(__uninitialized_destroy_n_fn::operator()): Likewise.
* testsuite/20_util/specialized_algorithms/destroy/constrained.cc:
Augment test.
* .../specialized_algorithms/uninitialized_copy/constrained.cc:
Likewise.
* .../specialized_algorithms/uninitialized_move/constrained.cc:
Likewise.

4 years agolibstdc++: Add a testsuite range type that has a sized sentinel
Patrick Palka [Tue, 3 Mar 2020 03:32:22 +0000 (22:32 -0500)]
libstdc++: Add a testsuite range type that has a sized sentinel

This adds a testsuite range type whose end() is a sized sentinel to
<testsuite_iterators.h>, which will be used in the tests that verify LWG 3355.

libstdc++-v3/ChangeLog:

* testsuite/util/testsuite_iterators.h (test_range::get_iterator): Make
protected instead of private.
(test_sized_range_sized_sent): New.

4 years agolibstdc++: Add a move-only testsuite iterator type
Patrick Palka [Mon, 2 Mar 2020 21:21:33 +0000 (16:21 -0500)]
libstdc++: Add a move-only testsuite iterator type

This adds a move-only testsuite iterator wrapper to <testsuite_iterators.h>
which will be used in the tests for LWG 3355.  The tests for LWG 3389 and 3390
are adjusted to use this new iterator wrapper.

libstdc++-v3/ChangeLog:

* testsuite/util/testsuite_iterators.h (input_iterator_wrapper_nocopy):
New testsuite iterator.
* testsuite/24_iterators/counted_iterator/lwg3389.cc: Use it.
* testsuite/24_iterators/move_iterator/lwg3390.cc: Likewise.

4 years agolibstdc++: Fix use of is_nothrow_assignable_v in <bits/ranges_uninitialized.h>
Patrick Palka [Tue, 3 Mar 2020 00:39:13 +0000 (19:39 -0500)]
libstdc++: Fix use of is_nothrow_assignable_v in <bits/ranges_uninitialized.h>

We are passing a value type as the first argument to is_nothrow_assignable_v,
but the result of that is inevitably false.  Since this predicate is a part of
the condition that guards the corresponding optimizations for these algorithms,
this bug means these optimizations are never used.  We should be passing a
reference type to is_nothrow_assignable_v instead.

libstdc++-v3/ChangeLog:

* include/bits/ranges_uninitialized.h
(uninitialized_copy_fn::operator()): Pass a reference type as the first
argument to is_nothrow_assignable_v.
(uninitialized_copy_fn::operator()): Likewise.
(uninitialized_move_fn::operator()): Likewise.  Return an in_out_result
with the input iterator stripped of its move_iterator.
(uninitialized_move_n_fn::operator()): Likewise.
(uninitialized_fill_fn::operator()): Pass a reference type as the first
argument to is_nothrow_assignable_v.
(uninitialized_fill_n_fn::operator()): Likewise.

4 years agocoroutines: Handle component_ref in captures_temporary
JunMa [Tue, 11 Feb 2020 08:01:08 +0000 (16:01 +0800)]
coroutines: Handle component_ref in captures_temporary

gcc/cp
        * coroutines.cc (captures_temporary): Strip component_ref
        to its base object.

gcc/testsuite
        * g++.dg/coroutines/torture/co-await-15-capture-comp-ref.C: New test.

4 years agoDaily bump.
GCC Administrator [Wed, 4 Mar 2020 00:16:33 +0000 (00:16 +0000)]
Daily bump.

4 years agolibstdc++: Workaround is_trivially_copyable<volatile T> (PR 94013)
Jonathan Wakely [Tue, 3 Mar 2020 21:38:57 +0000 (21:38 +0000)]
libstdc++: Workaround is_trivially_copyable<volatile T> (PR 94013)

Several algorithms check the is_trivially_copyable trait to decide
whether to dispatch to memmove or memcmp as an optimization. Since
r271435 (CWG DR 2094) the trait is true for volatile-qualified scalars,
but we can't use memmove or memcmp when the type is volatile. We need to
also check for volatile types.

This is complicated by the fact that in C++20 (but not earlier standards)
iterator_traits<volatile T*>::value_type is T, so we can't just check
whether the value_type is volatile.

The solution in this patch is to introduce new traits __memcpyable and
__memcmpable which combine into a single trait the checks for pointers,
the value types being the same, and the type being trivially copyable
but not volatile-qualified.

PR libstdc++/94013
* include/bits/cpp_type_traits.h (__memcpyable, __memcmpable): New
traits to control when to use memmove and memcmp optimizations.
(__is_nonvolatile_trivially_copyable): New helper trait.
* include/bits/ranges_algo.h (__lexicographical_compare_fn): Do not
use memcmp optimization with volatile data.
* include/bits/ranges_algobase.h (__equal_fn): Use __memcmpable.
(__copy_or_move, __copy_or_move_backward): Use __memcpyable.
* include/bits/stl_algobase.h (__copy_move_a2): Use __memcpyable.
(__copy_move_backward_a2): Likewise.
(__equal_aux1): Use __memcmpable.
(__lexicographical_compare_aux): Do not use memcmp optimization with
volatile data.
* testsuite/25_algorithms/copy/94013.cc: New test.
* testsuite/25_algorithms/copy_backward/94013.cc: New test.
* testsuite/25_algorithms/equal/94013.cc: New test.
* testsuite/25_algorithms/fill/94013.cc: New test.
* testsuite/25_algorithms/lexicographical_compare/94013.cc: New test.
* testsuite/25_algorithms/move/94013.cc: New test.
* testsuite/25_algorithms/move_backward/94013.cc: New test.

4 years agoc++: Fix non-constant TARGET_EXPR constexpr handing [PR93998]
Jakub Jelinek [Tue, 3 Mar 2020 18:49:12 +0000 (19:49 +0100)]
c++: Fix non-constant TARGET_EXPR constexpr handing [PR93998]

We ICE on the following testcase since I've added the SAVE_EXPR-like
constexpr handling where the TARGET_EXPR initializer (and cleanup) is
evaluated only once (because it might have side-effects like new or delete
expressions in it).
The problem is if the TARGET_EXPR (but I guess in theory SAVE_EXPR too)
initializer is *non_constant_p.  We still remember the result, but already
not that it is *non_constant_p.  Normally that wouldn't be a big problem,
if something is *non_constant_p, we only or into it and so the whole
expression will be non-constant too.  Except in the builtins handling,
we try to evaluate the arguments with non_constant_p pointing into a dummy1
bool which we ignore.  This is because some builtins might fold into a
constant even if they don't have a constexpr argument.  Unfortunately if
we evaluate the TARGET_EXPR first in the argument of such a builtin and then
once again, we don't set *non_constant_p.

So, either we don't remember the TARGET_EXPR/SAVE_EXPR result if it wasn't
constant, like the following patch does, or we could remember it, but in
some way that would make it clear that it is non-constant (e.g. by
pushing into the global->values SAVE_EXPR, SAVE_EXPR entry and perhaps
for TARGET_EXPR don't remember it on TARGET_EXPR_SLOT, but the TARGET_EXPR
itself and similarly push TARGET_EXPR, TARGET_EXPR and if we see those
after the lookup, diagnose + set *non_constant_p.  Or we could perhaps
during the builtin argument evaluation push expressions into a different
save_expr vec and undo them afterwards.

2020-03-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/93998
* constexpr.c (cxx_eval_constant_expression)
<case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
*non_constant_p is true.

* g++.dg/ext/pr93998.C: New test.

4 years agolibgcc: arm: convert thumb1 code to unified syntax
Richard Earnshaw [Tue, 3 Mar 2020 16:02:24 +0000 (16:02 +0000)]
libgcc: arm: convert thumb1 code to unified syntax

Unified syntax has been the official syntax for thumb1 assembly for
over 10 years now.  It's time we made preparations for that becoming
the default in the assembler.  But before we can start doing that we
really need to clean up some laggards from the olden days.  Libgcc
support for thumb1 is one such example.

This patch converts all of the legacy (disjoint) syntax that I could
find over to unified code.  The identification was done by using a
trick version of gas that defaulted to unified mode which then faults
if legacy syntax is encountered.  The code produced was then compared
against the old code to check for differences.  One such difference
does exist, but that is because in unified syntax 'movs rd, rn' is
encoded as 'lsls rd, rn, #0', rather than 'adds rd, rn, #0'; but that
is a deliberate change that was introduced because the lsls encoding
more closely reflects the behaviour of 'movs' in arm state (where only
some of the condition flags are modified).

* config/arm/bpabi-v6m.S (aeabi_lcmp): Convert thumb1 code to unified
syntax.
(aeabi_ulcmp, aeabi_ldivmod, aeabi_uldivmod): Likewise.
(aeabi_frsub, aeabi_cfcmpeq, aeabi_fcmpeq): Likewise.
(aeabi_fcmp, aeabi_drsub, aeabi_cdrcmple): Likewise.
(aeabi_cdcmpeq, aeabi_dcmpeq, aeabi_dcmp): Likewise.
* config/arm/lib1funcs.S (Lend_fde): Convert thumb1 code to unified
syntax.
(divsi3, modsi3): Likewise.
(clzdi2, ctzsi2): Likewise.
* config/arm/libunwind.S (restore_core_regs): Convert thumb1 code to
unified syntax.
(UNWIND_WRAPPER): Likewise.