platform/upstream/gcc.git
4 years agoAdd missing ChangeLog entry.
Martin Liska [Tue, 19 May 2020 09:12:52 +0000 (11:12 +0200)]
Add missing ChangeLog entry.

4 years agoFix typo in c-parser.c.
Martin Liska [Tue, 19 May 2020 08:39:30 +0000 (10:39 +0200)]
Fix typo in c-parser.c.

gcc/c/ChangeLog:

* c-parser.c: Fix typo.

4 years agoopenmp: Add basic library allocator support.
Jakub Jelinek [Tue, 19 May 2020 08:11:01 +0000 (10:11 +0200)]
openmp: Add basic library allocator support.

This patch adds very basic allocator support (omp_{init,destroy}_allocator,
omp_{alloc,free}, omp_[sg]et_default_allocator).
The plan is to use memkind (likely dlopened) for high bandwidth memory, but
that part isn't implemented yet, probably mlock for pinned memory and see
what other options there are for other kinds of memory.
For offloading targets, we need to decide if we want to support the
dynamic allocators (and on which targets), or if e.g. all we do is at compile
time replace omp_alloc/omp_free calls with constexpr predefined allocators
with something special.

And allocate directive and allocator/uses_allocators clauses are future work
too.

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

* omp.h.in (omp_uintptr_t): New typedef.
(__GOMP_UINTPTR_T_ENUM): Define.
(omp_memspace_handle_t, omp_allocator_handle_t, omp_alloctrait_key_t,
omp_alloctrait_value_t, omp_alloctrait_t): New typedefs.
(__GOMP_DEFAULT_NULL_ALLOCATOR): Define.
(omp_init_allocator, omp_destroy_allocator, omp_set_default_allocator,
omp_get_default_allocator, omp_alloc, omp_free): Declare.
* libgomp.h (struct gomp_team_state): Add def_allocator field.
(gomp_def_allocator): Declare.
* libgomp.map (OMP_5.0.1): Export omp_set_default_allocator,
omp_get_default_allocator, omp_init_allocator, omp_destroy_allocator,
omp_alloc and omp_free.
* team.c (gomp_team_start): Copy over ts.def_allocator.
* env.c (gomp_def_allocator): New variable.
(parse_wait_policy): Adjust function comment.
(parse_allocator): New function.
(handle_omp_display_env): Print OMP_ALLOCATOR.
(initialize_env): Call parse_allocator.
* Makefile.am (libgomp_la_SOURCES): Add allocator.c.
* allocator.c: New file.
* icv.c (omp_set_default_allocator, omp_get_default_allocator): New
functions.
* testsuite/libgomp.c-c++-common/alloc-1.c: New test.
* testsuite/libgomp.c-c++-common/alloc-2.c: New test.
* testsuite/libgomp.c-c++-common/alloc-3.c: New test.
* Makefile.in: Regenerated.

4 years agoAdd gcc-verify alias.
Martin Liska [Tue, 19 May 2020 07:19:18 +0000 (09:19 +0200)]
Add gcc-verify alias.

* gcc-git-customization.sh: Add gcc-verify alias
that uses contrib/gcc-changelog/git_check_commit.py.

4 years agoRISC-V: Handle implied extension for -march parser.
Kito Cheng [Fri, 10 Apr 2020 09:20:19 +0000 (17:20 +0800)]
RISC-V: Handle implied extension for -march parser.

  - Implied rule are introduced into latest RISC-V ISA spec.

  - Only implemented D implied F-extension. Zicsr and Zifence are not
    implement yet, so the rule not included in this patch.

  - Pass preprocessed arch string to arch.

  - Verified with binutils 2.30 and 2.34.

gcc/ChangeLog

* common/config/riscv/riscv-common.c (riscv_implied_info_t): New.
(riscv_implied_info): New.
(riscv_subset_list): Add handle_implied_ext.
(riscv_subset_list::to_string): New parameter version_p to
control output format.
(riscv_subset_list::handle_implied_ext): New.
(riscv_subset_list::parse_std_ext): Call handle_implied_ext.
(riscv_arch_str): New parameter version_p to control output format.
(riscv_expand_arch): New.
* config/riscv/riscv-protos.h (riscv_arch_str): New parameter,
version_p.
* config/riscv/riscv.h (riscv_expand_arch): New,
(EXTRA_SPEC_FUNCTIONS): Define.
(ASM_SPEC): Transform -march= via riscv_expand_arch.

gcc/testsuite/ChangeLog

* gcc.target/riscv/arch-6.c: New.
* gcc.target/riscv/attribute-11.c: New.
* gcc.target/riscv/attribute-12.c: New.

4 years agoRISC-V: Update march parser
Kito Cheng [Fri, 10 Apr 2020 09:20:18 +0000 (17:20 +0800)]
RISC-V: Update march parser

 - The arch string rule has changed in latest spec, it introduced new
   multi-letter extension prefix with 'h' and 'z', and drop `sx`. also
   adjust parsing order for 's' and 'x'.

gcc/ChangeLog

* riscv-common.c (parse_sv_or_non_std_ext): Rename to
parse_multiletter_ext.
(parse_multiletter_ext): Add parsing `h` and `z`, drop `sx`,
adjust parsing order for 's' and 'x'.

gcc/testsuite/ChangeLog

* gcc.target/riscv/arch-3.c: Adjust option.
* gcc.target/riscv/arch-5.c: New.
* gcc.target/riscv/attribute-9.c: Adjust option and test
condition.

4 years agocost invariant nodes from vect_slp_analyze_node_operations SLP walk
Richard Biener [Mon, 18 May 2020 14:05:00 +0000 (16:05 +0200)]
cost invariant nodes from vect_slp_analyze_node_operations SLP walk

2020-05-19  Richard Biener  <rguenther@suse.de>

* tree-vectorizer.h (_slp_tree::vectype): Add field.
(SLP_TREE_VECTYPE): New.
* tree-vect-slp.c (vect_create_new_slp_node): Initialize
SLP_TREE_VECTYPE.
(vect_create_new_slp_node): Likewise.
(vect_prologue_cost_for_slp): Move here from tree-vect-stmts.c
and simplify.
(vect_slp_analyze_node_operations): Walk nodes children for
invariant costing.
(vect_get_constant_vectors): Use local scope op variable.
* tree-vect-stmts.c (vect_prologue_cost_for_slp_op): Remove here.
(vect_model_simple_cost): Adjust.
(vect_model_store_cost): Likewise.
(vectorizable_store): Likewise.

4 years agoc++: Enable spec_hasher table sanitization [PR87847]
Patrick Palka [Tue, 19 May 2020 03:50:32 +0000 (23:50 -0400)]
c++: Enable spec_hasher table sanitization [PR87847]

It looks like hash table sanitization is now safe to enable for the
decl_specializations and type_specializations tables, probably ever
since PR94454 was fixed.

gcc/cp/ChangeLog:

PR c++/87847
* pt.c (init_template_processing): Enable sanitization for
decl_specializations and type_specializations.

4 years agoc++: Explain fn template argument type/value mismatches [PR66439]
Patrick Palka [Tue, 19 May 2020 03:50:14 +0000 (23:50 -0400)]
c++: Explain fn template argument type/value mismatches [PR66439]

In fn_type_unifcation, we are passing NULL_TREE as the 'in_decl'
parameter to coerce_template_parms, and this is causing template
type/value mismatch error messages to get suppressed regardless of the
value of 'complain'.

This means that when substitution into a function template fails due to
a type/value mismatch between a template parameter and the provided
template argument, we just say "template argument deduction/substitution
failed:" without a followup explanation of the failure.

Fix this by passing 'fn' instead of NULL_TREE to coerce_template_parms.

gcc/cp/ChangeLog:

PR c++/66439
* pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
the 'in_decl' parameter to coerce_template_parms.

gcc/testsuite/ChangeLog:

PR c++/66439
* g++.dg/cpp2a/concepts-ts4.C: Expect a "type/value mismatch"
diagnostic.
* g++.dg/cpp2a/concepts-ts6.C: Likewise.
* g++.dg/template/error56.C: Likewise.
* g++.dg/template/error59.C: New test.

libstdc++-v3/ChangeLog:

PR c++/66439
* testsuite/20_util/pair/astuple/get_neg.cc: Prune "type/value
mismatch" messages.
* testsuite/20_util/tuple/element_access/get_neg.cc: Likewise.

4 years agoDaily bump.
GCC Administrator [Tue, 19 May 2020 00:16:28 +0000 (00:16 +0000)]
Daily bump.

4 years agoc++: ICE when shortening right shift [PR94955]
Marek Polacek [Wed, 6 May 2020 19:53:33 +0000 (15:53 -0400)]
c++: ICE when shortening right shift [PR94955]

Since r10-6527 fold_for_warn calls maybe_constant_value, which means it
can fold more than it previously could.  In this testcase it means that
cp_build_binary_op/RSHIFT_EXPR set short_shift because now we were able
to fold op1 to an INTEGER_CST.  But then when actually performing the
shortening we crashed because cp_fold_rvalue wasn't able to fold as much
as f_f_w and so tree_int_cst_sgn crashed on a NOP_EXPR.  Therefore the
calls should probably match.

PR c++/94955
* typeck.c (cp_build_binary_op): Use fold_for_warn instead of
cp_fold_rvalue.

* g++.dg/cpp0x/constexpr-shift2.C: New test.

4 years agoc++: ICE with -Wall and constexpr if [PR94937]
Marek Polacek [Wed, 6 May 2020 23:24:58 +0000 (19:24 -0400)]
c++: ICE with -Wall and constexpr if [PR94937]

