]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
5 years agoFix goacc/finalize-1.f tree dump-scanning for -m32
Tobias Burnus [Tue, 14 Jul 2020 14:50:18 +0000 (16:50 +0200)] 
Fix goacc/finalize-1.f tree dump-scanning for -m32

gcc/testsuite/ChangeLog:

* gfortran.dg/goacc/finalize-1.f: Relax scan-tree-dump-times
pattern to work on 32bit-pointer systems.

(cherry picked from commit 524862db444b6544c6dc87c5f06f351100ecf50d)

5 years ago[OpenMP, Fortran] Add structure/derived-type element mapping
Tobias Burnus [Tue, 14 Jul 2020 11:54:29 +0000 (13:54 +0200)] 
[OpenMP, Fortran] Add structure/derived-type element mapping

gcc/fortran/ChangeLog:

* openmp.c (gfc_match_omp_clauses): Match also derived-type
component refs in OMP_CLAUSE_MAP.
(resolve_omp_clauses): Resolve those.
* trans-openmp.c (gfc_trans_omp_array_section, gfc_trans_omp_clauses):
Handle OpenMP structure-element mapping.
(gfc_trans_oacc_construct, gfc_trans_oacc_executable_directive,
(gfc_trans_oacc_combined_directive, gfc_trans_oacc_declare): Update
add openacc=true in gfc_trans_omp_clauses call.

gcc/testsuite/ChangeLog:

* gfortran.dg/goacc/finalize-1.f: Update dump scan pattern.
* gfortran.dg/gomp/map-1.f90: Update dg-error.
* gfortran.dg/gomp/map-2.f90: New test.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/struct-elem-map-1.f90: New test.

(cherry picked from commit 102502e32ea4e8a75d6b252ba319d09d735d9aa7)

5 years ago[Fortran, OpenMP] Fix allocatable-components check (PR67311)
Tobias Burnus [Tue, 14 Jul 2020 11:00:44 +0000 (13:00 +0200)] 
[Fortran, OpenMP] Fix allocatable-components check (PR67311)

gcc/fortran/ChangeLog:

PR fortran/67311
* trans-openmp.c (gfc_has_alloc_comps): Return false also for
pointers to arrays.

libgomp/ChangeLog:

PR fortran/67311
* testsuite/libgomp.fortran/target-map-1.f90: New test.

(cherry picked from commit 174e79bf73331b41b7a14dffd45ed8293487f0e0)

5 years agoAdd ChangeLog.omp for mainline cherry-pick
Tobias Burnus [Tue, 14 Jul 2020 10:47:36 +0000 (12:47 +0200)] 
Add ChangeLog.omp for mainline cherry-pick

Commit b8e1b003ad11e635a5b0984b3ad91b739ef12ca5 of 2020-06-16 added
the mainline commit 12df77ab6df4b91d4770240bcc4ab443e4bb18b9 but missed
to add ChangeLog.omp entries (which are autogenerated on mainline).

Updated: gcc/fortran/ChangeLog.omp, gcc/testsuite/ChangeLog.omp,
and libgomp/ChangeLog.omp.

5 years agoMerge remote-tracking branch 'origin/releases/gcc-10' into devel/omp/gcc-10
Tobias Burnus [Tue, 14 Jul 2020 09:29:09 +0000 (11:29 +0200)] 
Merge remote-tracking branch 'origin/releases/gcc-10' into devel/omp/gcc-10

Merge up to bafecb520a5563936750b117f5416d13a9159590 (June 30, 2020)

5 years agoopenacc: Helper functions for enter/exit data using single mapping
Julian Brown [Tue, 30 Jun 2020 09:15:56 +0000 (02:15 -0700)] 
openacc: Helper functions for enter/exit data using single mapping

This patch factors out the parts of goacc_enter_datum and
goacc_exit_datum that can be shared with goacc_enter_data_internal
and goacc_exit_data_internal respectively (in the next patch),
without overloading function return values or complicating code paths
unnecessarily.

2020-07-10  Julian Brown  <julian@codesourcery.com>
    Thomas Schwinge  <thomas@codesourcery.com>

libgomp/
* oacc-mem.c (goacc_map_var_existing): New function.
(goacc_enter_datum): Use above function.
(goacc_exit_datum_1): New function.
(goacc_exit_datum): Use above function.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
(cherry picked from commit cb7effde6f36b43d50c8cd7f86eaa05937da7205)

5 years agoopenacc: Set bias to zero for explicit attach/detach clauses in C and C++
Julian Brown [Tue, 9 Jun 2020 13:21:34 +0000 (06:21 -0700)] 
openacc: Set bias to zero for explicit attach/detach clauses in C and C++

This is a fix for the pointer (or array) size inadvertently being used
for the bias with attach and detach mapping kinds, for both C and C++.

2020-07-09  Julian Brown  <julian@codesourcery.com>
    Thomas Schwinge  <thomas@codesourcery.com>

gcc/c/
PR middle-end/95270
* c-typeck.c (c_finish_omp_clauses): Set OMP_CLAUSE_SIZE (bias) to zero
for standalone attach/detach clauses.

gcc/cp/
PR middle-end/95270
* semantics.c (finish_omp_clauses): Likewise.

include/
PR middle-end/95270
* gomp-constants.h (gomp_map_kind): Expand comment for attach/detach
mapping kinds.

gcc/testsuite/
PR middle-end/95270
* c-c++-common/goacc/mdc-1.c: Update expected dump output for zero
bias.

libgomp/
PR middle-end/95270
* testsuite/libgomp.oacc-c-c++-common/pr95270-1.c: New test.
* testsuite/libgomp.oacc-c-c++-common/pr95270-2.c: New test.

(cherry picked from commit 0d00fe404c162ad0cf922ca8455aa23a74042b63)

5 years agoopenacc: GOMP_MAP_ATTACH handling in find_group_last
Julian Brown [Thu, 11 Jun 2020 13:43:59 +0000 (06:43 -0700)] 
openacc: GOMP_MAP_ATTACH handling in find_group_last

Arrange for GOMP_MAP_ATTACH to be grouped together with a preceding
GOMP_MAP_TO_PSET or other "to" data movement clause, except in cases
where an explicit "attach" clause is used.

2020-07-09  Julian Brown  <julian@codesourcery.com>

include/
* gomp-constants.h (gomp_map_kind): Update comment for GOMP_MAP_TO_PSET.

libgomp/
* oacc-mem.c (find_group_last): Group data-movement clauses
(GOMP_MAP_TO_PSET, GOMP_MAP_TO, etc.) together with a subsequent
GOMP_MAP_ATTACH.  Allow standalone GOMP_MAP_ATTACH also.

(cherry picked from commit 8d2e5026d22b3f30e7df7adfd4ebf4ebc1e77e2d)

5 years agoopenacc: Fortran derived-type mapping fix
Julian Brown [Wed, 3 Jun 2020 21:25:19 +0000 (14:25 -0700)] 
openacc: Fortran derived-type mapping fix

Fix a bug with mapping Fortran components which themselves have derived
types in the OpenACC 2.5+ manual deep-copy support.

2020-07-09  Julian Brown  <julian@codesourcery.com>

gcc/fortran/
* trans-openmp.c (gfc_trans_omp_clauses): Use 'inner' not 'decl' for
derived type members which themselves have derived types.

gcc/testsuite/
* gfortran.dg/goacc/mapping-tests-3.f90: New test.
* gfortran.dg/goacc/mapping-tests-4.f90: New test.

(cherry picked from commit ac8996edb14eef0a15cd0ce850fde2be5e227e69)

5 years agoipa-fnsummary: Fix ICE with switch predicates [PR96130]
Jakub Jelinek [Mon, 13 Jul 2020 16:25:53 +0000 (18:25 +0200)] 
ipa-fnsummary: Fix ICE with switch predicates [PR96130]

The following testcase ICEs since r10-3199.
There is a switch with default label, where the controlling expression has
range just 0..7 and there are case labels for all those 8 values, but
nothing has yet optimized away the default.
Since r10-3199, set_switch_stmt_execution_predicate sets the switch to
default label's edge's predicate to a false predicate and then
compute_bb_predicates propagates the predicates through the cfg, but false
predicates aren't really added.  The caller of compute_bb_predicates
in one place handles NULL bb->aux as false predicate:
      if (fbi.info)
{
  if (bb->aux)
    bb_predicate = *(predicate *) bb->aux;
  else
    bb_predicate = false;
}
      else
bb_predicate = true;
but then in two further spots that the patch below is changing
it assumes bb->aux must be non-NULL.  Those two spots are guarded by a
condition that is only true if fbi.info is non-NULL, so I think the right
fix is to treat NULL aux as false predicate in those spots too.

2020-07-13  Jakub Jelinek  <jakub@redhat.com>

PR ipa/96130
* ipa-fnsummary.c (analyze_function_body): Treat NULL bb->aux
as false predicate.

* gcc.dg/torture/pr96130.c: New test.

(cherry picked from commit 776e48e0931db69f158f40e5cb8e15463d879a42)

5 years agoAvoid printing informational notes when -Wmismatched-tags is suppressed in system...
Martin Sebor [Mon, 13 Jul 2020 15:32:40 +0000 (09:32 -0600)] 
Avoid printing informational notes when -Wmismatched-tags is suppressed in system headers (PR c++/96063)

Related:
PR c++/96063 - mismatched-tags warnings in stdlib headers

gcc/cp/ChangeLog:

PR c++/96063
* parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
if warning_at returns nonzero.

gcc/testsuite/ChangeLog:

PR c++/96063
* g++.dg/warn/Wmismatched-tags-7.C: New test.
* g++.dg/warn/Wmismatched-tags-8.C: New test.

5 years agoc++: Fix tentative parsing of enum-specifier [PR96077]
Marek Polacek [Fri, 10 Jul 2020 00:44:05 +0000 (20:44 -0400)] 
c++: Fix tentative parsing of enum-specifier [PR96077]

Here's an interesting issue: in this code a ) is missing:

  enum { E = (2 } e;

but we compile the code anyway, and E is set to 0 in build_enumerator,
which is sneaky.

The problem is that cp_parser_enum_specifier parses tentatively, because
when we see the enum keyword, we don't know yet if we'll find an
enum-specifier, opaque-enum-declaration, or elaborated-enum-specifier.

In this test when we call cp_parser_enumerator_list we're still parsing
tentatively, and as a consequence, parens.require_close (parser) in
cp_parser_primary_expression doesn't report any errors.  But we only go
on to parse the enumerator-list after we've seen a {, at which point we
might as well commit -- we know we're dealing with an enum-specifier.

gcc/cp/ChangeLog:

PR c++/96077
* parser.c (cp_parser_enum_specifier): Commit to tentative parse
after we've seen an opening brace.

gcc/testsuite/ChangeLog:

PR c++/96077
* g++.dg/parse/enum14.C: New test.

(cherry picked from commit 4fd124a23664c712f1bb1a7e91fa23fe83d72c0b)

5 years agofix global variable alignment for testcase gcc.dg/torture/pr96133.c
Richard Biener [Mon, 13 Jul 2020 09:41:16 +0000 (11:41 +0200)] 
fix global variable alignment for testcase gcc.dg/torture/pr96133.c

The testcase was errorneously accessing the global variable via a
type that might require bigger alignment than provided.  Fix that
via an appropriate attribute.

2020-07-13  Richard Biener  <rguenther@suse.de>

PR testsuite/96180
* gcc.dg/torture/pr96133.c: Align global variable.

(cherry picked from commit 7a4770f0394751860ee54520b23007938907ac33)

5 years agoPR94600: fix volatile access to the whole of a compound object.
Hans-Peter Nilsson [Sun, 5 Jul 2020 18:50:52 +0000 (20:50 +0200)] 
PR94600: fix volatile access to the whole of a compound object.

The store to the whole of each volatile object was picked apart
like there had been an individual assignment to each of the
fields.  Reads were added as part of that; see PR for details.
The reads from volatile memory were a clear bug; individual
stores questionable.  A separate patch clarifies the docs.

gcc:

2020-07-09  Richard Biener  <rguenther@suse.de>

PR middle-end/94600
* expr.c (expand_constructor): Make a temporary also if we're
storing to volatile memory.

gcc/testsuite:

2020-07-09  Hans-Peter Nilsson  <hp@axis.com>

PR middle-end/94600
* gcc.dg/pr94600-1.c, gcc.dg/pr94600-2.c, gcc.dg/pr94600-3.c,
gcc.dg/pr94600-4.c, gcc.dg/pr94600-5.c, gcc.dg/pr94600-6.c,
gcc.dg/pr94600-7.c, gcc.dg/pr94600-8.c: New tests.

(cherry picked from commit a4aca1edaf37d43b2b7e9111825837a7a317b1b0)

5 years agoDaily bump.
GCC Administrator [Mon, 13 Jul 2020 00:16:52 +0000 (00:16 +0000)] 
Daily bump.

5 years agotree-cfg: Fix ICE with switch stmt to unreachable opt and forced labels [PR95857]
Jakub Jelinek [Thu, 2 Jul 2020 09:38:20 +0000 (11:38 +0200)] 
tree-cfg: Fix ICE with switch stmt to unreachable opt and forced labels [PR95857]

The following testcase ICEs, because during the cfg cleanup, we see:
  switch (i$e_11) <default: <L12> [33.33%], case -3: <lab2> [33.33%], case 0: <L10> [33.33%], case 2: <lab2> [33.33%]>
...
lab2:
  __builtin_unreachable ();
where lab2 is FORCED_LABEL.  The way it works, we go through the case labels
and when we reach the first one that points to gimple_seq_unreachable*
basic block, we remove the edge (if any) from the switch bb to the bb
containing the label and bbs reachable only through that edge we've just
removed.  Once we do that, we must throw away all other cases that use
the same label (or some other labels from the same bb we've removed the edge
to and the bb).  To avoid quadratic behavior, this is not done by walking
all remaining cases immediately before removing, but only when processing
them later.
For normal labels this works, fine, if the label is in a deleted bb, it will
have NULL label_to_block and we handle that case, or, if the unreachable bb
has some other edge to it, only the edge will be removed and not the bb,
and again, find_edge will not find the edge and we only remove the case.
And if a label would be to some other block, that other block wouldn't have
been removed earlier because there would be still an edge from the switch
block.
Now, FORCED_LABEL (and I think DECL_NONLOCAL too) break this, because
those labels aren't removed, but instead moved to some surrounding basic
block.  So, when we later process those, when their gimple_seq_unreachable*
basic block is removed, label_to_block will return some unrelated block
(in the testcase the switch bb), so we decide to keep the case which doesn't
seem to be unreachable, but we don't really have an edge from the switch
block to the block the label got moved to.

I thought first about punting in gimple_seq_unreachable* on
FORCED_LABEL/DECL_NONLOCAL labels, but that might penalize even code that
doesn't care, so this instead just makes sure that for
FORCED_LABEL/DECL_NONLOCAL labels that are being removed (and thus moved
randomly) we remember in a hash_set the fact that those labels should be
treated as removed for the purpose of the optimization, and later on
handle those labels that way.

2020-07-02  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/95857
* tree-cfg.c (group_case_labels_stmt): When removing an unreachable
base_bb, remember all forced and non-local labels on it and later
treat those as if they have NULL label_to_block.  Formatting fix.
Fix a comment typo.

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

(cherry picked from commit 00f24f56732861d09a9716fa5b6b8a96c2289143)

5 years agoDaily bump.
GCC Administrator [Sun, 12 Jul 2020 00:16:53 +0000 (00:16 +0000)] 
Daily bump.

5 years agoDaily bump.
GCC Administrator [Sat, 11 Jul 2020 00:17:06 +0000 (00:17 +0000)] 
Daily bump.

5 years agors6000: Fix __builtin_altivec_mask_for_load to use correct type
Bill Seurer [Fri, 10 Jul 2020 22:30:26 +0000 (17:30 -0500)] 
rs6000: Fix __builtin_altivec_mask_for_load to use correct type

gcc/ChangeLog:

PR target/95581
* config/rs6000/rs6000-call.c: Add new type v16qi_ftype_pcvoid.
(altivec_init_builtins) Change __builtin_altivec_mask_for_load to use
v16qi_ftype_pcvoid with correct number of parameters.

(cherry picked from commit c6b7ba5de624f2a17d799bac5ff017cd065ce035)

5 years agors6000: Add execution tests for mma builtins [v4]
Aaron Sawdey [Tue, 30 Jun 2020 19:26:26 +0000 (14:26 -0500)] 
rs6000: Add execution tests for mma builtins [v4]

This patch adds execution tests that use the MMA builtins and
check for the right answer, and new tests that checks whether
__builtin_cpu_supports and __builtin_cpu_is return sane
answers for power10.

2020-06-30  Rajalakshmi Srinivasaraghavan  <rajis@linux.vnet.ibm.com>
    Aaron Sawdey  <acsawdey@linux.ibm.com>

gcc/testsuite/
* gcc.target/powerpc/p10-identify.c: New file.
* gcc.target/powerpc/p10-arch31.c: New file.
* gcc.target/powerpc/mma-single-test.c: New file.
* gcc.target/powerpc/mma-double-test.c: New file.

(cherry picked from commit ed1d3639e42dccc9372f11c6231c3ffe0589fd1c)

5 years agolibgo: update to Go 1.14.4 release
Ian Lance Taylor [Fri, 10 Jul 2020 17:51:40 +0000 (10:51 -0700)] 
libgo: update to Go 1.14.4 release

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

5 years agoAarch64: Change costs for TX2 to expose more vectorization opportunities
Anton Youdkevitch [Fri, 10 Jul 2020 18:13:02 +0000 (19:13 +0100)] 
Aarch64: Change costs for TX2 to expose more vectorization opportunities

Make the costs such that they do not exaclty reflect
the actual instructions costs from the manual but make
the codegen emit the code we want it to.

gcc/ChangeLog:

* config/aarch64/aarch64.c (thunderx2t99_regmove_cost,
thunderx2t99_vector_cost): Likewise.

5 years agors6000: fix power10_hw test
Aaron Sawdey [Tue, 7 Jul 2020 17:48:56 +0000 (12:48 -0500)] 
rs6000: fix power10_hw test

The code snippet for this test was returning 1 if power10
instructions executed correctly. It should return 0 if the
test passes.

2020-07-07  Aaron Sawdey  <acsawdey@linux.ibm.com>

gcc/testsuite/
* lib/target-supports.exp (check_power10_hw_available):
Return 0 for passing test.

(cherry picked from commit 7126583af5d29235584b51b3b05eeaba2adef024)

5 years agors6000: Allow MMA built-in initialization regardless of compiler options
Peter Bergner [Thu, 9 Jul 2020 20:52:59 +0000 (15:52 -0500)] 
rs6000: Allow MMA built-in initialization regardless of compiler options

Built-in initialization occurs only once and fairly early, when the
command line options are in force.  If the -mcpu=<CPU> is pre-power10,
then we fail to initialize the MMA built-ins, so they are not
available to call in a #pragma target/attribute target function.
The fix is to basically always (on server type cpus) initialize the MMA
built-ins so we can use them in #pragma target/attribute target functions.

2020-07-09  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/96125
* config/rs6000/rs6000-call.c (rs6000_init_builtins): Define the MMA
specific types __vector_quad and __vector_pair, and initialize the
MMA built-ins if TARGET_EXTRA_BUILTINS is set.
(mma_init_builtins): Don't test for mask set in rs6000_builtin_mask.
Remove now unneeded mask variable.
* config/rs6000/rs6000.c (rs6000_option_override_internal): Add the
OPTION_MASK_MMA flag for power10 if not already set.

gcc/testsuite/
PR target/96125
* gcc.target/powerpc/pr96125.c: New test.

(cherry picked from commit fd263be4b523ff1b7f7dda49d856cc57221e8d21)

5 years ago[PATCH, rs6000]Add support to enable vmsumudm behind vec_msum builtin.
Will Schmidt [Thu, 18 Jun 2020 20:14:00 +0000 (15:14 -0500)] 
[PATCH, rs6000]Add support to enable vmsumudm behind vec_msum builtin.

gcc/ChangeLog:

2020-07-08  Will Schmidt  <will_schmidt@vnet.ibm.com>

* config/rs6000/altivec.h (vec_vmsumudm): New define.
* config/rs6000/altivec.md (UNSPEC_VMSUMUDM): New unspec.
  (altivec_vmsumudm): New define_insn.
* config/rs6000/rs6000-builtin.def (altivec_vmsumudm): New BU_ALTIVEC_3
  entry. (vmsumudm): New BU_ALTIVEC_OVERLOAD_3 entry.
* config/rs6000/rs6000-call.c (altivec_overloaded_builtins): Add entries for
  ALTIVEC_BUILTIN_VMSUMUDM variants of vec_msum.
* doc/extend.texi: Add document for vmsumudm behind vmsum.

gcc/testsuite/ChangeLog:

2020-07-08  Will Schmidt  <will_schmidt@vnet.ibm.com>

* gcc.target/powerpc/builtins-msum-runnable.c: New test.
* gcc.target/powerpc/vsx-builtin-msum.c: New test.

(cherry picked from commit c1a57681a64150d2fc336ba8e055c5f82e3737e8)

5 years agoc++: [[no_unique_address]] fixes. [PR96105]
Jason Merrill [Thu, 9 Jul 2020 19:11:12 +0000 (15:11 -0400)] 
c++: [[no_unique_address]] fixes. [PR96105]

We were wrongly checking is_empty_class on the result of strip_array_types
rather than the actual field type.  We weren't considering the alignment of
the data member.  We needed to handle unions the same way as
layout_nonempty_base_or_field.

gcc/cp/ChangeLog:

PR c++/96105
PR c++/96052
PR c++/95976
* class.c (check_field_decls): An array of empty classes is not an
empty data member.
(layout_empty_base_or_field): Handle explicit alignment.
Fix union handling.

gcc/testsuite/ChangeLog:

PR c++/96105
PR c++/96052
PR c++/95976
* g++.dg/cpp2a/no_unique_address4.C: New test.
* g++.dg/cpp2a/no_unique_address5.C: New test.
* g++.dg/cpp2a/no_unique_address6.C: New test.

5 years agofix constant folding from array CTORs
Richard Biener [Thu, 9 Jul 2020 14:03:45 +0000 (16:03 +0200)] 
fix constant folding from array CTORs

This fixes the case where we try to fold a read from an
array initalizer and happen to cross the boundary of
multiple CTORs which isn't really supported.  For the
interesting cases like the testcase we actually handle
the folding by encoding the whole initializer.

2020-07-10  Richard Biener  <rguenther@suse.de>

PR tree-optimization/96133
* gimple-fold.c (fold_array_ctor_reference): Do not
recurse to folding a CTOR that does not fully cover the
asked for object.

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

(cherry picked from commit 6e41c27bf549d957eb399d39d7d0c213f8733351)

5 years agoSchedule reduction partition in the last.
Bin Cheng [Thu, 9 Jul 2020 10:10:03 +0000 (18:10 +0800)] 
Schedule reduction partition in the last.

If reduction partition's SCC is broken by runtime alias checks, force
a negative post order to it so that it will be scheduled in the last.

2020-07-09  Bin Cheng  <bin.cheng@linux.alibaba.com>

gcc/
PR tree-optimization/95804
* tree-loop-distribution.c (break_alias_scc_partitions): Force
negative post order to reduction partition.

gcc/testsuite/
PR tree-optimization/95804
* gcc.dg/tree-ssa/pr95804.c: New test.

(cherry picked from commit dd21b03900085c4d60bf03207ad28bcbfbc86a4b)

5 years agoRecord and restore postorder information in breaking alias sccs.
Bin Cheng [Sat, 20 Jun 2020 07:42:12 +0000 (15:42 +0800)] 
Record and restore postorder information in breaking alias sccs.

gcc/
PR tree-optimization/95638
* tree-loop-distribution.c (pg_edge_callback_data): New field.
(loop_distribution::break_alias_scc_partitions): Record and restore
postorder information.  Fix memory leak.

gcc/testsuite/
PR tree-optimization/95638
* g++.dg/tree-ssa/pr95638.C: New test.

(cherry picked from commit 2c0069fafb53ccb7a45a6815025dfcbd2882a36e)

5 years agoDaily bump.
GCC Administrator [Fri, 10 Jul 2020 00:17:04 +0000 (00:17 +0000)] 
Daily bump.

5 years agolibstdc++: Implement operator<< for std::unique_ptr (LWG 2948)
Jonathan Wakely [Mon, 8 Jun 2020 17:08:14 +0000 (18:08 +0100)] 
libstdc++: Implement operator<< for std::unique_ptr (LWG 2948)

libstdc++-v3/ChangeLog:

* include/bits/unique_ptr.h (operator<<): Define for C++20.
* testsuite/20_util/unique_ptr/io/lwg2948.cc: New test.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error
line number.
* testsuite/20_util/default_delete/void_neg.cc: Likewise.

(cherry picked from commit 187da2ce31f13b2f75d5bb780e30ee364ead9d1d)

5 years agolibstdc++: Fix view adaptors for mixed-const sentinels and iterators (PR 95322)
Jonathan Wakely [Wed, 27 May 2020 21:08:15 +0000 (22:08 +0100)] 
libstdc++: Fix view adaptors for mixed-const sentinels and iterators (PR 95322)

The bug report is that transform_view's sentinel<false> cannot be
compared to its iterator<true>.  The comparison is supposed to use
operator==(iterator<Const>, sentinel<Const>) after converting
sentinel<false> to sentinel<true>. However, the operator== is a hidden
friend so is not a candidate when comparing iterator<true> with
sentinel<false>. The required conversion would only happen if we'd found
the operator, but we can't find the operator until after the conversion
happens.

A new LWG issue has been reported, but not yet assigned a number.  The
solution suggested by Casey Carter is to make the hidden friends of the
sentinel types work with iterators of any const-ness, so that no
conversions are required.

Patrick Palka observed that join_view has a similar problem and a
similar fix is used for its sentinel.

PR libstdc++/95322
* include/std/ranges (transform_view::_Sentinel): Allow hidden
friends to work with _Iterator<true> and _Iterator<false>.
(join_view::_Sentinel): Likewise.
* testsuite/std/ranges/adaptors/95322.cc: New test.

(cherry picked from commit 6c2582c0406250c66e2eb3651f8e8638796b7f53)

5 years agolibstdc++: Make pmr::synchronized_pool_resource work without libpthread (PR 94936)
Jonathan Wakely [Mon, 4 May 2020 12:34:23 +0000 (13:34 +0100)] 
libstdc++: Make pmr::synchronized_pool_resource work without libpthread (PR 94936)

I implicitly assumed that programs using pmr::synchronized_pool_resource
would also be using multiple threads, and so the weak symbols in
gthr-posix.h would be resolved by linking to libpthread. If that isn't
true then it crashes when trying to use pthread_key_create.

This commit makes the pool resource check __gthread_active_p() before
using thread-specific data, and just use a single set of memory pools
when there's only a single thread.

PR libstdc++/94936
* src/c++17/memory_resource.cc (synchronized_pool_resource::_TPools):
Add comment about single-threaded behaviour.
(synchronized_pool_resource::_TPools::move_nonempty_chunks()): Hoist
class member access out of loop.
(synchronized_pool_resource::synchronized_pool_resource())
(synchronized_pool_resource::~synchronized_pool_resource())
(synchronized_pool_resource::release()): Check __gthread_active_p
before creating and/or deleting the thread-specific data key.
(synchronized_pool_resource::_M_thread_specific_pools()): Adjust
assertions.
(synchronized_pool_resource::do_allocate(size_t, size_t)): Add fast
path for single-threaded case.
(synchronized_pool_resource::do_deallocate(void*, size_t, size_t)):
Likewise. Return if unable to find a pool that owns the allocation.
* testsuite/20_util/synchronized_pool_resource/allocate_single.cc:
New test.
* testsuite/20_util/synchronized_pool_resource/cons_single.cc: New
test.
* testsuite/20_util/synchronized_pool_resource/release_single.cc: New
test.

(cherry picked from commit ec40967f1323069da3a5a45286f71fa4f80926df)

5 years agolibstdc++: Use RDRAND as fallback if RDSEED keeps failing (PR 94087)
Jonathan Wakely [Tue, 19 May 2020 15:49:21 +0000 (16:49 +0100)] 
libstdc++: Use RDRAND as fallback if RDSEED keeps failing (PR 94087)

It's not difficult for multiple threads to drain the entropy available
to the RDSEED instruction, at which point we throw an exception. This
change will try to use RDRAND after RDSEED fails repeatedly, and only
throw if RDRAND also fails repeatedly. This doesn't guarantee a random
value can always be read, but reduces the likelihood of failure when
using the RDSEED instruction.

PR libstdc++/94087
* src/c++11/random.cc (__x86_rdseed): Allow fallback function to be
passed in.
(__x86_rdseed_rdrand): New function that uses rdseed with rdrand
fallback.
(random_device::_M_init): Use __x86_rdseed_rdrand when both
instructions are available.
* testsuite/26_numerics/random/random_device/94087.cc: New test.

(cherry picked from commit a2d196e75cef95c2b70734ad02e94f9da0e769fe)

5 years agoRISC-V: Disable remove unneeded save-restore call optimization if there are any argum...
Kito Cheng [Fri, 3 Jul 2020 05:49:51 +0000 (13:49 +0800)] 
RISC-V: Disable remove unneeded save-restore call optimization if there are any arguments on stack.

 - This optimization will adjust stack, but it not check/update other
   stack pointer use-site, the example is when the arguments put on
   stack, the offset become wrong after optimization.

 - However adjust stack frame usage after register allocation could be
   error prone, so we decide to turn off this optimization for such case.

 - Ye-Ting Kuo report this issue on github:
   https://github.com/riscv/riscv-gcc/pull/192

gcc/ChangeLog:

* config/riscv/riscv-sr.c (riscv_remove_unneeded_save_restore_calls):
Abort if any arguments on stack.

gcc/testsuite/ChangeLog

* gcc.target/riscv/save-restore-9.c: New.

(cherry picked from commit 4c0d1322033ce979532425d336530b217f6b5fd3)

5 years agoRISC-V: Fix compilation failed for frflags builtin in C++ mode
Kito Cheng [Fri, 19 Jun 2020 06:07:39 +0000 (14:07 +0800)] 
RISC-V: Fix compilation failed for frflags builtin in C++ mode

  - g++ will complain too few arguments for frflags builtin like bellow
    message:

    error: too few arguments to function 'unsigned int __builtin_riscv_frflags(void)'

  - However it's no arguments needed, it because we declare the function
    type with VOID arguments, that seems like require a VOID argument
    in the c++ front-end when GCC tried to resolve the function.

gcc/ChangeLog

* config/riscv/riscv-builtins.c (RISCV_FTYPE_NAME0): New.
(RISCV_FTYPE_ATYPES0): New.
(riscv_builtins): Using RISCV_USI_FTYPE for frflags.
* config/riscv/riscv-ftypes.def: Remove VOID argument.

gcc/testsuite/ChangeLog

* g++.target/riscv/frflags.C: New.

(cherry picked from commit 33d9794b7277a64543914bfbbfd567505e72da6c)

5 years agoRISC-V: Fix ICE on riscv_gpr_save_operation_p [PR95683]
Kito Cheng [Tue, 16 Jun 2020 02:14:13 +0000 (10:14 +0800)] 
RISC-V: Fix ICE on riscv_gpr_save_operation_p [PR95683]

 - riscv_gpr_save_operation_p might try to match parallel on other
   patterns like inline asm pattern, and then it might trigger ther
   assertion checking there, so we could trun it into a early exit check.

gcc/ChangeLog:

PR target/95683
* config/riscv/riscv.c (riscv_gpr_save_operation_p): Remove
assertion and turn it into a early exit check.

gcc/testsuite/ChangeLog

PR target/95683
* gcc.target/riscv/pr95683.c: New.

(cherry picked from commit beaf12b49ae030505194cdcac18b5c8533a43921)

5 years agoRISC-V: Suppress warning for signed and unsigned integer comparison.
Kito Cheng [Mon, 15 Jun 2020 03:51:13 +0000 (11:51 +0800)] 
RISC-V: Suppress warning for signed and unsigned integer comparison.

gcc/ChangeLog:

* config/riscv/riscv.c (riscv_gen_gpr_save_insn): Change type to
unsigned for i.
(riscv_gpr_save_operation_p): Change type to unsigned for i and
len.

(cherry picked from commit 82a3008e56c620008b4575a97e459e2769df54db)

5 years agoRISC-V: Unify the output asm pattern between gpr_save and gpr_restore pattern.
Kito Cheng [Thu, 11 Jun 2020 02:41:06 +0000 (19:41 -0700)] 
RISC-V: Unify the output asm pattern between gpr_save and gpr_restore pattern.

gcc/ChangeLog:

* config/riscv/riscv-protos.h (riscv_output_gpr_save): Remove.
* config/riscv/riscv-sr.c (riscv_sr_match_prologue): Update
value.
* config/riscv/riscv.c (riscv_output_gpr_save): Remove.
* config/riscv/riscv.md (gpr_save): Update output asm pattern.

(cherry picked from commit dcf41a4e6033213f5e5f80da23080df961d83996)

5 years agoRISC-V: Describe correct USEs for gpr_save pattern [PR95252]
Kito Cheng [Thu, 11 Jun 2020 02:40:59 +0000 (19:40 -0700)] 
RISC-V: Describe correct USEs for gpr_save pattern [PR95252]

 - Verified on rv32emc/rv32gc/rv64gc bare-metal target and rv32gc/rv64gc
   linux target with qemu.

gcc/ChangeLog:

* config/riscv/predicates.md (gpr_save_operation): New.
* config/riscv/riscv-protos.h (riscv_gen_gpr_save_insn): New.
(riscv_gpr_save_operation_p): Ditto.
* config/riscv/riscv-sr.c (riscv_remove_unneeded_save_restore_calls):
Ignore USEs for gpr_save patter.
* config/riscv/riscv.c (gpr_save_reg_order): New.
(riscv_expand_prologue): Use riscv_gen_gpr_save_insn to gen gpr_save.
(riscv_gen_gpr_save_insn): New.
(riscv_gpr_save_operation_p): Ditto.
* config/riscv/riscv.md (S3_REGNUM): New.
(S4_REGNUM): Ditto.
(S5_REGNUM): Ditto.
(S6_REGNUM): Ditto.
(S7_REGNUM): Ditto.
(S8_REGNUM): Ditto.
(S9_REGNUM): Ditto.
(S10_REGNUM): Ditto.
(S11_REGNUM): Ditto.
(gpr_save): Model USEs correctly.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/pr95252.c: New.

(cherry picked from commit d0e0c1300f9f08608873df5571e14a61308dd0c0)

5 years agoRISC-V: Make unique SECCAT_SRODATA names start with .srodata (not .sdata2)
Keith Packard [Wed, 29 Apr 2020 16:49:56 +0000 (09:49 -0700)] 
RISC-V: Make unique SECCAT_SRODATA names start with .srodata (not .sdata2)

default_unique_section uses ".sdata2" as a prefix for SECCAT_SRODATA
unique sections, but RISC-V uses ".srodata" instead. Override the
TARGET_ASM_UNIQUE_SECTION function to catch this case, allowing the
default to be used for all other sections.

Signed-off-by: Keith Packard <keithp@keithp.com>
gcc/
* config/riscv/riscv.c (riscv_unique_section): New.
(TARGET_ASM_UNIQUE_SECTION): New.

(cherry picked from commit adce62f53d8ad00e8110a6a2de7962d7a850de16)

5 years agoDaily bump.
GCC Administrator [Thu, 9 Jul 2020 00:17:18 +0000 (00:17 +0000)] 
Daily bump.

5 years agoamdgcn, nvptx: Handle -fpic/-fPIC in mkoffload
Kwok Cheung Yeung [Mon, 6 Jul 2020 22:21:08 +0000 (15:21 -0700)] 
amdgcn, nvptx: Handle -fpic/-fPIC in mkoffload

This is a backport from master
(commit a8b522311beef5e02de15427e924752ea02def2a).

2020-07-08  Tobias Burnus  <tobias@codesourcery.com>

gcc/ChangeLog:

* config/gcn/mkoffload.c (compile_native, main): Pass -fPIC/-fpic
on to the native compiler, if used.
* config/nvptx/mkoffload.c (compile_native, main): Likewise.

5 years agoPR fortran/95709 - ICE in gfc_resolve_code, at fortran/resolve.c:11807
Harald Anlauf [Mon, 6 Jul 2020 16:52:39 +0000 (18:52 +0200)] 
PR fortran/95709 - ICE in gfc_resolve_code, at fortran/resolve.c:11807

The legacy "assigned GOTO" accepts only scalar integer variables.
Check for proper arguments.

gcc/fortran/
PR fortran/95709
* resolve.c (gfc_resolve_code): Check for valid arguments to
assigned GOTO.

(cherry picked from commit 824084e72e388f81015e7f67922c75f50741355a)

5 years agoUpdate gcc sv.po.
Joseph Myers [Wed, 8 Jul 2020 18:31:15 +0000 (18:31 +0000)] 
Update gcc sv.po.

* sv.po: Update.

5 years agoaccept <case> and [cond] in ChangeLog
Alexandre Oliva [Tue, 7 Jul 2020 07:02:01 +0000 (09:02 +0200)] 
accept <case> and [cond] in ChangeLog

Only '(' and ':' currently terminate file lists in ChangeLog entries
in the ChangeLog parser.  This rules out such legitimate entries as:

* filename <CASE>:
* filename [COND]:

This patch extends the ChangeLog parser to recognize these forms.

for  contrib/ChangeLog

* gcc-changelog/git_commit.py: Support CASE and COND.
* gcc-changelog/test_patches.txt: Add test.
* gcc-changelog/test_email.py: Add test.

Co-Authored-By: Martin Liska <mliska@suse.cz>
(cherry picked from commit a759bfc7cf238b9fc5bf97884297fc69d8cdf2b5)

5 years agoaarch64: Fix arm_sve_vector_bits on typedefs [PR95105]
Richard Sandiford [Wed, 8 Jul 2020 13:34:11 +0000 (14:34 +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.

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.

5 years agolibbacktrace: test linker support for DWARF 5
Ian Lance Taylor [Wed, 8 Jul 2020 03:42:21 +0000 (20:42 -0700)] 
libbacktrace: test linker support for DWARF 5

On AIX, the compiler supports DWARF 5 but the linker does not.

2020-07-07 Clement Chigot <clement.chigot@atos.net>

* configure.ac: Test linker support for DWARF5
* configure: Regenerate

5 years agoDaily bump.
GCC Administrator [Wed, 8 Jul 2020 00:17:13 +0000 (00:17 +0000)] 
Daily bump.

5 years agotree-optimization/96075 - fix bogus misalignment calculation
Richard Biener [Mon, 6 Jul 2020 14:26:50 +0000 (16:26 +0200)] 
tree-optimization/96075 - fix bogus misalignment calculation

This fixes bogus misalignment calculation for negative steps
since an assertion a previous comment indicated no longer holds:

      /* DR_STEP(dr) is the same as -TYPE_SIZE of the scalar type,
         otherwise we wouldn't be here.  */

Thus the following replaces DR_STEP by -TYPE_SIZE.

2020-07-06  Richard Biener  <rguenther@suse.de>

PR tree-optimization/96075
* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Use
TYPE_SIZE_UNIT of the vector component type instead of DR_STEP
for the misalignment calculation for negative step.

* gcc.dg/vect/slp-46.c: New testcase.

(cherry picked from commit dccbf1e2a6e544f71b4a5795f0c79015db019fc3)

5 years agofix LTO streaming order dependence on randomness
Richard Biener [Mon, 6 Jul 2020 09:30:53 +0000 (11:30 +0200)] 
fix LTO streaming order dependence on randomness

This fixes the sorting of to copy symbols in lto_output introduced
with GCC 10 to not depend on the actual values of the randomness
we append to LTO section names but instead on the order they appear
in the unsorted array.

This fixed observed debug info differences due to tree merging
prevailing different early debug pointers.

2020-07-06  Richard Biener  <rguenther@suse.de>

* lto-streamer-out.c (cmp_symbol_files): Use the computed
order map to sort symbols from the same sub-file together.
(lto_output): Compute a map of sub-file to an order number
it appears in the symbol output array.

(cherry picked from commit c50502ca4ebb4d4bd2df9edf1eb5c53aacfa0a1e)

5 years agoDaily bump.
GCC Administrator [Tue, 7 Jul 2020 00:17:11 +0000 (00:17 +0000)] 
Daily bump.

5 years agoBackport to gcc-10
Will Schmidt [Mon, 8 Jun 2020 15:39:18 +0000 (10:39 -0500)] 
Backport to gcc-10

[PATCH, PR target/94954] Fix wrong codegen for vec_pack_to_short_fp32() builtin

Hi,
  Fix codegen for builtin vec_pack_to_short_fp32.  This includes adding
  a define_insn for xvcvsphp, and adding a new define_expand for
  convert_4f32_8f16.

[v2]
  Comment on altivec.md "convert_4f32_8f16" enhanced.
  Testsuite builtins-1-p9-runnable.c updated.

  OK for trunk and backports?

  Thanks
  -Will

PR target/94954

gcc/Changelog:

* config/rs6000/altivec.h (vec_pack_to_short_fp32): Update.
* config/rs6000/altivec.md (UNSPEC_CONVERT_4F32_8F16): New unspec.
(convert_4f32_8f16): New define_expand
* config/rs6000/rs6000-builtin.def (convert_4f32_8f16): New builtin define
and overload.
* config/rs6000/rs6000-call.c (P9V_BUILTIN_VEC_CONVERT_4F32_8F16): New
overloaded builtin entry.
* config/rs6000/vsx.md (UNSPEC_VSX_XVCVSPHP): New unspec.
(vsx_xvcvsphp): New define_insn.

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/builtins-1-p9-runnable.c: Update.

5 years agoPR fortran/93337 - ICE in gfc_dt_upper_string, at fortran/module.c:441
Harald Anlauf [Thu, 2 Jul 2020 18:41:51 +0000 (20:41 +0200)] 
PR fortran/93337 - ICE in gfc_dt_upper_string, at fortran/module.c:441

When declaring a polymorphic variable that is not a dummy, allocatable or
pointer, an ICE occurred due to a NULL pointer dereference.  Check for
that situation and punt.

gcc/fortran/
PR fortran/93337
* class.c (gfc_find_derived_vtab): Punt if name is not set.

(cherry picked from commit d9fb6f2b4f1321b059807ff6073156f07d9d376b)

5 years agoDaily bump.
GCC Administrator [Mon, 6 Jul 2020 00:17:03 +0000 (00:17 +0000)] 
Daily bump.

5 years agoUse CHARACTER(kind) string for calculating the type hash.
Thomas Koenig [Tue, 30 Jun 2020 11:01:36 +0000 (13:01 +0200)] 
Use CHARACTER(kind) string for calculating the type hash.

This regression came about because of a change in the way
types are displayed in error messages.  The character
representation is also used to calculate the hashes for
our types, so this patch restores the old behavior if
we are indeed calculating a hash.

The test case also checks for the specific hash value because
changing that would be an ABI change, which we should not
be doing unintentionally.

gcc/fortran/ChangeLog:

2020-06-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/95366
* gfortran.h (gfc_typename): Add optional argument for_hash.
* misc.c (gfc_typename): When for_hash is true, just retur
  CHARACTER(kind).
* class.c (gfc_intrinsic_hash_value): Call gfc_typename with
  for_hash = true.

(cherry picked from commit 5958b926dcc3332aec0a2e34653c4394d2613401)

5 years agoDaily bump.
GCC Administrator [Sun, 5 Jul 2020 00:16:55 +0000 (00:16 +0000)] 
Daily bump.

5 years agoipa-sra: Avoid transitive splits with type mismatches (PR 96040)
Martin Jambor [Sat, 4 Jul 2020 17:46:52 +0000 (19:46 +0200)] 
ipa-sra: Avoid transitive splits with type mismatches (PR 96040)

PR 96040 revealed IPA-SRA, when checking whether an intended split is
the same as the one in a called function does not also check if the
types match and the transformation code does not handle any resulting
type mismatches.  This patch simply avoids the the split in the case
of mismatches, so that we do not have to be careful about invalid
floating-point values being passed in floating point registers and
related issues.

gcc/ChangeLog:

2020-07-03  Martin Jambor  <mjambor@suse.cz>

PR ipa/96040
* ipa-sra.c (all_callee_accesses_present_p): Do not accept type
mismatched accesses.

gcc/testsuite/ChangeLog:

2020-07-03  Martin Jambor  <mjambor@suse.cz>

PR ipa/96040
* gcc.dg/ipa/pr96040.c: New test.

(cherry picked from commit b9a15a8325ba89b926e3c437b7961829a6b2fa2b)

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

5 years ago[OpenACC] Revert always-copyfrom behavior for 'GOMP_MAP_FORCE_FROM' in 'libgomp/oacc...
Thomas Schwinge [Thu, 14 May 2020 18:48:10 +0000 (20:48 +0200)] 
[OpenACC] Revert always-copyfrom behavior for 'GOMP_MAP_FORCE_FROM' in 'libgomp/oacc-mem.c:goacc_exit_data_internal'

As done for 'GOMP_MAP_FROM', also for 'GOMP_MAP_FORCE_FROM' we should only
'gomp_copy_dev2host' if 'n->refcount == 0'.

This had gotten altered in commit 378da98fcc907d05002bcd3d6ff7951f0cf485e5
(r279621) "OpenACC reference count overhaul".

libgomp/
* oacc-mem.c (goacc_exit_data_internal): Revert always-copyfrom
behavior for 'GOMP_MAP_FORCE_FROM'.
* testsuite/libgomp.oacc-c-c++-common/pr92843-1.c: Adjust XFAIL.

(cherry picked from commit e7f3f7fe08bdd49367f682398e1d2f4e6b60ef84)

5 years ago[OpenACC] Remove (unused) 'GOMP_MAP_ALWAYS_FROM' handling from 'libgomp/oacc-mem...
Thomas Schwinge [Thu, 14 May 2020 17:17:32 +0000 (19:17 +0200)] 
[OpenACC] Remove (unused) 'GOMP_MAP_ALWAYS_FROM' handling from 'libgomp/oacc-mem.c:goacc_exit_data_internal'

This had gotten added in commit 378da98fcc907d05002bcd3d6ff7951f0cf485e5
(r279621) "OpenACC reference count overhaul", but it doesn't have any use in
OpenACC.

libgomp/
* oacc-mem.c (goacc_exit_data_internal): Remove
'GOMP_MAP_ALWAYS_FROM' handling.

(cherry picked from commit 995aba5867b1c64b2b56a200ef16b135effe85f7)

5 years agoipa-sra: Prevent constructing debug info from wrong argument
Martin Jambor [Fri, 3 Jul 2020 12:51:02 +0000 (14:51 +0200)] 
ipa-sra: Prevent constructing debug info from wrong argument

The mechanism generating debug info for removed parameters did not
adjust index of the argument in the call statement to take into
account extra arguments IPA-SRA might have produced when splitting a
strucutre.  This patch addresses that omission and stops gdb from
showing incorrect value for the removed parameter and says "value
optimized out" instead.  The guality testcase will end up as
UNSUPPORTED in the results which is how Richi told me on IRC we deal
with this.

It is possible to generate debug info to actually show the value of
the removed parameter but so far my approaches to do just that seem
toocontroversial
(https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546705.html), so
before I come up with something better I'd like to push this to master
and the gcc-10 branch in time for the GCC 10.2 release.

gcc/ChangeLog:

2020-07-01  Martin Jambor  <mjambor@suse.cz>

PR debug/95343
* ipa-param-manipulation.c (ipa_param_adjustments::modify_call): Adjust
argument index if necessary.

gcc/testsuite/ChangeLog:

2020-07-01  Martin Jambor  <mjambor@suse.cz>

PR debug/95343
* gcc.dg/guality/pr95343.c: New test.

(cherry picked from commit 053c88093a45f175f446eda009f3312e4e508514)

5 years agoFix OG10 changelog mistake
Andrew Stubbs [Fri, 3 Jul 2020 12:15:47 +0000 (13:15 +0100)] 
Fix OG10 changelog mistake

Move my changelog entry to the correct file.

5 years agoamdgcn: Add fold_left_plus vector reductions
Andrew Stubbs [Mon, 10 Feb 2020 13:23:29 +0000 (13:23 +0000)] 
amdgcn: Add fold_left_plus vector reductions

These aren't real in-order instructions, because the ISA can't do that
quickly, but a means to allow regular out-of-order reductions when that's
good enough, but the middle-end doesn't know so.

gcc/
* config/gcn/gcn-valu.md (fold_left_plus_<mode>): New.

(cherry picked from commit bf628a97efaf11204ab02527b30ca71d7759ca37)

5 years agoDaily bump.
GCC Administrator [Fri, 3 Jul 2020 00:16:58 +0000 (00:16 +0000)] 
Daily bump.

5 years agors6000: Define _ARCH_PWR10 when appropriate
Segher Boessenkool [Thu, 2 Jul 2020 22:30:05 +0000 (22:30 +0000)] 
rs6000: Define _ARCH_PWR10 when appropriate

2020-07-02  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define
_ARCH_PWR10 when appropriate.

5 years agoPR libstdc++/91807
Ville Voutilainen [Thu, 2 Jul 2020 19:16:39 +0000 (22:16 +0300)] 
PR libstdc++/91807

PR libstdc++/91807
* include/std/variant
(_Copy_assign_base::operator=(const _Copy_assign_base&):
Do the move-assignment from a temporary so that the temporary
is constructed with an explicit index.
* testsuite/20_util/variant/91807.cc: New.

(cherry picked from commit dbca7a69f276e4829354f87f2747ebff36f6090e)

5 years agoPR fortran/88379 - ICE with allocatable coarray, class and associate
Harald Anlauf [Tue, 30 Jun 2020 21:36:56 +0000 (23:36 +0200)] 
PR fortran/88379 - ICE with allocatable coarray, class and associate

Catch NULL pointer dereference for ASSOCIATE on allocatable coarray variable.

gcc/fortran/
PR fortran/88379
* resolve.c (resolve_assoc_var): Avoid NULL pointer dereference.

(cherry picked from commit 267f84c6035c9380c8d1e9cb83ffe299c23e3a85)

5 years agolibstdc++: Fix atomic<long double> tests (PR 91153, PR 93224)
Jonathan Wakely [Thu, 2 Jul 2020 17:11:10 +0000 (17:11 +0000)] 
libstdc++: Fix atomic<long double> tests (PR 91153, PR 93224)

These tests fail with AIX double double. Use different floating point
values that behave less surprisingly.

libstdc++-v3/ChangeLog:

PR libstdc++/91153
PR target/93224
* testsuite/29_atomics/atomic_float/1.cc: Use different values
for tests.
* testsuite/29_atomics/atomic_ref/float.cc: Likewise.

(cherry picked from commit c6f431bba531bac3212b66069cf0f9718edf0132)

5 years agors6000: Add support for __builtin_cpu_is ("power10")
Peter Bergner [Fri, 26 Jun 2020 00:06:37 +0000 (19:06 -0500)] 
rs6000: Add support for __builtin_cpu_is ("power10")

Add support for __builtin_cpu_is ("power10").  Also add documentation for
the recently added "arch_3_1" and "mma" __builtin_cpu_supports arguments.

2020-06-25  Peter Bergner  <bergner@linux.ibm.com>

gcc/
* config/rs6000/rs6000-call.c (cpu_is_info) <power10>: New.
* doc/extend.texi (PowerPC Built-in Functions): Document power10,
arch_3_1 and mma.

gcc/testsuite/
* gcc.target/powerpc/cpu-builtin-1.c: Add tests for power10, arch_3_1
and mma.

(cherry picked from commit 67161d24f45601e43abea98f2c3d7d7a462b6eab)

5 years agoPowerPC: Add power10 hwcap2 bits
Michael Meissner [Wed, 1 Jul 2020 19:42:21 +0000 (14:42 -0500)] 
PowerPC: Add power10 hwcap2 bits

This patch adds support for the two new HWCAP2 fields used by the
__builtin_cpu_supports function.  It adds support in the target_clones
attribute for -mcpu=power10.

The two new __builtin_cpu_supports tests are:
__builtin_cpu_supports ("arch_3_1")
__builtin_cpu_supports ("mma")

The bits used are the bits that the Linux kernel engineers will be using for
these new features.

2020-06-05  Michael Meissner  <meissner@linux.ibm.com>

gcc/
* config/rs6000/ppc-auxv.h (PPC_PLATFORM_POWER10): Allocate
'power10' PowerPC platform.
(PPC_FEATURE2_ARCH_3_1): New HWCAP2 bit for ARCH 3.1.
(PPC_FEATURE2_MMA): New HWCAP2 bit for MMA.
* config/rs6000/rs6000-call.c (cpu_supports_info): Add ARCH 3.1 and
MMA HWCAP2 bits.

gcc/testsuite/
* gcc.target/powerpc/clone3.c: New test for using 'power10' with
the target_clones attribute.

(cherry picked from commit 2753f2f8b4a4534ab364595ba4b8a913cc7254a7)
(cherry picked from commit 7ba33e898fa4a097c0f2b4d9cae35041a5933f9c)

5 years agoPowerPC: PowerPC tests: Add prefixed/pcrel tests
Michael Meissner [Tue, 9 Jun 2020 18:48:24 +0000 (14:48 -0400)] 
PowerPC: PowerPC tests: Add prefixed/pcrel tests

2020-06-09  Michael Meissner  <meissner@linux.ibm.com>

gcc/testsuite/
* lib/target-supports.exp (check_effective_target_powerpc_pcrel): New.
(check_effective_target_powerpc_prefixed_addr): New.

(cherry picked from commit 6e52b2297ecce1243c00d76b3f079b71016b8ffa)

5 years agotestsuite: clarify scan-dump file globbing behavior
Frederik Harwath [Thu, 2 Jul 2020 09:50:52 +0000 (11:50 +0200)] 
testsuite: clarify scan-dump file globbing behavior

The test commands for scanning optimization dump files
perform globbing on the argument that specifies the suffix
of the dump files to be scanned.  This behavior is currently
undocumented.  Furthermore, the current implementation of
"scan-dump" and similar procedures yields an error whenever
the file name globbing matches more than one file (due to an
attempt to call "open" on multiple files) while a failure to
match any file results in an unresolved test.

This commit documents the globbing behavior.  The dump
scanning procedures are changed to make the test unresolved
if globbing matches more than one file.

This is a backport from master
(commit d4501bbedca267f2051e4f57415d6d2a61306915).

gcc/ChangeLog:

2020-07-02  Frederik Harwath  <frederik@codesourcery.com>

* doc/sourcebuild.texi: Describe globbing of the
dump file scanning commands "suffix" argument.

gcc/testsuite/ChangeLog:

2020-07-02  Frederik Harwath  <frederik@codesourcery.com>

* lib/scandump.exp (glob-dump-file): New proc.
(scan-dump): Use glob-dump-file for file name expansion.
(scan-dump-times): Likewise.
(scan-dump-dem): Likewise.
(scan-dump-dem-not): Likewise.

5 years agogcc-changelog: sync from master.
Martin Liska [Thu, 2 Jul 2020 08:51:06 +0000 (10:51 +0200)] 
gcc-changelog: sync from master.

contrib/ChangeLog:

* gcc-changelog/git_check_commit.py: New file.
* gcc-changelog/git_commit.py: New file.
* gcc-changelog/git_email.py: New file.
* gcc-changelog/git_repository.py: New file.
* gcc-changelog/git_update_version.py: New file.
* gcc-changelog/test_email.py: New file.
* gcc-changelog/test_patches.txt: New file.

5 years agoDaily bump.
GCC Administrator [Thu, 2 Jul 2020 00:16:59 +0000 (00:16 +0000)] 
Daily bump.

5 years agolibstdc++: Strip cv-qualifiers in std::atomic<FP> (PR 95282)
Jonathan Wakely [Wed, 27 May 2020 21:55:21 +0000 (22:55 +0100)] 
libstdc++: Strip cv-qualifiers in std::atomic<FP> (PR 95282)

This squashes two commits, r11-674 and r11-1401.

PR libstdc++/95282
* include/bits/atomic_base.h (__atomic_impl::load): Add
const-qualifier to parameter so that _Tp is deduced as the
non-const type, and use _Val to get the unqualified type.
(__atomic_impl::exchange): Use the _Val alias to remove
volatile from the reinterpret_cast result type.
* testsuite/29_atomics/atomic_float/95282.cc: New test.

(cherry picked from commit e40b11a91cb345db1324c3cb8f75b01e28056693)

5 years agolibstdc++: Remove noexcept from match_results comparisons (PR 94627)
Jonathan Wakely [Wed, 1 Jul 2020 20:01:15 +0000 (21:01 +0100)] 
libstdc++: Remove noexcept from match_results comparisons (PR 94627)

These functions can't be noexcept because the iterators stored in the
sub_match objects can throw on any operation.

libstdc++-v3/ChangeLog:

PR libstdc++/94627
* include/bits/regex.h (operator==, operator!=): Remove noexcept
equality comparisons for match_results.
* testsuite/28_regex/match_results/94627.cc: New test.

(cherry picked from commit a1a0dc4548979f8a340a7ea71624a52a20e1e0b3)

5 years agocoroutines: Collect the function body rewrite code.
Iain Sandoe [Wed, 1 Jul 2020 07:36:51 +0000 (08:36 +0100)] 
coroutines: Collect the function body rewrite code.

The standard describes a rewrite of the body of the user-authored
function (which wraps it in a try-catch block and provides the
initial and final suspend expressions).  The exact arrangement of
this was still in flux right up until the DIS and as a consequence
was a bit of a moving target.

The net result was a fragmented implementation of the parts of
the rewrite which is now impeding progress in fixing other issues.

This patch collates the rewrite action into a single function and
carries this out earlier.

gcc/cp/ChangeLog:

* coroutines.cc (expand_one_await_expression): Remove
code dealing with initial suspend.
(build_actor_fn): Remove code special-casing initial
and final suspend. Handle the final suspend and marking
of the coroutine as done.
(coro_rewrite_function_body): New.
(bind_expr_find_in_subtree): Remove.
(coro_body_contains_bind_expr_p): Remove.
(morph_fn_to_coro): Split the rewrite of the original
function into coro_rewrite_function_body and call it.

(cherry picked from commit 9252a208f485eed2757d601657facfa0aee6cd21)

5 years agocoroutines: Fix a diagnostic trailing space warning.
Iain Sandoe [Wed, 1 Jul 2020 06:59:43 +0000 (07:59 +0100)] 
coroutines: Fix a diagnostic trailing space warning.

A recently add diagnostic has a trailing space.
Fixed thus.

gcc/cp/ChangeLog:

* coroutines.cc (morph_fn_to_coro): Remove trailing
space in a diagnostic.

(cherry picked from commit eef63aacb255befb4e483cf680a3d0dcb2d8794e)

5 years agoarm: Fix the failing mve scalar shift execution tests.
Srinath Parvathaneni [Mon, 22 Jun 2020 16:11:19 +0000 (17:11 +0100)] 
arm: Fix the failing mve scalar shift execution tests.

In GCC testsuite the MVE scalar shift execution tests (mve_scalar_shifts[1-4].c) are failings
because of executing them on target hardware which doesn't support MVE instructions. This patch
restricts those tests to execute only on target hardware that support MVE instructions.

2020-06-22  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

gcc/
* doc/sourcebuild.texi (arm_v8_1m_mve_fp_ok): Add item.
(arm_mve_hw): Likewise.

gcc/testsuite/
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts1.c: Modify.
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts2.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts3.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_scalar_shifts4.c: Likewise.
* lib/target-supports.exp (check_effective_target_arm_mve_hw): Define.

(cherry picked from commit 99abb146fd0923ebda2c7e7681adb18e6798a90c)

5 years agoFortran : Bogus error with additional blanks in type(*) PR95829
Mark Eggleston [Tue, 23 Jun 2020 10:01:28 +0000 (11:01 +0100)] 
Fortran  : Bogus error with additional blanks in type(*) PR95829

Checking for "* ) " instead of "*)" clears the bogus error.

2020-07-01  Steven G. Kargl  <kargl@gcc.gnu.org>

gcc/fortran/

PR fortran/95829
* decl.c (gfc_match_decl_type_spec): Compare with "* ) " instead
of "*)".

2020-07-01  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/95829
* gfortran.dg/pr95829.f90: New test.

(cherry picked from commit 624e60f080989fa57756575a0bb47a97748b52b8)

5 years agoDaily bump.
GCC Administrator [Wed, 1 Jul 2020 00:17:00 +0000 (00:17 +0000)] 
Daily bump.

5 years agors6000: Rename isa attribute "fut" to "p10"
Segher Boessenkool [Mon, 29 Jun 2020 17:17:51 +0000 (17:17 +0000)] 
rs6000: Rename isa attribute "fut" to "p10"

== The actual changelog had
== Backport from trunk
== 2020-06-29  Segher Boessenkool  <segher@kernel.crashing.org>
== but the commit scripts refuse that

2020-06-30  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/rs6000.md (isa): Rename "fut" to "p10".

5 years agors6000: Testsuite changes to go with the previous commit
Segher Boessenkool [Mon, 22 Jun 2020 20:16:37 +0000 (20:16 +0000)] 
rs6000: Testsuite changes to go with the previous commit

== The actual changelog had
== Backport from trunk
== 2020-06-22  Segher Boessenkool  <segher@kernel.crashing.org>
== but the commit scripts refuse that

2020-06-30  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/cpu-future.c: Something was done here.
* gcc.target/powerpc/localentry-1.c: Something was done here.
* gcc.target/powerpc/localentry-detect-1.c: Something was done here.
* gcc.target/powerpc/mma-builtin-1.c: Something was done here.
* gcc.target/powerpc/mma-builtin-2.c: Something was done here.
* gcc.target/powerpc/mma-builtin-3.c: Something was done here.
* gcc.target/powerpc/mma-builtin-4.c: Something was done here.
* gcc.target/powerpc/mma-builtin-5.c: Something was done here.
* gcc.target/powerpc/mma-builtin-6.c: Something was done here.
* gcc.target/powerpc/notoc-direct-1.c: Something was done here.
* gcc.target/powerpc/pcrel-sibcall-1.c: Something was done here.
* gcc.target/powerpc/pr93122.c: Something was done here.
* lib/target-supports.exp: Stuff.

5 years agors6000: Rename future to power10
Segher Boessenkool [Mon, 22 Jun 2020 20:15:46 +0000 (20:15 +0000)] 
rs6000: Rename future to power10

== The actual changelog had
== Backport from trunk
== 2020-06-22  Segher Boessenkool  <segher@kernel.crashing.org>
== but the commit scripts refuse that

2020-06-30  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/driver-rs6000.c (asm_names): Use -mpwr10 for power10
on AIX, and -mpower10 elsewhere.
* config/rs6000/future.md: Delete.
* config/rs6000/linux64.h: Update comments.  Use TARGET_POWER10, not
TARGET_FUTURE.
* config/rs6000/power10.md: New file.
* config/rs6000/rs6000-builtin.def: Update comments.
* config/rs6000/rs6000-call.c: Use P10_BUILTIN_*, not FUTURE_BUILTIN_*.
Update compiler messages.
* config/rs6000/rs6000-cpus.def: Update comments.  Use ISA_3_1_*, not
ISA_FUTURE_*.  Use OPTION_MASK_POWER10, not OPTION_MASK_FUTURE.
* config/rs6000/rs6000-opts.h: Use PROCESSOR_POWER10, not
PROCESSOR_FUTURE.
* config/rs6000/rs6000-string.c: Ditto.
* config/rs6000/rs6000-tables.opt (rs6000_cpu_opt_value): Use "power10"
instead of "future", reorder it to right after "power9".
* config/rs6000/rs6000.c: Update comments.  Use OPTION_MASK_POWER10,
not OPTION_MASK_FUTURE.  Use TARGET_POWER10, not TARGET_FUTURE.  Use
RS6000_BTM_P10, not RS6000_BTM_FUTURE.  Update compiler messages.
Use PROCESSOR_POWER10, not PROCESSOR_FUTURE.  Use ISA_3_1_MASKS_SERVER,
not ISA_FUTURE_MASKS_SERVER.
(rs6000_opt_masks): Use "power10" instead of "future".
(rs6000_builtin_mask_names): Ditto.
(rs6000_disable_incompatible_switches): Ditto.
* config/rs6000/rs6000.h: Use -mpower10, not -mfuture.  Use
-mcpu=power10, not -mcpu=future.  Use MASK_POWER10, not MASK_FUTURE.
Use OPTION_MASK_POWER10, not OPTION_MASK_FUTURE.  Use RS6000_BTM_P10,
not RS6000_BTM_FUTURE.
* config/rs6000/rs6000.md: Use "power10", not "future".  Use
TARGET_POWER10, not TARGET_FUTURE.  Include "power10.md", not
"future.md".
* config/rs6000/rs6000.opt (mfuture): Delete.
(mpower10): New.
* config/rs6000/t-rs6000: Use "power10.md", not "future.md".
* config/rs6000/vsx.md: Use TARGET_POWER10, not TARGET_FUTURE.

5 years agoPR fortran/95978 - ICE in gfc_match_data, at fortran/decl.c:731
Harald Anlauf [Mon, 29 Jun 2020 21:20:16 +0000 (23:20 +0200)] 
PR fortran/95978 - ICE in gfc_match_data, at fortran/decl.c:731

Catch NULL pointer dereference on invalid DATA statement.

gcc/fortran/
PR fortran/95978
* decl.c (gfc_match_data): Avoid NULL pointer dereference.

(cherry picked from commit 583812c2e2f3593823622b0a5821d957c832dbd0)

5 years agoPR fortran/71706 - ICE on using sync images with -fcheck=bounds
Harald Anlauf [Mon, 29 Jun 2020 13:15:49 +0000 (15:15 +0200)] 
PR fortran/71706 - ICE on using sync images with -fcheck=bounds

The run-time checking code did not properly convert the kind of the
argument to SYNC IMAGES, leading to an error in verify_gimple.  Fix that.

gcc/fortran/
PR fortran/71706
* trans-stmt.c (gfc_trans_sync): Do proper kind conversion in
bounds-checking code.

(cherry picked from commit e6cc67f6616c96f3e18a434e0c74ba2f3818cb6d)

5 years agoMark up unreachable OpenACC 'attach' code path
Thomas Schwinge [Fri, 26 Jun 2020 08:19:14 +0000 (10:19 +0200)] 
Mark up unreachable OpenACC 'attach' code path

... introduced in commit 8e7e71ff247fb116dc381c5ef0c09acc0d2b374f (r279625)
"OpenACC 2.6 deep copy: libgomp parts".

libgomp/
* target.c (gomp_map_vars_existing): Assert 'kind !=
GOMP_MAP_ATTACH'.
(gomp_map_vars_internal): Clean up.

(cherry picked from commit aff43ac0aed5185884724adbdfd4dbbabd87637c)

5 years agoarm: 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

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.

(cherry picked from commit 8b8f3117263ca79b3febadadb07732588d99d5f6)

5 years agoDo not generate recursion check for compiler-generated procedures.
Thomas Koenig [Mon, 29 Jun 2020 21:11:06 +0000 (23:11 +0200)] 
Do not generate recursion check for compiler-generated procedures.

This one-line fix removes a check for recursion for procedures
which are compiler-generated, such as finalizers or deallocation.
These need to be recursive, even if the user code should not be.

gcc/fortran/ChangeLog:

PR fortran/95743
* trans-decl.c (gfc_generate_function_code): Do not generate
recursion check for compiler-generated procedures.

(cherry picked from commit 95cdcf701dad826f225d6413b59650f181954399)

5 years agocoroutines: Handle namespaces while scanning local vars [PR95711].
Iain Sandoe [Tue, 30 Jun 2020 07:29:11 +0000 (08:29 +0100)] 
coroutines: Handle namespaces while scanning local vars [PR95711].

We need to skip past namespace decls when scanning the bind
expression var lists checking for local vars.

gcc/cp/ChangeLog:

PR c++/95711
* coroutines.cc (register_local_var_uses): Skip past
namespace decls.

gcc/testsuite/ChangeLog:

PR c++/95711
* g++.dg/coroutines/pr95711.C: New test.

(cherry picked from commit 06ed4aae1c2fa84b7050a286d866db4a6def3c36)

5 years agocoroutines: Handle awaiters that are sub-objects [PR95736]
Iain Sandoe [Tue, 30 Jun 2020 07:18:34 +0000 (08:18 +0100)] 
coroutines: Handle awaiters that are sub-objects [PR95736]

Move deciding on initializers for awaitables to the build of the
co_await, this allows us to analyse cases that do not need
a temporary at that point.

As the PR shows, the late analysis meant that we  were not
checking properly for the case that an awaiter is a sub-object
of an existing variable outside the current function scope (and
therefore does not need to be duplicated in the frame).

gcc/cp/ChangeLog:

PR c++/95736
* coroutines.cc (get_awaitable_var): New helper.
(build_co_await): Check more carefully before
copying an awaitable.
(expand_one_await_expression): No initializer
is required when the awaitable is not a temp.
(register_awaits): Remove handling that is now
completed when the await expression is built.

gcc/testsuite/ChangeLog:

PR c++/95736
* g++.dg/coroutines/pr95736.C: New test.

(cherry picked from commit daaed0199ee57013ae011421a7e90b7bdd295373)

5 years agocoroutines: Improve diagnostics for one allocator case.
Iain Sandoe [Tue, 30 Jun 2020 06:54:39 +0000 (07:54 +0100)] 
coroutines: Improve diagnostics for one allocator case.

If the user provides operator new and that is noexcept, this
implies that it can fail with a null return.  At that point, we expect
to be able to call get_return_object_on_allocation_failure().

This diagnoses the case where such an operator new has been
provided, but the g-r-o-o-a-f is either missing or unusable.

gcc/cp/ChangeLog:

* coroutines.cc (morph_fn_to_coro): Diagnose unavailable
get_return_object_on_allocation_failure.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/coro-bad-grooaf-01-grooaf-expected.C: New test.

(cherry picked from commit 9c5ca11a33fa91345fe813d449ddc4a821fc72d5)

5 years agoDaily bump.
GCC Administrator [Tue, 30 Jun 2020 09:02:58 +0000 (09:02 +0000)] 
Daily bump.

5 years agoUpdate gcc sv.po.
Joseph Myers [Mon, 29 Jun 2020 23:57:49 +0000 (23:57 +0000)] 
Update gcc sv.po.

* sv.po: Update.

5 years agoPR fortran/95340 - ICE in gfc_match_select_rank, at fortran/match.c:6690
Harald Anlauf [Sun, 28 Jun 2020 14:24:15 +0000 (16:24 +0200)] 
PR fortran/95340 - ICE in gfc_match_select_rank, at fortran/match.c:6690

Do not dereference NULL pointer when querying array shape of possibly
improperly delared variable.

gcc/fortran/
PR fortran/95340
* match.c (gfc_match_select_rank): Do not dereference NULL pointer.

(cherry picked from commit b62cac6d92ff251213753475b69ec0b269cb7fae)

5 years agoPR fortran/95880 - ICE in gfc_add_type, at fortran/symbol.c:2030
Harald Anlauf [Sun, 28 Jun 2020 11:52:09 +0000 (13:52 +0200)] 
PR fortran/95880 - ICE in gfc_add_type, at fortran/symbol.c:2030

The fix for PR39695 did not properly distinguish between procedure names
and other symbols names in errors emitted for invalid code.  Fix that.

gcc/fortran/
PR fortran/95880
* symbol.c (gfc_add_type): If sym->ns->proc_name is set, use it,
otherwise fall back to sym->name.

(cherry picked from commit f3a8f66a83f8c94f6fbb0233cefba8032f2e4876)

5 years agocoroutines: Handle non-method promise expressions [PR95519]
Iain Sandoe [Mon, 29 Jun 2020 10:22:15 +0000 (11:22 +0100)] 
coroutines: Handle non-method promise expressions [PR95519]

The PR  points out that the standard does not restrict promise
expressions to methods, but the current implementation does.

The patch factors out the building of a general promise expression,
and then uses it in a fairly mechanical replacement of each case
that we need such an expressions.

This extends the handling for p.xxxxxx() expressions to cover the
cases where the promise member is some form callable.

Tests are added for each of the promise expressions.

It's somewhat tortuous to find good uses for this for the
get-return-object and get-return-object-on-allocation-failure
cases, but they are included anyway.

Backported from e74c76073092f4715007584edb1fe6b7a17274db and 31419a80b6bf84b1bf3bcb2489b2e660563f0dfe

gcc/cp/ChangeLog:

PR c++/95519
* coroutines.cc (struct coroutine_info):Add a field
to hold computed p.return_void expressions.
(coro_build_promise_expression): New.
(get_coroutine_return_void_expr): New.
(finish_co_yield_expr): Build the promise expression
using coro_build_promise_expression.
(finish_co_return_stmt): Likewise.
(build_init_or_final_await): Likewise.
(morph_fn_to_coro): Likewise, for several cases.

gcc/testsuite/ChangeLog:

PR c++/95519
* g++.dg/coroutines/torture/pr95519-00-return_void.C: New test.
* g++.dg/coroutines/torture/pr95519-01-initial-suspend.C: New test.
* g++.dg/coroutines/torture/pr95519-02-final_suspend.C: New test.
* g++.dg/coroutines/torture/pr95519-03-return-value.C: New test.
* g++.dg/coroutines/torture/pr95519-04-yield-value.C: New test.
* g++.dg/coroutines/torture/pr95519-05-gro.C: New test.
* g++.dg/coroutines/torture/pr95519-06-grooaf.C: New test.
* g++.dg/coroutines/torture/pr95519-07-unhandled-exception.C: New test.

5 years agocoroutines: Handle bad g-r-o-o-a-f cases.
Iain Sandoe [Mon, 29 Jun 2020 09:52:07 +0000 (10:52 +0100)] 
coroutines: Handle bad g-r-o-o-a-f cases.

If we see a get_return_object_on_allocation_failure in the
promise, we expect to be able to use it.  If this isn't
possible (because of some error in the declaration) then we
need to handle the erroneous return to allow following code
to complete.

gcc/cp/ChangeLog:

* coroutines.cc (morph_fn_to_coro): Handle error
returns in building g-r-o-o-a-f expressions.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/coro1-allocators.h (BAD_GROOAF_STATIC):
New.
* g++.dg/coroutines/coro-bad-grooaf-00-static.C: New test.

(cherry picked from commit e195c8045a1f3604f0f6b339e9ff731ebd9dcb0e)

5 years agoPR libstdc++/95915
Ville Voutilainen [Sun, 28 Jun 2020 21:36:38 +0000 (00:36 +0300)] 
PR libstdc++/95915

PR libstdc++/95915
* include/std/variant (_Uninitialized):
Adjust the condition and the comment.
* testsuite/20_util/variant/95915.cc: New.
* testsuite/20_util/variant/compile.cc: Add new test.

(cherry picked from commit 24b54628cfa95194a8de4071c28cb56e6e81c08e)