An ICE arises here because we call cp_get_callee_fndecl_nofold in a
template, and we've got a CALL_EXPR whose CALL_EXPR_FN is a BASELINK.
This tickles the INDIRECT_TYPE_P assert in cp_get_fndecl_from_callee.

Fixed by turning the assert into a condition and returning NULL_TREE
in that case.

PR c++/94937
* cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
type is not INDIRECT_TYPE_P.
* decl.c (omp_declare_variant_finalize_one): Call
cp_get_callee_fndecl_nofold instead of looking for the function decl
manually.

* g++.dg/cpp1z/constexpr-if34.C: New test.
* g++.dg/cpp2a/is-constant-evaluated10.C: New test.

4 years agoPR middle-end/92815 - spurious -Wstringop-overflow writing into a flexible array...
Martin Sebor [Mon, 18 May 2020 22:31:13 +0000 (16:31 -0600)]
PR middle-end/92815 - spurious -Wstringop-overflow writing into a flexible array of an extern struct

Adjust test to avoid failures in ILP32 mode.

gcc/testsuite/ChangeLog:

PR middle-end/92815
* gcc.dg/builtin-object-size-20.c: Adjust to avoid failures in
ILP32 mode.

4 years agoc++: Sorry about type-dependent arg for __builtin_has_attribute [PR90915]
Marek Polacek [Fri, 8 May 2020 01:10:42 +0000 (21:10 -0400)]
c++: Sorry about type-dependent arg for __builtin_has_attribute [PR90915]

Until 92104 is fixed, let's sorry rather than crash.

PR c++/90915
* parser.c (cp_parser_has_attribute_expression): Sorry on a
type-dependent argument.

* g++.dg/ext/builtin-has-attribute.C: New test.

4 years agoPR middle-end/92815 - spurious -Wstringop-overflow writing into a flexible array...
Martin Sebor [Mon, 18 May 2020 21:24:12 +0000 (15:24 -0600)]
PR middle-end/92815 - spurious -Wstringop-overflow writing into a flexible array of an extern struct

gcc/ChangeLog:

PR middle-end/92815
* tree-object-size.c (decl_init_size): New function.
(addr_object_size): Call it.
* tree.h (last_field): Declare.
(first_field): Add attribute nonnull.

gcc/testsuite/ChangeLog:

PR middle-end/92815
* gcc.dg/Warray-bounds-56.c: Remove xfails.
* gcc.dg/builtin-object-size-20.c: New test.
* gcc.dg/builtin-object-size-21.c: New test.

4 years agoPR middle-end/94940 - spurious -Warray-bounds for a zero length array member of union
Martin Sebor [Mon, 18 May 2020 21:07:48 +0000 (15:07 -0600)]
PR middle-end/94940 - spurious -Warray-bounds for a zero length array member of union

gcc/testsuite/ChangeLog:

PR middle-end/94940
* gcc.dg/Warray-bounds-61.c: New test.

gcc/ChangeLog:

PR middle-end/94940
* tree-vrp.c (vrp_prop::check_mem_ref): Remove unreachable code.
* tree.c (component_ref_size): Correct the handling or array members
of unions.
Drop a pointless test.
Rename a local variable.

4 years agoUpdate gcc sv.po.
Joseph Myers [Mon, 18 May 2020 20:50:35 +0000 (20:50 +0000)]
Update gcc sv.po.

* sv.po: Update.

4 years agoc++: Implement DR 1512, Pointer comparison vs qual convs [PR87699]
Marek Polacek [Wed, 13 May 2020 19:52:42 +0000 (15:52 -0400)]
c++: Implement DR 1512, Pointer comparison vs qual convs [PR87699]

This patch resolves DR 1512 (and, by turn, DR 583).  This entails:

1) Relational pointer comparisons against null pointer constants have
   been made ill-formed:

   void f(char *p) {
      if (p > 0)
// ...
   }

   was always invalid in C but was -- accidentally -- allowed in C++.

2) This was ill-formed:

   bool foo(int** x, const int** y) {
     return x < y;
   }

   because 'int**' couldn't be converted to 'const int**'.  This was
   fixed by re-defining a generic composite pointer type.  The composite
   type of these two pointers will be 'const int *const *', to which
   both pointers can be converted.

3) The overload descriptions for built-in operators were adjusted,
   because objects of type std::nullptr_t cannot be used with relational
   operators any more.

I fixed 1) by adjusting cp_build_binary_op; we already had a warning
for it so made it a hard error now.

Then 2) required tweaking composite_pointer_type_r.  [expr.type] defines
the composite pointer type by using the "cv-combined type."  We didn't
implement the [conv.qual]/3.3 part; previously the composite type of
'int**' and 'const int**' was 'const int**', so this didn't compile:

    void f(const int **p, int **q) {
      true ? p : q;
    }

I wrote a more extensive test for this which uses decltype and some
template magic to check the composite type, see composite-ptr-type.C.
We still don't handle everything that [expr.type] requires us to,
but it's pretty close.

And finally 3) was handled in add_builtin_candidate.  Turned out we
weren't creating built-in operator candidates when the type was
std::nullptr_t at all.  We should, for == and !=.  Tested in builtin4.C.
In passing, I'm fixing some of the comments too.

DR 1512
PR c++/87699
* call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
operator functions when type is std::nullptr_t for ==/!=.
* typeck.c (composite_pointer_type_r): Add bool a * parameter.  Use it
to maybe add "const" to the pointer type.
(composite_pointer_type): Update the call to composite_pointer_type_r.
(cp_build_binary_op): Turn two warning_at into error_at.  Print the
types.

* g++.dg/cpp0x/constexpr-array-ptr10.C: Change dg-warning to dg-error
and adjust the expected messages in dg-error.
* g++.dg/expr/composite-ptr-type.C: New test.
* g++.dg/expr/ptr-comp1.C: New test.
* g++.dg/expr/ptr-comp2.C: New test.
* g++.dg/expr/ptr-comp3.C: New test.
* g++.dg/overload/builtin4.C: New test.
* g++.dg/warn/Wextra-3.C: Change dg-warning to dg-error.

4 years agoc++: Create fewer SAVE_EXPR.
Jason Merrill [Wed, 15 Jan 2020 03:55:59 +0000 (22:55 -0500)]
c++: Create fewer SAVE_EXPR.

In a couple of places in build_over_call we were calling
cp_stabilize_reference but only using the result once, so it isn't needed.

gcc/cp/ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

* call.c (build_over_call): Remove unnecessary
cp_stabilize_reference.

4 years agoc++: Don't add built-in operator for ++ on bool.
Marek Polacek [Fri, 15 May 2020 14:59:01 +0000 (10:59 -0400)]
c++: Don't add built-in operator for ++ on bool.

This feels extremely obscure but at least it's an opportunity to fix the
comments.  P0002R1 removed deprecated operator++(bool) in C++17 so let's
avoid adding a builtin overload candidate for ++ when the type is bool.

* call.c (add_builtin_candidate): Don't create a builtin overload
candidate for ++ when type is bool in C++17.

* g++.dg/overload/builtin5.C: New test.

4 years agoc++: Regenerate cp/cfns.h.
Marek Polacek [Fri, 15 May 2020 21:54:05 +0000 (17:54 -0400)]
c++: Regenerate cp/cfns.h.

Current cfns.h includes register-qualified variables and that wouldn't
play well when bootstrapping with GCC that uses the C++17 dialect,
because 'register' was removed in C++17.  Regenerating it using the
command specified in cfns.h luckily cleaned this up.

* cfns.h: Regenerated.

4 years agoRequire powerpc_vsx_ok in gcc.target/powerpc/pr71763.c
Douglas Rupp [Mon, 18 May 2020 18:43:48 +0000 (11:43 -0700)]
Require powerpc_vsx_ok in gcc.target/powerpc/pr71763.c

We're getting an error when running this test on PowerPC VxWorks 7,
due to an unexpected warning:

    | Excess errors:
    | cc1: warning: '-mvsx' and '-mno-altivec' are incompatible

The warning comes from a combination of factors:
  - The test itself uses -mvsx explicitly via the following directive:
       // { dg-options "-O1 -mvsx" }
  - Our toolchain was configured so as to make -mno-altivec
    the default;
  - These two options are mutually exclusive.

This commit adds a powerpc_vsx_ok dg-require-effective-target directive
to that test, and thus making it UNSUPPORTED instead.

Tested on PowerPC VxWorks 7. Also tested on PowerPC ELF as well,
a platform where we do not make -mno-altivec the default, to verify
that the test continues to run as usual in that case.

gcc/testsuite/

        * gcc.target/powerpc/pr71763.c: Require powerpc_vsx_ok.

4 years agobootstrap: Update requirement to C++11.
Jason Merrill [Mon, 18 May 2020 18:28:16 +0000 (14:28 -0400)]
bootstrap: Update requirement to C++11.

There was general agreement last November that we would move to allowing
C++11 features to be used in GCC 11; this patch implements that direction.

ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

* configure.ac: Update bootstrap dialect to -std=c++11.

config/ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

* ax_cxx_compile_stdcxx.m4: Import from autoconf archive with
an adjustment to try the default mode.

gcc/ChangeLog
2020-05-18  Jason Merrill  <jason@redhat.com>

* aclocal.m4: Add ax_cxx_compile_stdcxx.m4.
* configure.ac: Use AX_CXX_COMPILE_STDCXX(11).

4 years agoPR fortran/95053 - division by zero constants
Harald Anlauf [Mon, 18 May 2020 18:27:29 +0000 (20:27 +0200)]
PR fortran/95053 - division by zero constants

Partially revert the fix for PR93499.  Replace by checks for valid
expressions in the declaration of array shape and PDT KIND and LEN
expressions at a later stage.

gcc/fortran/

2020-05-18  Harald Anlauf  <anlauf@gmx.de>

PR fortran/95053
* arith.c (gfc_divide): Revert hunk introduced by patch for
PR93499.
* decl.c (variable_decl): Generate error for array shape not being
an INTEGER constant.
(gfc_get_pdt_instance): Generate error if KIND or LEN expressions
in declaration of a PDT instance do not simplify to INTEGER
constants.

gcc/testsuite/

2020-05-18  Harald Anlauf  <anlauf@gmx.de>

PR fortran/95053
* gfortran.dg/dec_structure_23.f90: Adjust to new error messages.
* gfortran.dg/pr93499.f90: Adjust to new error messages.
* gfortran.dg/pr95053_2.f90: New test.
* gfortran.dg/pr95053_3.f90: New test.

4 years agotree-optimization: Fix use of uninitialized variables warnings [PR94952]
Stefan Schulze Frielinghaus [Tue, 5 May 2020 17:44:19 +0000 (19:44 +0200)]
tree-optimization: Fix use of uninitialized variables warnings [PR94952]

While bootstrapping GCC on S/390 with --enable-checking=release several
warnings about use of uninitialized variables bitpos, bitregion_start, and
bitregion_end of function pass_store_merging::process_store are raised.
According to PR94952 these seem to be false positives which are silenced by
initialising the mentioned variables.

Bootstrapped on S/390.  Ok for master and releases/gcc-10 assuming that
regtest succeeds (still running but I don't see a reason why it
should fail)?

gcc/ChangeLog:

2020-05-18  Stefan Schulze Frielinghaus  <stefansf@linux.ibm.com>

PR tree-optimization/94952
* gimple-ssa-store-merging.c (pass_store_merging::process_store):
Initialize variables bitpos, bitregion_start, and bitregion_end in
order to silence warnings about use of uninitialized variables.

4 years agoc++: Add test for c++/95143
Marek Polacek [Mon, 18 May 2020 17:50:39 +0000 (13:50 -0400)]
c++: Add test for c++/95143

Already fixed by r10-8124-gceae6a13366d9646e172fc943fe8e221b70f0920.

PR c++/95143
* g++.dg/cpp0x/sfinae66.C: New test.

4 years agopr94833, fix vec_first_match_index for nulls
Carl Love [Wed, 29 Apr 2020 15:23:11 +0000 (10:23 -0500)]
pr94833, fix vec_first_match_index for nulls

gcc/ChangeLog

2020-04-30  Carl Love  <cel@us.ibm.com>

PR target/94833
* config/rs6000/vsx.md (define_expand): Fix instruction generation for
first_match_index_<mode>.
* testsuite/gcc.target/powerpc/builtins-8-p9-runnable.c (main): Add
additional test cases with zero vector elements.

4 years agoi386: Avoid reversing a non-trapping comparison to a trapping one [PR95169]
Uros Bizjak [Mon, 18 May 2020 15:52:14 +0000 (17:52 +0200)]
i386: Avoid reversing a non-trapping comparison to a trapping one [PR95169]

gcc/ChangeLog:

PR target/95169
* config/i386/i386-expand.c (ix86_expand_int_movcc):
 Avoid reversing a non-trapping comparison to a trapping one.

testsuite/ChangeLog:

PR target/95169
* gcc.target/i386/pr95169.c: New test.

4 years ago[arm] Don't generate invalid LDRD insns
Alex Coplan [Mon, 18 May 2020 15:29:04 +0000 (16:29 +0100)]
[arm] Don't generate invalid LDRD insns

This fixes a bug in the arm backend where GCC generates invalid LDRD
instructions. The LDRD instruction requires the first transfer register to be
even, but GCC attempts to use odd registers here. For example, with the
following C code:

    struct c {
      double a;
    } __attribute((aligned)) __attribute((packed));
    struct c d;
    struct c f(struct c);
    void e() { f(d); }

The struct d is passed in registers r1 and r2 to the function f, and GCC
attempted to do this with a LDRD instruction when compiling with -march=armv7-a
on a soft float toolchain.

The fix is analogous to the corresponding one for STRD in the same function:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=52057dc4ac5295caebf83147f688d769c93cbc8d

2020-05-18  Alex Coplan  <alex.coplan@arm.com>

gcc/:
* config/arm/arm.c (output_move_double): Fix codegen when loading into
a register pair with an odd base register.

gcc/testsuite/:
* gcc.c-torture/compile/packed-aligned-1.c: New test.
* gcc.c-torture/execute/packed-aligned.c: New test.

4 years agoi386: Improve vector mode and TFmode ABS and NEG patterns
Uros Bizjak [Mon, 18 May 2020 15:25:39 +0000 (17:25 +0200)]
i386: Improve vector mode and TFmode ABS and NEG patterns

gcc/ChangeLog:

2020-05-18  Uroš Bizjak  <ubizjak@gmail.com>

* config/i386/i386-expand.c (ix86_expand_fp_absneg_operator):
Do not emit FLAGS_REG clobber for TFmode.
* config/i386/i386.md (*<code>tf2_1): Rewrite as
define_insn_and_split.  Mark operands 1 and 2 commutative.
(*nabstf2_1): Ditto.
(absneg SSE splitter): Use MODEF mode iterator instead of SSEMODEF.
Do not swap memory operands.  Simplify RTX generation.
(neg abs SSE splitter): Ditto.
* config/i386/sse.md (*<code><mode>2): Mark operands 1 and 2
commutative.  Do not swap operands.  Simplify RTX generation.
(*nabs<mode>2): Ditto.

4 years agofixup BB vectorization constant generation place
Richard Biener [Fri, 15 May 2020 11:13:38 +0000 (13:13 +0200)]
fixup BB vectorization constant generation place

This adjusts the way we compute the stmt insert location for
invariants in BB vectorization context to deal with eventually
sharing invariant SLP nodes for multiple uses.  We can no longer
use a single use stmt location then but there's a simple way out.

2020-05-18  Richard Biener  <rguenther@suse.de>

* tree-vect-slp.c (vect_slp_bb): Start after labels.
(vect_get_constant_vectors): Really place init stmt after scalar defs.
* tree-vect-stmts.c (vect_init_vector_1): Insert before
region begin.

4 years agox86: Update Intel processor detection
H.J. Lu [Mon, 18 May 2020 12:35:27 +0000 (05:35 -0700)]
x86: Update Intel processor detection

Add cpu model numbers for Intel Airmont, Tremont, Comet Lake, Ice Lake
and Tiger Lake processor families.

* config/i386/driver-i386.c (host_detect_local_cpu): Support
Intel Airmont, Tremont, Comet Lake, Ice Lake and Tiger Lake
processor families.

4 years agoMAINTAINERS: Add myself for write after approval.
Alex Coplan [Mon, 18 May 2020 11:21:17 +0000 (12:21 +0100)]
MAINTAINERS: Add myself for write after approval.

2020-05-18  Alex Coplan  <alex.coplan@arm.com>

* MAINTAINERS (Write After Approval): Add myself.

4 years agomiddle-end/95171 - inlining of trapping compare into non-call EH fn
Richard Biener [Mon, 18 May 2020 06:51:23 +0000 (08:51 +0200)]
middle-end/95171 - inlining of trapping compare into non-call EH fn

This fixes always-inlining across -fnon-call-exception boundaries
for conditions which we do not allow to throw.

2020-05-18  Richard Biener  <rguenther@suse.de>

PR middle-end/95171
* tree-inline.c (remap_gimple_stmt): Split out trapping compares
when inlining into a non-call EH function.

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

4 years agotree-optimization/95172 - avoid mixing conditionalized and ordered SM
Richard Biener [Mon, 18 May 2020 07:17:24 +0000 (09:17 +0200)]
tree-optimization/95172 - avoid mixing conditionalized and ordered SM

The following testcase shows a missed optimization that then leads to
wrong-code when issueing SMed stores on exits.  When we were able to
compute an ordered sequence of stores for an exit we need to emit
that in the correct order and we can emit it disregarding to any
conditional for whether a store actually happened (we know it did).
We can also improve detection as of whether we need conditional
processing at all.  Both parts fix the testcase.

2020-05-18  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95172
* tree-ssa-loop-im.c (execute_sm): Get flag whether we
eventually need the conditional processing.
(execute_sm_exit): When processing an orderd sequence
avoid doing any conditional processing.
(hoist_memory_references): Pass down whether all edges
have ordered processing for a ref to execute_sm.

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

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

4 years agocoroutines: Avoid a maybe used uninitialized warning. NFC.
Iain Sandoe [Sun, 17 May 2020 11:26:19 +0000 (12:26 +0100)]
coroutines: Avoid a maybe used uninitialized warning. NFC.

This avoids a (bogus) warning that occurs with some bootstrap
compilers.

gcc/cp/ChangeLog:

2020-05-17  Iain Sandoe  <iain@sandoe.co.uk>

* coroutines.cc (morph_fn_to_coro): Initialize the
gro variable.

4 years agoUse pc_or_label_operand to collapse a couple more patterns in preparation for the...
Jeff Law [Sun, 17 May 2020 17:20:39 +0000 (13:20 -0400)]
Use pc_or_label_operand to collapse a couple more patterns in preparation for the cc0->CC_REG transition.

* config/h8300/predicates.md (pc_or_label_operand): New predicate.
* config/h8300/jumpcall.md (branch_true, branch_false): Consolidate
into a single pattern using pc_or_label_operand.
* config/h8300/combiner.md (bit branch patterns): Likewise.
* config/h8300/peepholes.md (HImode and SImode branches): Likewise.

4 years agox86: Allow V1TI vector register pushes
H.J. Lu [Sun, 17 May 2020 17:10:34 +0000 (10:10 -0700)]
x86: Allow V1TI vector register pushes

Add V1TI vector register push and split it after reload to a sequence
of:

(set (reg:P SP_REG) (plus:P SP_REG) (const_int -8)))
(set (match_dup 0) (match_dup 1))

so that STV pass can convert TI mode integer push to V1TI vector register
push.  Rename has_non_address_hard_reg to pseudo_reg_set, combine calls
of single_set and has_non_address_hard_reg to pseudo_reg_set, to ignore
pseudo register push.

Remove c-c++-common/dfp/func-vararg-mixed-2.c since it is compiled with
-mpreferred-stack-boundary=2 and leads to segfault:

Dump of assembler code for function __bid_nesd2:
   0x08049210 <+0>: endbr32
   0x08049214 <+4>: push   %esi
   0x08049215 <+5>: push   %ebx
   0x08049216 <+6>: call   0x8049130 <__x86.get_pc_thunk.bx>
   0x0804921b <+11>: add    $0x8de5,%ebx
   0x08049221 <+17>: sub    $0x20,%esp
   0x08049224 <+20>: mov    0x30(%esp),%esi
   0x08049228 <+24>: pushl  0x2c(%esp)
   0x0804922c <+28>: call   0x804e600 <__bid32_to_bid64>
   0x08049231 <+33>: mov    %esi,(%esp)
   0x08049234 <+36>: movd   %edx,%xmm1
   0x08049238 <+40>: movd   %eax,%xmm0
   0x0804923c <+44>: punpckldq %xmm1,%xmm0
=> 0x08049240 <+48>: movaps %xmm0,0x10(%esp)
   0x08049245 <+53>: call   0x804e600 <__bid32_to_bid64>
   0x0804924a <+58>: push   %edx
   0x0804924b <+59>: push   %eax
   0x0804924c <+60>: pushl  0x1c(%esp)
   0x08049250 <+64>: pushl  0x1c(%esp)
   0x08049254 <+68>: call   0x804b260 <__bid64_quiet_not_equal>
   0x08049259 <+73>: add    $0x34,%esp
   0x0804925c <+76>: pop    %ebx
   0x0804925d <+77>: pop    %esi
   0x0804925e <+78>: ret

when libgcc is compiled with -msse2.  According to GCC manual:

'-mpreferred-stack-boundary=NUM'
     Attempt to keep the stack boundary aligned to a 2 raised to NUM
     byte boundary.  If '-mpreferred-stack-boundary' is not specified,
     the default is 4 (16 bytes or 128-bits).

     *Warning:* If you use this switch, then you must build all modules
     with the same value, including any libraries.  This includes the
     system libraries and startup modules.

c-c++-common/dfp/func-vararg-mixed-2.c, which was added by

commit 3b2488ca6ece182f2136a20ee5fa0bb92f935b0f
Author: H.J. Lu <hongjiu.lu@intel.com>
Date:   Wed Jul 30 19:24:02 2008 +0000

    func-vararg-alternate-d128-2.c: New.

    2008-07-30  H.J. Lu  <hongjiu.lu@intel.com>
                Joey Ye  <joey.ye@intel.com>

            * gcc.dg/dfp/func-vararg-alternate-d128-2.c: New.
            * gcc.dg/dfp/func-vararg-mixed-2.c: Likewise.

isn't expected to work with libgcc.

gcc/

PR target/95021
* config/i386/i386-features.c (has_non_address_hard_reg):
Renamed to ...
(pseudo_reg_set): This.  Return the SET expression.  Ignore
pseudo register push.
(general_scalar_to_vector_candidate_p): Combine single_set and
has_non_address_hard_reg calls to pseudo_reg_set.
(timode_scalar_to_vector_candidate_p): Likewise.
* config/i386/i386.md (*pushv1ti2): New pattern.

gcc/testsuite/

PR target/95021
* c-c++-common/dfp/func-vararg-mixed-2.c: Removed.
* gcc.target/i386/pr95021-1.c: New test.
* gcc.target/i386/pr95021-2.c: Likewise.
* gcc.target/i386/pr95021-3.c: Likewise.
* gcc.target/i386/pr95021-4.c: Likewise.
* gcc.target/i386/pr95021-5.c: Likewise.

4 years agolibphobos: Merge upstream druntime 5cc061a8, phobos 64ed4684f
Iain Buclaw [Sun, 17 May 2020 16:49:19 +0000 (18:49 +0200)]
libphobos: Merge upstream druntime 5cc061a8, phobos 64ed4684f

- core.cpuid has been fixed to not use i7 detection on AMD processors.
- std.net.curl has been fixed to correctly handle HTTP/2 status lines.
- std.zip has had a test fixed to not rely on unzip being installed.

Fixes: PR d/95166
       PR d/95167
       PR d/95168

Reviewed-on: https://github.com/dlang/druntime/pull/3107
     https://github.com/dlang/phobos/pull/7486

4 years agox86: Add gcc.target/i386/strncmp-1.c
H.J. Lu [Sun, 17 May 2020 13:52:02 +0000 (06:52 -0700)]
x86: Add gcc.target/i386/strncmp-1.c

Add a strncmp test for the cmpstrn pattern with neither of the strings
is a constant string.  We can expand the cmpstrn pattern to "repz cmpsb"
only if one of the strings is a constant so that expand_builtin_strncmp()
can write the length argument to be the minimum of the const string
length and the actual length argument.  Otherwise, "repz cmpsb" may pass
the 0 byte.

* gcc.target/i386/strncmp-1.c: New test.

4 years agoRevert previous patch:
Aldy Hernandez [Sun, 17 May 2020 11:56:55 +0000 (13:56 +0200)]
Revert previous patch:

2020-05-17  Aldy Hernandez  <aldyh@redhat.com>

* tree-vrp.c (operand_less_p): Move to...
* vr-values.c (operand_less_p): ...here.
* tree-vrp.h (operand_less_p): Remove.

4 years agoMove operand_less_p to vr-values.c.
Aldy Hernandez [Fri, 8 May 2020 11:36:32 +0000 (13:36 +0200)]
Move operand_less_p to vr-values.c.

4 years agoRemove vrp_insert::live_on_edge declaration.
Aldy Hernandez [Sun, 17 May 2020 11:40:09 +0000 (13:40 +0200)]
Remove vrp_insert::live_on_edge declaration.

* tree-vrp.c (class vrp_insert): Remove prototype for
live_on_edge.

4 years agoMore refactoring of tree-vrp.c.
Aldy Hernandez [Sat, 16 May 2020 18:56:19 +0000 (20:56 +0200)]
More refactoring of tree-vrp.c.

New class live_names to maintain the set of SSA names live.

Fix whitespace in vrp_insert.

Move a few more methods related to ASSERT_EXPR insertion into vrp_insert.

4 years agoMove array bounds checking out of vrp_prop and into its own class.
Aldy Hernandez [Tue, 5 May 2020 16:40:44 +0000 (18:40 +0200)]
Move array bounds checking out of vrp_prop and into its own class.

4 years agoDaily bump.
GCC Administrator [Sun, 17 May 2020 00:16:17 +0000 (00:16 +0000)]
Daily bump.

4 years agocoroutines: Implicitly movable objects should use move CTORs for co_return.
Iain Sandoe [Sat, 16 May 2020 18:23:19 +0000 (19:23 +0100)]
coroutines: Implicitly movable objects should use move CTORs for co_return.

This is a case where the standard contains conflicting information.
after discussion between implementators, the accepted intent is of
[class.copy.elision].  This amends the handling of co_return statements
to follow that.

gcc/cp/ChangeLog:

2020-05-16  Iain Sandoe  <iain@sandoe.co.uk>

* coroutines.cc (finish_co_return_stmt): Implement rules
from [class.copy.elision] /3.

gcc/testsuite/ChangeLog:

2020-05-16  Iain Sandoe  <iain@sandoe.co.uk>

* g++.dg/coroutines/co-return-syntax-10-movable.C: New test.

4 years agoConsolidate a couple peepholes and improve peepholes that combine stack allocations...
Jeff Law [Sat, 16 May 2020 04:47:47 +0000 (00:47 -0400)]
Consolidate a couple peepholes and improve peepholes that combine stack allocations with stack stores.

* config/h8300/h8300.md (SFI iterator): New iterator for
SFmode and SImode.
* config/h8300/peepholes.md (memory comparison): Use mode
iterator to consolidate 3 patterns into one.
(stack allocation and stack store): Handle SFmode.  Handle
8 byte allocations.

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

4 years agoc++: decltype of invalid non-dependent expr [PR57943]
Patrick Palka [Fri, 15 May 2020 22:51:11 +0000 (18:51 -0400)]
c++: decltype of invalid non-dependent expr [PR57943]

We sometimes fail to reject an invalid non-dependent operand to decltype
when inside a template, because finish_decltype_type resolves the
decltype to the TREE_TYPE of the operand before we ever instantiate and
fully process the operand.  Fix this by adding a call to
instantiate_non_dependent_expr_sfinae in finish_decltype_type.

gcc/cp/ChangeLog:

PR c++/57943
* semantics.c (finish_decltype_type): Call
instantiate_non_dependent_expr_sfinae on the expression.

gcc/testsuite/ChangeLog:

PR c++/57943
* g++.dg/cpp0x/decltype76.C: New test.

4 years agoUpdate cpplib sv.po.
Joseph Myers [Fri, 15 May 2020 22:40:40 +0000 (22:40 +0000)]
Update cpplib sv.po.

* sv.po: Update.

4 years agolibgo: only build syscall test with -static if it works
Ian Lance Taylor [Fri, 15 May 2020 17:50:57 +0000 (10:50 -0700)]
libgo: only build syscall test with -static if it works

Test whether -static works, and use it if possible.

This time for sure.

For PR go/95061

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/234024

4 years agoc++: Enable coroutines with -std=c++20.
Jason Merrill [Fri, 15 May 2020 21:59:49 +0000 (17:59 -0400)]
c++: Enable coroutines with -std=c++20.

Now that GCC 10 is out it seems time.  People can still choose to disable
coroutines with -fno-coroutines.

This also switches the coroutines testsuite to run in C++20 mode.  The
change to coro.h is only necessary for co-await-11-forwarding.C; we could
alternatively #include <utility> just in that file.

gcc/c-family/ChangeLog
2020-05-15  Jason Merrill  <jason@redhat.com>

* c-opts.c (set_std_cxx20): Set flag_coroutines.

gcc/testsuite/ChangeLog
2020-05-15  Jason Merrill  <jason@redhat.com>

* g++.dg/coroutines/coro.h: Always #include <utility>.
* g++.dg/coroutines/coroutines.exp (DEFAULT_COROFLAGS): Use
-std=c++20.

4 years agoanalyzer: Remove stray semicolon.
Jason Merrill [Fri, 15 May 2020 21:27:15 +0000 (17:27 -0400)]
analyzer: Remove stray semicolon.

4 years agors6000: BU_FUTURE_MISC_2 requires powerpc64
Segher Boessenkool [Fri, 15 May 2020 18:18:57 +0000 (18:18 +0000)]
rs6000: BU_FUTURE_MISC_2 requires powerpc64

BU_FUTURE_MISC_2 is (currently) only used for instructions that require
64-bit registers.

2020-05-15  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/rs6000-builtin.def (BU_FUTURE_MISC_2): Also require
RS6000_BTM_POWERPC64.

4 years agors6000/testsuite: Use the int128 selector where needed
Segher Boessenkool [Fri, 15 May 2020 18:15:26 +0000 (18:15 +0000)]
rs6000/testsuite: Use the int128 selector where needed

Tests that use the __int128 type need to use the int128 selector.

2020-05-15  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/testsuite/
* gcc.target/powerpc/vec-gnb-0.c: Use int128 effective target.
* gcc.target/powerpc/vec-gnb-1.c: Ditto.
* gcc.target/powerpc/vec-gnb-2.c: Ditto.
* gcc.target/powerpc/vec-ternarylogic-8.c: Ditto.
* gcc.target/powerpc/vec-ternarylogic-9.c: Ditto.
* gcc.target/powerpc/vec-ternarylogic-10.c: Ditto.

4 years agors6000/testsuite: Use lp64 in cnttzdm-0.c
Segher Boessenkool [Fri, 15 May 2020 18:12:42 +0000 (18:12 +0000)]
rs6000/testsuite: Use lp64 in cnttzdm-0.c

2020-05-15  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/testsuite/
* gcc.target/powerpc/cnttzdm-0.c: Use lp64.

4 years agors6000/testsuite: Don't use powerpc64 effective target
Segher Boessenkool [Fri, 15 May 2020 16:41:28 +0000 (16:41 +0000)]
rs6000/testsuite: Don't use powerpc64 effective target

The powerpc64 effective target unfortunately does not mean the target
has 64-bit instructions enabled (i.e., -mpowerpc64): instead, it means
that the assembler supports it.

Let's use the lp64 effective target instead for these tests.

2020-05-15  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/testsuite/
* gcc.target/powerpc/cntlzdm-0.c: Use lp64 instead of powerpc64.
* gcc.target/powerpc/cntlzdm-1.c: Ditto.
* gcc.target/powerpc/cnttzdm-1.c: Ditto.
* gcc.target/powerpc/pdep-0.c: Ditto.
* gcc.target/powerpc/pdep-1.c: Ditto.
* gcc.target/powerpc/pextd-0.c: Ditto.
* gcc.target/powerpc/pextd-1.c: Ditto.

4 years agors6000/testsuite: Use -mdejagnu-cpu= instead of -mcpu=
Segher Boessenkool [Fri, 15 May 2020 16:33:20 +0000 (16:33 +0000)]
rs6000/testsuite: Use -mdejagnu-cpu= instead of -mcpu=

A bunch of new cases snuck in.

2020-05-15  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/testsuite/
* gcc.target/powerpc/pdep-0.c: Change -mcpu= to -mdejagnu-cpu=.
* gcc.target/powerpc/pdep-1.c: Ditto.
* gcc.target/powerpc/pextd-0.c: Ditto.
* gcc.target/powerpc/pextd-1.c: Ditto.
* gcc.target/powerpc/pr90763.c: Ditto.
* gcc.target/powerpc/pr91275.c: Ditto.
* gcc.target/powerpc/pr92796.c: Ditto.
* gcc.target/powerpc/pr93658.c: Ditto.
* gcc.target/powerpc/pr93800.c: Ditto.
* gcc.target/powerpc/setbceq.c: Ditto.
* gcc.target/powerpc/setbcge.c: Ditto.
* gcc.target/powerpc/setbcgt.c: Ditto.
* gcc.target/powerpc/setbcle.c: Ditto.
* gcc.target/powerpc/setbclt.c: Ditto.
* gcc.target/powerpc/setbcne.c: Ditto.
* gcc.target/powerpc/setnbceq.c: Ditto.
* gcc.target/powerpc/setnbcge.c: Ditto.
* gcc.target/powerpc/setnbcgt.c: Ditto.
* gcc.target/powerpc/setnbcle.c: Ditto.
* gcc.target/powerpc/setnbclt.c: Ditto.
* gcc.target/powerpc/setnbcne.c: Ditto.
* gcc.target/powerpc/xxgenpc-runnable.c: Ditto.

4 years agoc++: Revert unnecessary parts of fix for [PR90996]
Patrick Palka [Fri, 15 May 2020 18:50:17 +0000 (14:50 -0400)]
c++: Revert unnecessary parts of fix for [PR90996]

The process_init_constructor_array part of my PR90996 patch turns out to
be neither necessary nor sufficient to make the pr90996.C testcase work,
and I wasn't able to come up with a testcase that demonstrates this part
is ever necessary.

gcc/cp/ChangeLog:

Revert:

2020-04-07  Patrick Palka  <ppalka@redhat.com>

PR c++/90996
* typeck2.c (process_init_constructor_array): Propagate
CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element
initializer to the array initializer.

gcc/testsuite/ChangeLog:

PR c++/90996
* g++.dg/cpp1y/pr90996.C: Turn into execution test to verify
that each PLACEHOLDER_EXPR gets correctly resolved.

4 years agoPR c++/93286 - ICE with __is_constructible and variadic template.
Jason Merrill [Fri, 15 May 2020 18:06:48 +0000 (14:06 -0400)]
PR c++/93286 - ICE with __is_constructible and variadic template.

My GCC 10 patch for 93286 fixed the missing piece in tsubst's handling of
lists vs. that in tsubst_copy_and_build, but it would be better to share the
code between them.

gcc/cp/ChangeLog
2020-05-15  Jason Merrill  <jason@redhat.com>

PR c++/93286 - ICE with __is_constructible and variadic template.
* pt.c (tsubst_tree_list): New.
(tsubst, tsubst_copy_and_build): Use it.
* decl2.c (is_late_template_attribute): Handle error_mark_node args.

4 years agox86: Also check if -fcf-protection works
H.J. Lu [Fri, 15 May 2020 16:06:50 +0000 (09:06 -0700)]
x86: Also check if -fcf-protection works

When defaulting CET run-time support to auto, check if -fcf-protection
works.  Even if the stage1 GCC doesn't support -fcf-protection, since
the final GCC does, CET run-time support will be enabled by default if
binutils support CET.

config/

PR bootstrap/95147
* cet.m4 (GCC_CET_FLAGS): Also check if -fcf-protection works
when defaulting to auto.

libatomic/

PR bootstrap/95147
* configure: Regenerated.

libbacktrace/

PR bootstrap/95147
* configure: Regenerated.

libgcc/

PR bootstrap/95147
* configure: Regenerated.

libgfortran/

PR bootstrap/95147
* configure: Regenerated.

libgomp/

PR bootstrap/95147
* configure: Regenerated.

libitm/

PR bootstrap/95147
* configure: Regenerated.

libobjc/

PR bootstrap/95147
* configure: Regenerated.

libphobos/

PR bootstrap/95147
* configure: Regenerated.

libquadmath/

PR bootstrap/95147
* configure: Regenerated.

libsanitizer/

PR bootstrap/95147
* configure: Regenerated.

libssp/

PR bootstrap/95147
* configure: Regenerated.

libstdc++-v3/

PR bootstrap/95147
* configure: Regenerated.

libvtv/

PR bootstrap/95147
* configure: Regenerated.

zlib/

PR bootstrap/95147
* configure: Regenerated.

4 years ago[Fortran] OpenMP 5 – permit more sharing clauses for SIMD (PR94690)
Tobias Burnus [Fri, 15 May 2020 14:40:34 +0000 (16:40 +0200)]
[Fortran] OpenMP 5 – permit more sharing clauses for SIMD (PR94690)

gcc/fortran/
PR fortran/94690
* openmp.c (resolve_omp_do): Permit more clauses for SIMD
iteration variables.

gcc/testsuite/
PR fortran/94690
* gfortran.dg/gomp/openmp-simd-4.f90: New test.

4 years agoi386: Allow SI, DI and TImode pushes from XMM registers
Uros Bizjak [Fri, 15 May 2020 14:22:19 +0000 (16:22 +0200)]
i386: Allow SI, DI and TImode pushes from XMM registers

Also change XMM register constraint from "x" to "v" in FP push insns.

gcc/ChangeLog:

2020-05-15  Uroš Bizjak  <ubizjak@gmail.com>

* config/i386/i386.md (SWI48DWI): New mode iterator.
(*push<mode>2): Allow XMM registers.
(*pushdi2_rex64): Ditto.
(*pushsi2_rex64): Ditto.
(*pushsi2): Ditto.
(push XMM reg splitter): New splitter

(*pushdf) Change "x" operand constraint to "v".
(*pushsf_rex64): Ditto.
(*pushsf): Ditto.

4 years agoc++: Fix thinkos in template_args_equal change.
Nathan Sidwell [Fri, 15 May 2020 13:34:20 +0000 (06:34 -0700)]
c++: Fix thinkos in template_args_equal change.

Arseny Solokha noticed I'd flubbed this patch, and it was not saying
what I thought it was saying.  Unfortunately that didn't break
anything (otherwise I'd've noticed).  Fixed thusly.

* pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.

4 years agotree-optimization/92260 - improve fix
Richard Biener [Fri, 15 May 2020 09:14:53 +0000 (11:14 +0200)]
tree-optimization/92260 - improve fix

This improves the fix for PR92260 changing the number of vector
computation to the canonical one, not needing to look at the
using stmt.

2020-05-15  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92260
* tree-vect-slp.c (vect_get_constant_vectors): Compute
the number of vector stmts in a canonical way.

4 years agoFix clang [-Wmisleading-indentation] in hsa-gen.c.
Martin Liska [Fri, 15 May 2020 10:34:12 +0000 (12:34 +0200)]
Fix clang [-Wmisleading-indentation] in hsa-gen.c.

* hsa-gen.c (get_symbol_for_decl): Fix misleading indentation
warning.

4 years agoWIP amdgcn: use unsigned extend for lshiftrt
Andrew Stubbs [Tue, 28 Apr 2020 19:48:51 +0000 (20:48 +0100)]
WIP amdgcn: use unsigned extend for lshiftrt

This fixes a wrong-code logic error in a previous patch.
Detected by gcc.c-torture/execute/pr53645-2.c.

2020-05-15  Andrew Stubbs  <ams@codesourcery.com>

gcc/
* config/gcn/gcn-valu.md (v<expander><mode>3): Fix unsignedp.

4 years agocontrib: Handle GDB specific test result types
Andrew Burgess [Mon, 11 May 2020 21:32:35 +0000 (22:32 +0100)]
contrib: Handle GDB specific test result types

This commit is for the benefit of GDB, but as the binutils-gdb
repository shares the contrib/ directory with gcc, this commit must
first be applied to gcc then copied back to binutils-gdb.

This commit extends the two scripts contrib/dg-extract-results.{py,sh}
to handle some new, GDB specific test result types.  These test
results types should never appear in GCC, or any other tool that
shares the contrib/ directly, so this change should be harmless.

In this patch series:
  https://sourceware.org/pipermail/gdb-patches/2020-April/167847.html
changes were made in GDB's use of Dejagnu so that two additional
conditions could be detected, these are:

  1. Test names that contain either the build or source paths.  Such
  test names make it difficult to compare the results of two test runs
  of GDB from two different directories, and

  2. Duplicate test names.  Duplicates make it difficult to track down
  exactly which test has failed.

When running Dejagnu on GDB we can now (sometimes) see two additional
test result types matching the above conditions, these are '# of paths
in test names' and '# of duplicate test names'.

If the test is run in parallel mode (make -j...) then these extra test
results will appear in the individual test summary files, but are not
merged into the final summary file.

Additionally, within the summary file there are now two new types of
test summary line, these are 'PATH: ...' and 'DUPLICATE: ...', these
allow users to quickly search the test summary to track down where the
offending test names are.  These lines are similarly not merged into
the unified gdb.sum file after a parallel test run.

This commit extends the dg-extract-results.* scripts to calculate the
totals for the two new result types, and to copy the new test summary
lines into the unified summary file.

contrib/ChangeLog:

* dg-extract-results.py: Handle GDB specific test types.
* dg-extract-results.sh: Likewise.

4 years agotree-optimization/95133 - avoid abnormal edges in path splitting
Richard Biener [Fri, 15 May 2020 07:38:54 +0000 (09:38 +0200)]
tree-optimization/95133 - avoid abnormal edges in path splitting

When path splitting tries to detect a CFG diamond make sure it
is composed of normal (non-EH, not abnormal) edges.  Otherwise
CFG manipulation later may fail.

2020-05-15  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95133
* gimple-ssa-split-paths.c
(find_block_to_duplicate_for_splitting_paths): Check for
normal edges.

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

4 years agoarm: Add support for interrupt routines to reg_needs_saving_p
Christophe Lyon [Mon, 4 May 2020 13:42:03 +0000 (13:42 +0000)]
arm: Add support for interrupt routines to reg_needs_saving_p

reg_needs_saving_p is only used when dealing with non-interrupt
routines, but it makes sense to extend it to support that context too,
and make arm_compute_save_reg0_reg12_mask use it.

Save only live registers for non-leaf functions, but assume a callee
could clobber any register.

2020-05-15  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* config/arm/arm.c (reg_needs_saving_p): Add support for interrupt
routines.
(arm_compute_save_reg0_reg12_mask): Use reg_needs_saving_p.

4 years ago[OpenMP] Fix 'omp exit data' for Fortran arrays (PR 94635)
Tobias Burnus [Fri, 15 May 2020 09:50:34 +0000 (11:50 +0200)]
[OpenMP] Fix 'omp exit data' for Fortran arrays (PR 94635)

gcc/
PR middle-end/94635
* gimplify.c (gimplify_scan_omp_clauses): For MAP_TO_PSET with
OMP_TARGET_EXIT_DATA, use 'release:' unless the associated
item is 'delete:'.

gcc/testsuite
PR middle-end/94635
* gfortran.dg/gomp/target-exit-data.f90: New.

4 years agolibiberty: Handle @live attribute in D demangler.
Iain Buclaw [Fri, 15 May 2020 07:34:36 +0000 (09:34 +0200)]
libiberty: Handle @live attribute in D demangler.

Adds support for demangling D functions annotated with the new
ownership/borrowing system attribute.

libiberty/ChangeLog:

* d-demangle.c (dlang_attributes): Add @live attribute.
* testsuite/d-demangle-expected: Add new tests.

4 years agoi386: Add V2SFmode hadd/hsub instructions [PR95046]
Uros Bizjak [Fri, 15 May 2020 08:02:00 +0000 (10:02 +0200)]
i386: Add V2SFmode hadd/hsub instructions [PR95046]

PFACC/PFNACC 3dNow! instructions got their corresponding SSE alternative
in SSE3, so these can't be implemented with TARGET_MMX_WITH_SSE, which
implies SSE2.  These instructions are only generated via builtins, and
since several 3dNow! insns have no corresponding SSE alternative,
we can't avoid MMX registers with 3dNow! builtins anyway.

Add SSE3/AVX alternatives to the insn pattern, so compiler will be able
to use XMM registers when available, but don't prevent MMX registers,
since they are needed when SSE3 is not active.

Add additional generic insn patterns, used by the combiner to
synthesize horizontal V2SFmode add/sub instructions.  These patterns
are active for TARGET_MMX_WITH_SSE only, and use only XMM registers.

gcc/ChangeLog:

PR target/95046
* config/i386/i386.md (isa): Add sse3_noavx.
(enabled): Handle sse3_noavx.

* config/i386/mmx.md (mmx_haddv2sf3): New expander.
(*mmx_haddv2sf3): Rename from mmx_haddv2sf3.  Add SSE/AVX
alternatives.  Match commutative vec_select selector operands.
(*mmx_haddv2sf3_low): New insn pattern.

(*mmx_hsubv2sf3): Add SSE/AVX alternatives.
(*mmx_hsubv2sf3_low): New insn pattern.

testsuite/ChangeLog:

PR target/95046
* gcc.target/i386/pr95046-8.c: New test.

4 years agoi386: Add V2SFmode hadd/hsub instructions [PR95046]
Uros Bizjak [Fri, 15 May 2020 07:24:38 +0000 (09:24 +0200)]
i386: Add V2SFmode hadd/hsub instructions [PR95046]

PFACC/PFNACC 3dNow! instructions got their corresponding SSE alternative
in SSE3, so these can't be implemented with TARGET_MMX_WITH_SSE, which
implies SSE2.  These instructions are only generated via builtins, and
since several 3dNow! insns have no corresponding SSE alternative,
we can't avoid MMX registers with 3dNow! builtins anyway.

Add SSE3/AVX alternatives to the insn pattern, so compiler will be able
to use XMM registers when available, but don't prevent MMX registers,
since they are needed when SSE3 is not active.

Add additional generic insn patterns, used by the combiner to
synthesize horizontal V2SFmode add/sub instructions.  These patterns
are active for TARGET_MMX_WITH_SSE only, and use only XMM registers.

gcc/ChangeLog:

PR target/95046
* config/i386/i386.md (isa): Add sse3_noavx.
(enabled): Handle sse3_noavx.

* config/i386/mmx.md (mmx_haddv2sf3): New expander.
(*mmx_haddv2sf3): Rename from mmx_haddv2sf3.  Add SSE/AVX
alternatives.  Match commutative vec_select selector operands.
(*mmx_haddv2sf3_low): New insn pattern.

(*mmx_hsubv2sf3): Add SSE/AVX alternatives.
(*mmx_hsubv2sf3_low): New insn pattern.

testsuite/ChangeLog:

PR target/95046
* gcc.target/i386/pr95046-8.c: New test.

4 years agotree-optimization/33315 - common stores during sinking
Richard Biener [Wed, 15 Apr 2020 10:09:01 +0000 (12:09 +0200)]
tree-optimization/33315 - common stores during sinking

This implements commoning of stores to a common successor in
a simple ad-hoc way.  I've decided to put it into the code sinking
pass since, well, it sinks stores.  It's still separate since
it does not really sink code into less executed places.

It's ad-hoc since it does not perform any dataflow or alias analysis
but simply only considers trailing stores in a block, iteratively
though.  If the stores are from different values a PHI node is
inserted to merge them.  gcc.dg/tree-ssa/split-path-7.c shows
that path splitting will eventually undo this very transform,
I've decided to not bother with it and simply disable sinking for
the particular testcase.

Doing this transform is good for code size when the stores are
from constants, once we have to insert PHIs the situation becomes
less clear but it's a transform we do elsewhere as well
(cselim for one), and reversing the transform should be easy.

2020-05-15  Richard Biener  <rguenther@suse.de>

PR tree-optimization/33315
* tree-ssa-sink.c: Include tree-eh.h.
(sink_stats): Add commoned member.
(sink_common_stores_to_bb): New function implementing store
commoning by sinking to the successor.
(sink_code_in_bb): Call it, pass down TODO_cleanup_cfg returned.
(pass_sink_code::execute): Likewise.  Record commoned stores
in statistics.

* gcc.dg/tree-ssa/ssa-sink-13.c: New testcase.
* gcc.dg/tree-ssa/ssa-sink-14.c: Likewise.
* gcc.dg/tree-ssa/split-path-7.c: Disable sinking.

4 years agoFold (add -1; zero_ext; add +1) operations to zero_ext when not overflow(PR37451...
Xionghu Luo [Fri, 15 May 2020 02:03:24 +0000 (21:03 -0500)]
Fold (add -1; zero_ext; add +1) operations to zero_ext when not overflow(PR37451, PR61837)

This "subtract/extend/add" existed for a long time and still annoying us
(PR37451, part of PR61837) when converting from 32bits to 64bits, as the ctr
register is used as 64bits on powerpc64, Andraw Pinski had a patch but
caused some issue and reverted by Joseph S. Myers(PR37451, PR37782).

Andraw:
http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01070.html
http://gcc.gnu.org/ml/gcc-patches/2008-10/msg01321.html
Joseph:
https://gcc.gnu.org/legacy-ml/gcc-patches/2011-11/msg02405.html

We still can do the simplification from "subtract/zero_ext/add" to "zero_ext"
when loop iterations is known to be LT than MODE_MAX (only do simplify
when counter+0x1 NOT overflow).

Bootstrap and regression tested pass on Power8-LE.

gcc/ChangeLog

2020-05-15  Xiong Hu Luo  <luoxhu@linux.ibm.com>

PR rtl-optimization/37451, part of PR target/61837
* loop-doloop.c (doloop_simplify_count): New function.  Simplify
(add -1; zero_ext; add +1) to zero_ext when not wrapping.
(doloop_modify): Call doloop_simplify_count.

gcc/testsuite/ChangeLog

2020-05-15  Xiong Hu Luo  <luoxhu@linux.ibm.com>

PR rtl-optimization/37451, part of PR target/61837
* gcc.target/powerpc/doloop-2.c: New test.

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

4 years agoSkip jit tests for targets that don't support -lgccjit
H.J. Lu [Thu, 14 May 2020 23:34:52 +0000 (16:34 -0700)]
Skip jit tests for targets that don't support -lgccjit

Since libgccjit.so is linked into jit tests, skip jit tests for targets
that don't support -lgccjit.

gcc/

PR jit/94778
* doc/sourcebuild.texi: Document effective target lgccjit.

gcc/testsuite/

PR jit/94778
* jit.dg/jit.exp: Skip jit tests for targets that don't support
-lgccjit.
* lib/target-supports.exp (check_effective_target_lgccjit): New.

4 years agolibiberty: Update D symbol demangling for latest ABI spec.
Iain Buclaw [Thu, 14 May 2020 21:43:17 +0000 (23:43 +0200)]
libiberty: Update D symbol demangling for latest ABI spec.

Some small improvements and clarifications have been done in the D ABI
specification to remove all ambiguities found in the current grammar,
this implementation now more closely resembles the spec, whilst
maintaining compatibility with the old ABI.

Three new rules have been added to the ABI.

1. Back references using 'Q', analogous to C++ substitutions, compresses
   repeated identifiers, types, and template symbol and value parameters.

2. Template aliases to externally mangled symbols are prefixed with 'X'.
   This includes any symbol that isn't extern(D), or has its name
   overriden with pragma(mangle).  This fixes an ambiguity where it was
   not clear whether 'V' was an encoded calling convention, or the next
   template value parameter.

3. Alias parameters, templates, and tuple symbols no longer encode the
   symbol length of its subpart.  Tuples are now terminated with 'Z'.
   This fixes another ambiguity where the first character of the mangled
   name can be a digit as well, so the demangler had to figure out where
   to split the two adjacent numbers by trying out each combination.

libiberty/ChangeLog:

* d-demangle.c (enum dlang_symbol_kinds): Remove enum.
(struct dlang_info): New struct
(dlang_decode_backref): New function.
(dlang_backref): New function.
(dlang_symbol_backref): New function.
(dlang_type_backref): New function.
(dlang_symbol_name_p): New function.
(dlang_function_type_noreturn): New function.
(dlang_function_type): Add 'info' parameter.  Decode function type
with dlang_function_type_noreturn.
(dlang_function_args): Add 'info' parameter.
(dlang_type): Add 'info' parameter.  Handle back referenced types.
(dlang_identifier): Replace 'kind' parameter with 'info'.  Handle back
referenced symbols.  Split off decoding of plain identifiers to...
(dlang_lname): ...here.
(dlang_parse_mangle): Replace 'kind' parameter with 'info'.  Decode
function type and return with dlang_type.
(dlang_parse_qualified): Replace 'kind' parameter with 'info', add
'suffix_modifier' parameter.  Decode function type with
dlang_function_type_noreturn.
(dlang_parse_tuple): Add 'info' parameter.
(dlang_template_symbol_param): New function.
(dlang_template_args): Add 'info' parameter.  Decode symbol parameter
with dlang_template_symbol_param.  Handle back referenced values, and
externally mangled parameters.
(dlang_parse_template): Add 'info' parameter.
(dlang_demangle_init_info): New function.
(dlang_demangle): Initialize and pass 'info' parameter.
* testsuite/d-demangle-expected: Add new tests.

Co-Authored-By: Rainer Schuetze <r.sagitario@gmx.de>
4 years agoc++: Fix deferred noexcept on constructor [PR93901].
Jason Merrill [Thu, 14 May 2020 15:15:27 +0000 (11:15 -0400)]
c++: Fix deferred noexcept on constructor [PR93901].

My change in r10-4394 to only update clones when we actually instantiate a
deferred noexcept-spec broke this because deferred parsing updates the
primary function but not the clones.  For GCC 10 I just reverted that
change; this patch adjusts maybe_instantiate_noexcept to update only the
clone passed as the argument.

gcc/cp/ChangeLog
2020-05-14  Jason Merrill  <jason@redhat.com>

PR c++/93901
* pt.c (maybe_instantiate_noexcept): Change clone handling.

4 years agolibgo: only build syscall test with -static on GNU/Linux
Ian Lance Taylor [Thu, 14 May 2020 19:50:30 +0000 (12:50 -0700)]
libgo: only build syscall test with -static on GNU/Linux

For PR go/95061

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/234019

4 years agoamdgcn: fix vcc clobber in vector load/store
Andrew Stubbs [Wed, 13 May 2020 15:05:54 +0000 (16:05 +0100)]
amdgcn: fix vcc clobber in vector load/store

This switches the code that expands scalar addresses to vectors of addresses
from using VCC to using CC_SAVE_REG, for the lo-part to hi-part carry values.
These were fine in code expanded in earlier passes, but addresses expanded
late, such as for stack spills or reloads, could clobber live VCC values,
causing execution failures.

This is the first target-specific testcase for GCN, so the new .exp file is
included.

2020-05-14  Andrew Stubbs  <ams@codesourcery.com>

gcc/
* config/gcn/gcn-valu.md (add<mode>3_zext_dup): Change to a
define_expand, and rename the original to ...
(add<mode>3_vcc_zext_dup): ... this, and add a custom VCC operand.
(add<mode>3_zext_dup_exec): Likewise, with ...
(add<mode>3_vcc_zext_dup_exec): ... this.
(add<mode>3_zext_dup2): Likewise, with ...
(add<mode>3_zext_dup_exec): ... this.
(add<mode>3_zext_dup2_exec): Likewise, with ...
(add<mode>3_zext_dup2): ... this.
* config/gcn/gcn.c (gcn_expand_scalar_to_vector_address): Switch
addv64di3_zext* calls to use addv64di3_vcc_zext*.

gcc/testsuite/
* testsuite/gcc.target/gcn/gcn.exp: New file.
* testsuite/gcc.target/gcn/vcc-clobber.c: New file.

4 years agoi386: Add V2DFmode float trunc/extend functions [PR95046]
Uros Bizjak [Thu, 14 May 2020 17:51:40 +0000 (19:51 +0200)]
i386: Add V2DFmode float trunc/extend functions [PR95046]

gcc/ChangeLog:

PR target/95046
* config/i386/sse.md (truncv2dfv2df2): New insn pattern.
(extendv2sfv2df2): Ditto.

testsuite/ChangeLog:

PR target/95046
* gcc.target/i386/pr95046-7.c: New test.

4 years agoc++: Missing SFINAE with lookup_fnfields [PR78446]
Patrick Palka [Thu, 14 May 2020 16:56:18 +0000 (12:56 -0400)]
c++: Missing SFINAE with lookup_fnfields [PR78446]

Here we're failing to do SFINAE in build_op_call when looking up the
class's operator() via lookup_fnfields, which calls lookup_member always
with complain=tf_warning_or_error; from there we would complain
about an ambiguous lookup for operator().

This patch fixes this by adding a tsubst_flags_t parameter to
lookup_fnfields and adjusting all its callers appropriately.

gcc/cp/ChangeLog:

PR c++/78446
* call.c (build_op_call): Pass complain to lookup_fnfields.
(build_special_member_call): Likewise.
* class.c (type_requires_array_cookie): Pass tf_warning_or_error
to lookup_fnfields.
* cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
* except.c (build_throw): Pass tf_warning_or_error to
lookup_fnfields.
* init.c (build_new_1): Pass complain to lookup_fnfields.
* method.c (locate_fn_flags): Likewise.
* name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
to lookup_fnfields.
* pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
* search.c (lookup_fnfields): New 'complain' parameter.  Pass it
to lookup_member.

gcc/testsuite/ChangeLog:

PR c++/78446
* g++.dg/template/sfinae31.C: New test.

4 years agoRemoved double ChangeLog entries from previous commit.
Thomas Koenig [Thu, 14 May 2020 16:37:18 +0000 (18:37 +0200)]
Removed double ChangeLog entries from previous commit.

4 years agoAdd early return for invalid STATUS for close.
Thomas Koenig [Thu, 14 May 2020 16:30:27 +0000 (18:30 +0200)]
Add early return for invalid STATUS for close.

2020-05-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR libfortran/95119
* io/close.c (close_status): Add CLOSE_INVALID.
(st_close): Return early on invalid STATUS parameter.

2020-05-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR libfortran/95119
* testsuite/libgomp.fortran/close_errors_1.f90: New test.

4 years agox86: Default CET run-time support to auto
H.J. Lu [Thu, 14 May 2020 15:25:39 +0000 (08:25 -0700)]
x86: Default CET run-time support to auto

CET has been added since GCC 8.  This patch defaults CET run-time support
to auto.  It enables CET run-time support if asssembler supports CET
instructions and multi-byte NOPs are enabled via SSE2.

config/

* cet.m4 (GCC_CET_FLAGS): Change default to auto.

gcc/

* configure: Regenerated.

libatomic/

* configure: Regenerated.

libbacktrace/

* configure: Regenerated.

libcc1/

* configure: Regenerated.

libcpp/

* configure: Regenerated.

libdecnumber/

* configure: Regenerated.

libgcc/

* configure: Regenerated.

libgfortran/

* configure: Regenerated.

libgomp/

* configure: Regenerated.

libitm/

* configure: Regenerated.

libobjc/

* configure: Regenerated.

libquadmath/

* configure: Regenerated.

libsanitizer/

* configure: Regenerated.

libssp/

* configure: Regenerated.

libstdc++-v3/

* configure: Regenerated.

libvtv/

* configure: Regenerated.

zlib/

* configure: Regenerated.

4 years agoarm: Factorize several occurrences of the same code into reg_needs_saving_p
Christophe Lyon [Mon, 4 May 2020 13:41:34 +0000 (13:41 +0000)]
arm: Factorize several occurrences of the same code into reg_needs_saving_p

The same code pattern occurs in several functions, so it seems cleaner
to move it into a dedicated function.

2020-05-14  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* config/arm/arm.c (reg_needs_saving_p): New function.
(use_return_insn): Use reg_needs_saving_p.
(arm_get_vfp_saved_size): Likewise.
(arm_compute_frame_layout): Likewise.
(arm_save_coproc_regs): Likewise.
(thumb1_expand_epilogue): Likewise.
(arm_expand_epilogue_apcs_frame): Likewise.
(arm_expand_epilogue): Likewise.

4 years agoarm.c: Clarify error message in thumb1_expand_prologue
Christophe Lyon [Tue, 5 May 2020 14:18:13 +0000 (14:18 +0000)]
arm.c: Clarify error message in thumb1_expand_prologue

While running the tests with -march=armv5t -mthumb, I came across this
error message which I think could be clearer.

2020-05-14  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* config/arm/arm.c (thumb1_expand_prologue): Update error message.

4 years agoc++: Missed c++2a->20 change
Nathan Sidwell [Thu, 14 May 2020 15:04:59 +0000 (08:04 -0700)]
c++: Missed c++2a->20 change

Jason missed a c++2a mention.  I couldn't resist changing the loop
following to place the initializers inside the fors.

* parser.c (cp_parser_diagnose_invalid_typename): Mention
std=c++20 not 2a, reformat dependent binfo inform loops.

4 years agoc++: Simplify tsubst_template_decl
Nathan Sidwell [Thu, 14 May 2020 14:33:13 +0000 (07:33 -0700)]
c++: Simplify tsubst_template_decl

tsubst_template_decl's control flow was also confusing.  This reorders
and flattens some of the conditionals.

* pt.c (tsubst_template_decl): Reorder and commonize some control
paths.

4 years agoc++: Simplify tsubst_friend_function
Nathan Sidwell [Thu, 14 May 2020 14:22:54 +0000 (07:22 -0700)]
c++: Simplify tsubst_friend_function

tsubst_friend_function's control flow was a little complicated.  This
simplifies it, primarily by using more RAII.

* pt.c (tsubst_friend_function): Simplify control flow.

4 years agoc++: simplify lookup_template_class_1
Nathan Sidwell [Thu, 14 May 2020 14:20:35 +0000 (07:20 -0700)]
c++: simplify lookup_template_class_1

We were checking TYPE_NAME and then copying it if not null.  Just copy
it, and then see if we got null.

* pt.c (lookup_template_class_1): Remove unnecessary else by
simply grabbing TYPE_NAME earlier.

4 years agoc++: Adjust push_template_decl_real
Nathan Sidwell [Thu, 14 May 2020 14:13:54 +0000 (07:13 -0700)]
c++: Adjust push_template_decl_real

Push_template_decl_real's friend-pushing logic was confusing me.  This
is more understandable.  Fix a latent type bug I disovered.

* pt.c (push_template_decl_real): Adjust friend pushing logic.
Reinit template type.

4 years agoc++: Improve build_template_decl
Nathan Sidwell [Thu, 14 May 2020 13:39:29 +0000 (06:39 -0700)]
c++: Improve build_template_decl

I discovered all the users of build_template_decl were explicitly
setting the RESULT and TYPE fields of the built decl.  Let's just have
build_template_decl do that in the first place.

* pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
TREE_TYPE here ...
(process_partial_specialization): ... not here ...
(push_template_decl_real, add_inherited_template_parms)
(build_deduction_guide): ... or here.

4 years agoAdd tests for gcc-changelog.
Martin Liska [Thu, 14 May 2020 11:59:36 +0000 (13:59 +0200)]
Add tests for gcc-changelog.

* gcc-changelog/test_email.py: New file.
* gcc-changelog/test_patches.txt: New file.

4 years agoi386: Add V2DFmode conversion functions [PR95046]
Uros Bizjak [Thu, 14 May 2020 11:47:33 +0000 (13:47 +0200)]
i386: Add V2DFmode conversion functions [PR95046]

gcc/ChangeLog:

PR target/95046
* config/i386/sse.md (sse2_cvtpi2pd): Add memory to alternative 1.

(floatv2siv2df2): New expander.
(floatunsv2siv2df2): New insn pattern.

(fix_truncv2dfv2si2): New expander.
(fixuns_truncv2dfv2si2): New insn pattern.

testsuite/ChangeLog:

PR target/95046
* gcc.target/i386/pr95046-6.c: New test.

4 years agoaarch64: Fix arm_sve_vector_bits on typedefs [PR95105]
Richard Sandiford [Thu, 14 May 2020 11:20:32 +0000 (12:20 +0100)]
aarch64: Fix arm_sve_vector_bits on typedefs [PR95105]

Compiling this testcase with -march=armv8.2-a+sve
-msve-vector-bits=512:

----------------------------------------------------------
typedef __SVFloat32_t foo;
typedef foo bar __attribute__((arm_sve_vector_bits(512)));
template<typename T> struct s { T x; };
extern s<bar> a;
bar &b = a.x;
----------------------------------------------------------

gave the bogus error:

  cannot bind non-const lvalue reference of type ‘bar&’ to an rvalue
  of type ‘bar’

The testcase works if the attribute is applied directly
to __SVFloat32_t instead of via foo.

This shows a more general problem with the way that we were handling
the arm_sve_vector_bits attribute: we started by building a distinct
copy of the type to which the attribute was applied, instead of starting
with its main variant.  This new type then became its own main variant,
meaning that the relationship between types that have the attribute
could be different from the relationship between types that don't have
the attribute.

This patch instead copies the main variant of the original type and then
reapplies all the differences.

2020-05-14  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR target/95105
* config/aarch64/aarch64-sve-builtins.cc
(handle_arm_sve_vector_bits_attribute): Create a copy of the
original type's TYPE_MAIN_VARIANT, then reapply all the differences
between the original type and its main variant.

gcc/testsuite/
PR target/95105
* gcc.target/aarch64/sve/acle/general/attributes_8.c: New test.
* g++.target/aarch64/sve/acle/general-c++/attributes_1.C: Likewise.