Commit Graph

183590 Commits

Author SHA1 Message Date
GCC Administrator
2c83c3fbd2 Daily bump. 2021-03-01 00:16:29 +00:00
Joseph Myers
6838d1b33d Update gcc de.po, sv.po.
* de.po, sv.po: Update.
2021-02-28 22:34:35 +00:00
Iain Sandoe
3c173f7890 testsuite, coroutines : Mark final awaiters and co_await operators noexcept.
This is part of the requirement of [dcl.fct.def.coroutine]/15.

In addition to promise final_suspend() calls, the following cases must
also be noexcept as per discussion in PR95616.

- finalSuspendObj.operator co_await()
- finalSuspendAwaiter.await_ready()
- finalSuspendAwaiter.await_suspend()
- finalSuspendAwaiter.await_resume()
- finalSuspedObj destructor
- finalSuspendAwaiter destructor

Fixed for missing cases in the testsuite as a prerequisite to fixing
PR95616.

gcc/testsuite/ChangeLog:

	* g++.dg/coroutines/pr94879-folly-1.C: Make final suspend
	expression components noexcept.
	* g++.dg/coroutines/pr94883-folly-2.C: Likewise.
	* g++.dg/coroutines/pr95345.C: Likewise.
2021-02-28 16:28:12 +00:00
Jason Merrill
7e5d7fc7e6 c++: Fix attr-lambda3.C
Some testcase for a change I was testing had an unnecessary ; at the end of
a line that caused a test failure on the 10 branch, so I mistakenly removed
it from this one.  Oops.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/attr-lambda3.C: Add missing ;
2021-02-28 09:17:10 -05:00
Jakub Jelinek
48ca2185bf fortran: Fix up wording of 3 OpenMP diagnostic messages [PR99303]
As reported in the PR, some diagnostic messages need wording improvements.

2021-02-28  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/99303
	* openmp.c (gfc_omp_requires_add_clause): Fix up diagnostic message
	wordings.
	(resolve_omp_clauses): Likewise.
2021-02-28 11:16:33 +01:00
Jakub Jelinek
3a77ca7d36 fortran: Replace double space in diagnostic with a single one [PR99300]
The diagnostic had "  " in it instead of just " ".

2021-02-28  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/99300
	* frontend-passes.c (doloop_code): Replace double space in diagnostics
	with a single space.
2021-02-28 11:14:24 +01:00
Jakub Jelinek
d3805e6d57 typos: Fix various typos - mainly misspelled reference* [PR99304]
The PR is about a typo in handle_malloc_attribute diagnostic message,
but grepping around I found many other cases and while fixing those I've
noticed a couple of other typos.

2021-02-28  Jakub Jelinek  <jakub@redhat.com>

	PR c/99304
	* ipa.c (symbol_table::remove_unreachable_nodes): Fix a comment
	typo - referneced -> referenced.
	* tree.c (component_ref_size): Fix comment typo -
	refernce -> reference.
	* tree-ssa-alias.c (access_path_may_continue_p): Fix comment typo -
	traling -> trailing.
	(aliasing_component_refs_p): Fix comment typos -
	refernce -> reference and refernece -> reference and
	traling -> trailing.
	(nonoverlapping_refs_since_match_p): Fix comment typo -
	referneces -> references.
	* doc/invoke.texi (--param modref-max-bases): Fix a typo -
	referneces -> references.
gcc/c-family/
	* c-attribs.c (handle_malloc_attribute): Fix a typo in inform
	message - refernced -> referenced.  Remove superfluous space before
	closing paren of function calls.
gcc/lto/
	* lto-symtab.c (lto_symtab_prevailing_virtual_decl): Fix comment
	typos - refernced -> referenced and
	devirtualizaiton -> devirtualization.
2021-02-28 11:12:57 +01:00
GCC Administrator
ec9dc4fa08 Daily bump. 2021-02-28 00:16:18 +00:00
Jason Merrill
5d9d6c1cd8 c++: Allow GNU attributes before lambda -> [PR90333]
In my 9.3/10 patch for 90333 I allowed attributes between [] and (), and
after the trailing return type, but not in the place that GCC 8 expected
them, and we've gotten several bug reports about that.  So let's allow them
there, as well.

gcc/cp/ChangeLog:

	PR c++/90333
	* parser.c (cp_parser_lambda_declarator_opt): Accept GNU attributes
	between () and ->.

gcc/testsuite/ChangeLog:

	PR c++/90333
	* g++.dg/ext/attr-lambda3.C: New test.
2021-02-27 15:44:27 -05:00
Iain Sandoe
a938e4616d Darwin : Update a disgnostic message [NFC].
The avoids a contraction and a format diagnostic warning.

gcc/ChangeLog:

	* config/host-darwin.c (darwin_gt_pch_use_address): Modify
	diagnostic message to avoid use of a contraction and format
	warning.
2021-02-27 16:31:54 +00:00
Iain Sandoe
e3eda9a0e1 libgomp, testsuite : Require alias support for PR96390 testcase.
This fails everywhere on Darwin, which does not have support for
symbol aliases.  Add a dg-require-alias to UNSUPPORT it.

libgomp/ChangeLog:

	* testsuite/libgomp.c-c++-common/pr96390.c: Require alias
	support from the target.
2021-02-27 16:31:34 +00:00
Jonathan Wakely
699672d4dc libstdc++: Fix conversions from date types to integers [PR 99301]
The conversions to integer types are explicit, so need to use the
correct type. Converting to uint32_t only works if that is the same type
as unsigned.

libstdc++-v3/ChangeLog:

	PR libstdc++/99301
	* include/std/chrono (year_month_day::_M_days_since_epoch()):
	Convert chrono::month and chrono::day to unsigned before
	converting to uint32_t.
2021-02-27 12:53:15 +00:00
Jakub Jelinek
652623f7c6 gcse, ipa-devirt: Use %wd/%wu instead of HOST_WIDE_INT_PRINT* in diagnostics [PR99288]
HOST_WIDE_INT_PRINT* in the string literals of warning/error/inform etc.
make those messages non-translatable, and we have a perfectly fine
alternative when not using system *printf - %w{d,u}.

2021-02-27  Jakub Jelinek  <jakub@redhat.com>

	PR other/99288
	* gcse.c (gcse_or_cprop_is_too_expensive): Use %wu instead of
	HOST_WIDE_INT_PRINT_UNSIGNED in warning format string.
	* ipa-devirt.c (ipa_odr_read_section): Use %wd instead of
	HOST_WIDE_INT_PRINT_DEC in inform format string.  Fix comment
	typos.
2021-02-27 10:43:28 +01:00
GCC Administrator
06a9f20f97 Daily bump. 2021-02-27 00:16:23 +00:00
David Malcolm
ded7355b3d analyzer: implement exploded_path copy ctor
gcc/analyzer/ChangeLog:
	* engine.cc (exploded_path::exploded_path): New copy-ctor.
	* exploded-graph.h (exploded_path::operator=): Drop decl.
2021-02-26 16:35:32 -05:00
Joseph Myers
95a82679f6 Update gcc de.po.
* de.po: Update.
2021-02-26 19:32:34 +00:00
Alexandre Oliva
9d5b4b60bd revert just-added duplicate fpic target requirement
A moment after pushing the previous patch, I noticed the fpic target
requirement markers had already been added to some of the files in the
patch from long ago that I've just contributed.  This patch reverts
the duplicates.


for  gcc/testsuite/ChangeLog

	* gcc.target/powerpc/pr67789.c: Revert fpic target requirement
	duplication.
	* gcc.target/powerpc/pr83629.c: Likewise.
	* gcc.target/powerpc/pr84112.c: Likewise.
2021-02-26 12:27:55 -03:00
Olivier Hainque
1c922c1e56 Add missing dg-require-effective-target fpic directives to powerpc tests
for  gcc/testsuite/ChangeLog

	* gcc.target/powerpc/compress-float-ppc-pic.c: Add
	dg-require-effective-target fpic.
	* gcc.target/powerpc/ppc-eabi.c: Likewise.
	* gcc.target/powerpc/pr26350.c: Likewise.
	* gcc.target/powerpc/pr67789.c: Likewise.
	* gcc.target/powerpc/pr79439-1.c: Likewise.
	* gcc.target/powerpc/pr79439-2.c: Likewise.
	* gcc.target/powerpc/pr79439-3.c: Likewise.
	* gcc.target/powerpc/pr83629.c: Likewise.
	* gcc.target/powerpc/pr84112.c: Likewise.
2021-02-26 12:09:27 -03:00
Richard Biener
c173346aac middle-end/99281 - avoid bitfield stores into addressable types
This avoids doing bitfield stores into the return object of calls
when using return-slot optimization and the type is addressable.
Instead we have to pass down the original target RTX to the call
expansion which otherwise tries to create a new temporary.

2021-02-26  Richard Biener  <rguenther@suse.de>

	PR middle-end/99281
	* expr.c (store_field): For calls with return-slot optimization
	and addressable return type expand the store directly.

	* g++.dg/pr99218.C: New testcase.
2021-02-26 12:34:27 +01:00
Jakub Jelinek
0f161cc849 c++: Implement P1102R2 - Down with ()!
The following patch implements P1102R2.
For attributes, we have already attribute parsing before the parameter
declarations and so when that is omitted, if the attributes are first we
already accept it.

2021-02-26  Jakub Jelinek  <jakub@redhat.com>

	* parser.c (cp_parser_lambda_declarator_opt): Implement
	P1102R2 - Down with ()! Make ()s optional before lambda specifiers
	for -std={c,gnu}++2b or with pedwarn in earlier versions.

	* g++.dg/cpp23/lambda-specifiers1.C: New test.
2021-02-26 10:47:07 +01:00
Jakub Jelinek
27f9a87886 c++: Fix operator() lookup in lambdas [PR95451]
During name lookup, name-lookup.c uses:
            if (!(!iter->type && HIDDEN_TYPE_BINDING_P (iter))
                && (bool (want & LOOK_want::HIDDEN_LAMBDA)
                    || !is_lambda_ignored_entity (iter->value))
                && qualify_lookup (iter->value, want))
              binding = iter->value;
Unfortunately as the following testcase shows, this doesn't work in
generic lambdas, where we on the auto b = ... lambda ICE and on the
auto d = lambda reject it even when it should be valid.  The problem
is that the binding doesn't have a FUNCTION_DECL with
LAMBDA_FUNCTION_P for the operator(), but an OVERLOAD with
TEMPLATE_DECL for such FUNCTION_DECL.

The following patch fixes that in is_lambda_ignored_entity, other
possibility would be to do that before calling is_lambda_ignored_entity
in name-lookup.c.

2021-02-26  Jakub Jelinek  <jakub@redhat.com>

	PR c++/95451
	* lambda.c (is_lambda_ignored_entity): Before checking for
	LAMBDA_FUNCTION_P, use OVL_FIRST.  Drop FUNCTION_DECL check.

	* g++.dg/cpp1y/lambda-generic-95451.C: New test.
2021-02-26 10:43:28 +01:00
Richard Biener
ff7a515446 c/99275 - fix missing space in diagnostic
This fixes a missing space as reported by translators.

2021-02-26  Richard Biener  <rguenther@suse.de>

	PR c/99275
	* builtins.c (warn_string_no_nul): Fix diagnostic formatting.
2021-02-26 08:51:33 +01:00
Jason Merrill
7c657339d6 c++: Fix class NTTP constness handling [PR98810]
Here, when substituting still-dependent args into an alias template, we see
a non-const type because the default argument is non-const, and is not a
template parm object because it's still dependent.

gcc/cp/ChangeLog:

	PR c++/98810
	* pt.c (tsubst_copy) [VIEW_CONVERT_EXPR]: Add const
	to a class non-type template argument that needs it.

gcc/testsuite/ChangeLog:

	PR c++/98810
	* g++.dg/cpp2a/nontype-class-defarg1.C: New test.
2021-02-25 22:57:48 -05:00
Peter Bergner
0159535adb rs6000: Fix ICE in rs6000_init_builtins when compiling with -mcpu=440 [PR99279]
The initialization of compat builtins assumes the builtin we are creating
a compatible builtin for exists and ICEs if it doesn't.  However, there are
valid reasons why some builtins are disabled for a particular compile.
In this case, the MMA builtins are disabled for -mcpu=440 (and other cpus),
so instead of ICEing, we should just skip adding the MMA compat builtin.

2021-02-25  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	PR target/99279
	* config/rs6000/rs6000-call.c (rs6000_init_builtins): Replace assert
	with an "if" test.
2021-02-25 21:35:28 -06:00
Aaron Sawdey
b8d85f569a Optimize pcrel access of globals
This patch implements a RTL pass that looks for pc-relative loads of the
address of an external variable using the PCREL_GOT relocation and a
single load or store that uses that external address.

Produced by a cast of thousands:
 * Michael Meissner
 * Peter Bergner
 * Bill Schmidt
 * Alan Modra
 * Segher Boessenkool
 * Aaron Sawdey

gcc/ChangeLog:

	* config.gcc: Add rs6000-pcrel-opt.o.
	* config/rs6000/rs6000-pcrel-opt.c: New file.
	* config/rs6000/pcrel-opt.md: New file.
	* config/rs6000/predicates.md: Add d_form_memory predicate.
	* config/rs6000/rs6000-cpus.def: Add OPTION_MASK_PCREL_OPT.
	* config/rs6000/rs6000-passes.def: Add pass_pcrel_opt.
	* config/rs6000/rs6000-protos.h: Add reg_to_non_prefixed(),
	pcrel_opt_valid_mem_p(), output_pcrel_opt_reloc(),
	and make_pass_pcrel_opt().
	* config/rs6000/rs6000.c (reg_to_non_prefixed): Make global.
	(rs6000_option_override_internal): Add pcrel-opt.
	(rs6000_delegitimize_address): Support pcrel-opt.
	(rs6000_opt_masks): Add pcrel-opt.
	(pcrel_opt_valid_mem_p): New function.
	(reg_to_non_prefixed): Make global.
	(rs6000_asm_output_opcode): Reset prepend_p_to_next_insn.
	(output_pcrel_opt_reloc): New function.
	* config/rs6000/rs6000.md (loads_extern_addr): New attr.
	(pcrel_extern_addr): Set loads_extern_addr.
	Add include for pcrel-opt.md.
	* config/rs6000/rs6000.opt: Add -mpcrel-opt.
	* config/rs6000/t-rs6000: Add rules for pcrel-opt.c and
	pcrel-opt.md.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pcrel-opt-inc-di.c: New test.
	* gcc.target/powerpc/pcrel-opt-ld-df.c: New test.
	* gcc.target/powerpc/pcrel-opt-ld-di.c: New test.
	* gcc.target/powerpc/pcrel-opt-ld-hi.c: New test.
	* gcc.target/powerpc/pcrel-opt-ld-qi.c: New test.
	* gcc.target/powerpc/pcrel-opt-ld-sf.c: New test.
	* gcc.target/powerpc/pcrel-opt-ld-si.c: New test.
	* gcc.target/powerpc/pcrel-opt-ld-vector.c: New test.
	* gcc.target/powerpc/pcrel-opt-st-df.c: New test.
	* gcc.target/powerpc/pcrel-opt-st-di.c: New test.
	* gcc.target/powerpc/pcrel-opt-st-hi.c: New test.
	* gcc.target/powerpc/pcrel-opt-st-qi.c: New test.
	* gcc.target/powerpc/pcrel-opt-st-sf.c: New test.
	* gcc.target/powerpc/pcrel-opt-st-si.c: New test.
	* gcc.target/powerpc/pcrel-opt-st-vector.c: New test.
2021-02-25 21:27:14 -06:00
YunQiang Su
9967bbfced [PATCH v4 1/2] MIPS: unaligned load: use SImode for SUBREG if OK (PR98996) [PATCH v4 2/2] ada: add 128bit operation for MIPS N32 and N64
gcc/ChangeLog:

	PR target/98996
	* config/mips/mips.c (mips_expand_ext_as_unaligned_load):
	If TARGET_64BIT and dest is SUBREG, we check the width, if it
	equal to SImode, we use SImode operation, just like what we are
	doing for REG one.

gcc/ada/ChangeLog:

	PR ada/98996
	* Makefile.rtl: <mips*-*-linux*>
	add 128Bit operation file for MIPS N64 and N32 to
	LIBGNAT_TARGET_PAIRS and EXTRA_GNATRTL_NONTASKING_OBJS
2021-02-25 19:56:07 -07:00
Marek Polacek
97989a2220 builtins: Fix typos in warn_for_access [PR99278]
gcc/ChangeLog:

	* builtins.c (warn_for_access): Fix typos.
2021-02-25 21:38:27 -05:00
Lynn Boger
2fbed0dc6c libgo: ensure memmove, memset 8 byte atomicity on ppc64x
Go requires that pointer moves are done 8 bytes at a time,
but gccgo uses libc's memmove and memset which does not require
that, and there are some cases where an 8 byte move might be
done as 4+4.

To enforce 8 byte moves for memmove and memset, this adds a
C implementation in libgo/runtime for memmove and memset to be
used on ppc64le and ppc64. Asm implementations were considered
but discarded to avoid different implementations for different
target ISAs.

Fixes golang/go#41428

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/294931
2021-02-25 17:01:23 -08:00
David Malcolm
a505fad4dd analyzer: eliminate dedupe_candidate [PR96374]
In gcc/analyzer/diagnostic-manager.cc the code partitions
saved_diagnostic instances by dedupe_key, and tries to find the "best"
saved_diagnostic for each dedupe_key.

Ideally we would find the shortest feasible path for each
saved_diagnostic and pick the winner in each deduplication set.

Currently we merely approximate that by finding the shortest path for
each saved_diagnostic, and checking to see if it feasible, rejecting
the saved_diagnostic if it is not.  The "shortest path, or nothing if
it's infeasible" is not the same as the "shortest feasible path", and
this leads to false negatives, where we reject valid diagnostics,
tracked as PR analyzer/96374.

I have been attempting various fixes for this, but in doing so I
found that the existing structure of the code makes things unnecessarily
awkward: each dedupe_set had a a dedupe_candidate which stored the
best epath for that set, creating it from the shortest path when that
dedupe_candidate was constructed.

This patch eliminates the dedupe_candidate, instead storing the best
epath for each saved_diagnostic within the saved_diagnostic itself,
along with any feasibility_problem, and eliminating a redundant "status"
field.  The logic for finding the best epath is moved to a new
epath_finder::get_best_epath subroutine, introducing an epath_finder
class to give a place to cache state.

This patch merely copies over the existing logic to
epath_finder::get_best_epath, so no functional change is intended,
but the patch simplifies the logic and makes it much easier to
experiment with alternate implementations as I try to fix
PR analyzer/96374.

I attempted another version of this patch in which I added a dedupe_set
class and partitioned saved_diagnostics into them as the diagnostics were
added, but in this earlier iteration of the patch there were regressions
e.g. from gcc.dg/analyzer/zlib-4.c where 4 deduplication sets became 3.
The issue was that the deduplication logic needs source locations, which
need gimple statements, and the stmt_finder needs epaths to run.  Finding
the epaths needs the full egraph (as opposed to the egraph in its state
at the time when the diagnostic is saved).  Hence the partitioning needs to
happen after the egraph is fully explored.  I backed up the earlier patch
kit to:
  https://dmalcolm.fedorapeople.org/gcc/2021-02-23/feasibility-v0.3-relative-to-72d78655a91bb2f89ac4432cfd6374380d6f9987/

gcc/analyzer/ChangeLog:
	PR analyzer/96374
	* diagnostic-manager.cc (class epath_finder): New.
	(epath_finder::get_best_epath): New.
	(saved_diagnostic::saved_diagnostic): Update for replacement of
	m_state and m_epath_length with m_best_epath.
	(saved_diagnostic::~saved_diagnostic): Delete m_best_epath.
	(saved_diagnostic::to_json): Update "path_length" to be optional.
	(saved_diagnostic::calc_best_epath): New, based on
	dedupe_winners::add and parts of dedupe_key::dedupe_key.
	(saved_diagnostic::get_epath_length): New.
	(saved_diagnostic::add_duplicate): New.
	(dedupe_key::dedupe_key): Drop epath param.  Move invocation of
	stmt_finder to saved_diagnostic::calc_best_epath.
	(class dedupe_candidate): Delete.
	(class dedupe_hash_map_traits): Update to use saved_diagnotic *
	rather than dedupe_candidate * as the value_type/compare_type.
	(dedupe_winners::~dedupe_winners): Don't delete the values.
	(dedupe_winners::add): Convert param from shortest_exploded_paths to
	epath_finder.  Drop "eg" param.  Drop dedupe_candidate, moving
	path generation and feasiblity checking to
	epath_finder::get_best_epath.  Update winner-selection for move
	of epaths from dedupe_candidate to saved_diagnostic.
	(dedupe_winners::emit_best):  Update for removal of class
	dedupe_candidate.
	(dedupe_winners::map_t): Update to use saved_diagnotic * rather
	than dedupe_candidate * as the value_type/compare_type.
	(diagnostic_manager::emit_saved_diagnostics): Move
	shortest_exploded_paths instance into epath_finder and pass that
	around instead.
	(diagnostic_manager::emit_saved_diagnostic): Drop epath, stmt
	and num_dupes params, instead getting these from the
	saved_diagnostic.  Use correct location in inform_n call.
	* diagnostic-manager.h (class epath_finder): New forward decl.
	(saved_diagnostic::status): Drop enum.
	(saved_diagnostic::set_feasible): Drop.
	(saved_diagnostic::set_infeasible): Drop.
	(saved_diagnostic::get_status): Drop.
	(saved_diagnostic::calc_best_epath): New decl.
	(saved_diagnostic::get_best_epath): New decl.
	(saved_diagnostic::get_epath_length): New decl.
	(saved_diagnostic::set_epath_length): Drop.
	(saved_diagnostic::get_epath_length): Drop inline implementation.
	(saved_diagnostic::add_duplicate): New.
	(saved_diagnostic::get_num_dupes): New.
	(saved_diagnostic::m_d): Document ownership.
	(saved_diagnostic::m_trailing_eedge): Make const.
	(saved_diagnostic::m_status): Drop field.
	(saved_diagnostic::m_epath_length): Drop field.
	(saved_diagnostic::m_best_epath): New field.
	(saved_diagnostic::m_problem): Document ownership.
	(saved_diagnostic::m_duplicates): New field.
	(diagnostic_manager::emit_saved_diagnostic): Drop params epath,
	stmt, and num_dupes.
	* engine.cc (exploded_graph_annotator::print_saved_diagnostic):
	Update for changes to saved_diagnostic class.
	* exploded-graph.h (exploded_path::feasible_p): Drop unused
	overloaded decl.
2021-02-25 20:00:12 -05:00
Patrick Palka
6bd409cfc8 c++: abbreviated function template return type rewriting [PR98990]
When an abbreviated function template has a complex placeholder return
type such auto& or auto**, the level adjustment performed by
splice_late_return_type directly replaces the 'auto' inside the original
return type with the level-adjusted 'auto', but that breaks
TYPE_CANONICAL caching.  Instead, we should rebuild the entire return
type using the adjusted 'auto'.

This patch makes this happen by tsubsting the original return type with
an argument vector that maps the original 'auto' to the adjusted 'auto'.
In passing, this patch also reverts the misguided changes to
find_type_usage in r10-6571 that made find_type_usage return a tree*
instead of a tree so as to discourage this kind of in-place type
modification.

It occurred to me that the constraint also needs to be rebuilt so that
it refers to the adjusted 'auto', but this oversight doesn't seem to
cause any issues at the moment due to how do_auto_deduction "manually"
substitutes the 'auto' inside the constraint before performing
satisfaction.  So this'll be fixed later as part of a rework of
placeholder type constraint checking.

gcc/cp/ChangeLog:

	PR c++/98990
	* pt.c (splice_late_return_type): Rebuild the entire return type
	if we have to adjust the level of an auto within.
	(type_uses_auto): Adjust call to find_type_usage.
	* type-utils.h (find_type_usage): Revert r10-6571 change that
	made this function return a pointer to the auto node.

gcc/testsuite/ChangeLog:

	PR c++/98990
	* g++.dg/concepts/abbrev8.C: New test.
2021-02-25 19:55:43 -05:00
GCC Administrator
daa6884432 Daily bump. 2021-02-26 00:16:36 +00:00
Kwok Cheung Yeung
d656bfda2d openmp: Fix intermittent hanging of task-detach-6 libgomp tests [PR98738]
This adds support for the task detach clause to taskwait and taskgroup, and
simplifies the handling of the detach clause by moving most of the extra
handling required for detach tasks to omp_fulfill_event.

2021-02-25  Kwok Cheung Yeung  <kcy@codesourcery.com>
	    Jakub Jelinek  <jakub@redhat.com>

	libgomp/

	PR libgomp/98738
	* libgomp.h (enum gomp_task_kind): Add GOMP_TASK_DETACHED.
	(struct gomp_task): Replace detach and completion_sem fields with
	union containing completion_sem and detach_team.  Add deferred_p
	field.
	(struct gomp_team): Remove task_detach_queue.
	* task.c: Include assert.h.
	(gomp_init_task): Initialize deferred_p and completion_sem fields.
	Rearrange initialization order of fields.
	(task_fulfilled_p): Delete.
	(GOMP_task): Use address of task as the event handle.  Remove
	initialization of detach field.  Initialize deferred_p field.
	Use automatic local for completion_sem.  Initialize detach_team field
	for deferred tasks.
	(gomp_barrier_handle_tasks): Remove handling of task_detach_queue.
	Set kind of suspended detach task to GOMP_TASK_DETACHED and
	decrement task_running_count.  Move finish_cancelled block out of
	else branch.  Relocate call to gomp_team_barrier_done.
	(GOMP_taskwait): Handle tasks with completion events that have not
	been fulfilled.
	(GOMP_taskgroup_end): Likewise.
	(omp_fulfill_event): Use address of task as event handle.  Post to
	completion_sem for undeferred tasks.  Clear detach_team if task
	has not finished.  For finished tasks, handle post-execution tasks,
	call gomp_team_barrier_wake if necessary, and free task.
	* team.c (gomp_new_team): Remove initialization of task_detach_queue.
	(free_team): Remove free of task_detach_queue.
	* testsuite/libgomp.c-c++-common/task-detach-1.c: Fix formatting.
	* testsuite/libgomp.c-c++-common/task-detach-2.c: Fix formatting.
	* testsuite/libgomp.c-c++-common/task-detach-3.c: Fix formatting.
	* testsuite/libgomp.c-c++-common/task-detach-4.c: Fix formatting.
	* testsuite/libgomp.c-c++-common/task-detach-5.c: Fix formatting.
	Change data-sharing of detach events on enclosing parallel to private.
	* testsuite/libgomp.c-c++-common/task-detach-6.c: Likewise.  Remove
	taskwait directive.
	* testsuite/libgomp.c-c++-common/task-detach-7.c: New.
	* testsuite/libgomp.c-c++-common/task-detach-8.c: New.
	* testsuite/libgomp.c-c++-common/task-detach-9.c: New.
	* testsuite/libgomp.c-c++-common/task-detach-10.c: New.
	* testsuite/libgomp.c-c++-common/task-detach-11.c: New.
	* testsuite/libgomp.fortran/task-detach-1.f90: Fix formatting.
	* testsuite/libgomp.fortran/task-detach-2.f90: Fix formatting.
	* testsuite/libgomp.fortran/task-detach-3.f90: Fix formatting.
	* testsuite/libgomp.fortran/task-detach-4.f90: Fix formatting.
	* testsuite/libgomp.fortran/task-detach-5.f90: Fix formatting.
	Change data-sharing of detach events on enclosing parallel to private.
	* testsuite/libgomp.fortran/task-detach-6.f90: Likewise.  Remove
	taskwait directive.
	* testsuite/libgomp.fortran/task-detach-7.f90: New.
	* testsuite/libgomp.fortran/task-detach-8.f90: New.
	* testsuite/libgomp.fortran/task-detach-9.f90: New.
	* testsuite/libgomp.fortran/task-detach-10.f90: New.
	* testsuite/libgomp.fortran/task-detach-11.f90: New.
2021-02-25 14:47:11 -08:00
Patrick Palka
7fb9a1e929 c++: Fix pretty printing the context of local class [PR99213]
My r10-7705 patch for PR94521 made us set TFF_NO_FUNCTION_ARGUMENTS when
pretty printing the function scope of a local class type in order to
eliminate infinite recursion with a function signature that contains
decltype([]{}).  But due to the way dump_function_decl works, this
change regressed our pretty printing of local class types whose context
contains a class template specialization, as in the testcase below, in
which we wrongly pretty print the two local types as 'A<T>::f<char>::S1'
and 'B<T>::f<int>::S2'.

This patch makes dump_scope pass TFF_NO_TEMPLATE_BINDINGS instead of
TFF_NO_FUNCTION_ARGUMENTS when pretty printing a function scope.  It
appears this is the strictly better flag to use: it avoids the infinite
recursion issue, it restores pretty printing of the function parameter
list, and it stops dump_function_decl from trying to print a function
template specialization in its own weird way.

Summary of pretty printing differences for the below testcase:

  r10-7704:   A<T>::f() [with U = char; T = int]::S1
              B<T>::f() [with T = int]::S2

  r10-7705:   A<T>::f<char>::S1
              B<T>::f<int>::S2

  this patch: A<int>::f<char>()::S1
              B<int>::f()::S2

gcc/cp/ChangeLog:

	PR c++/99213
	PR c++/94521
	* error.c (dump_scope): Pass TFF_NO_TEMPLATE_BINDINGS instead of
	TFF_NO_FUNCTION_ARGUMENTS when dumping a function scope.

gcc/testsuite/ChangeLog:

	PR c++/99213
	PR c++/94521
	* g++.dg/diagnostic/local1.C: New test.
2021-02-25 16:44:34 -05:00
Patrick Palka
676f6f3277 c++: Fix CTAD of single-element initializer list [PR99103]
When determining whether to rule out initializer-list constructors
during CTAD with a single-element initializer list (as per P0702), the
element type's cv-qualifiers should be irrelevant.  This patch fixes
this by making is_spec_or_derived strip cv-qualifiers from the supplied
expression type.

In passing, I noticed in maybe_aggr_guide we were calling
is_spec_or_derived with swapped arguments.  This led us to prefer the
aggregate deduction candidate over copying deduction in the second
testcase below with -std=c++20.

gcc/cp/ChangeLog:

	PR c++/99103
	* pt.c (is_spec_or_derived): Drop cv-qualifiers from 'etype'.
	(maybe_aggr_guide): Fix order of arguments to is_spec_or_derived.

gcc/testsuite/ChangeLog:

	PR c++/99103
	* g++.dg/cpp1z/class-deduction79.C: New test.
	* g++.dg/cpp1z/class-deduction80.C: New test.
2021-02-25 16:38:08 -05:00
Marek Polacek
2ffc26458d c++: const_cast of null pointer in constant expr [PR99176]
Here we reject

  constexpr const int *p = nullptr;
  constexpr int *q = const_cast<int*>(p);

with "conversion of 'const int*' null pointer to 'int*' is not a
constant expression", which seems bogus.  This code has been rejected
since r238909 which added the can_convert check when converting a null
pointer.  I'm not finding any standard rule that this check was supposed
to enforce.  The original discussion was here
<https://gcc.gnu.org/legacy-ml/gcc-patches/2016-06/msg01447.html>
and here
<https://gcc.gnu.org/legacy-ml/gcc-patches/2016-07/msg00280.html>.

Since can_convert never assumes a C-style cast, it rejects casting
away constness as in the test above and in:

  constexpr int *q = (int *)(const int *) nullptr;

Removing the check only breaks constexpr-nullptr-2.C by not giving any
diagnostic for line 229:

  constexpr B *pb2 = static_cast<B*>(pa0);  // { dg-error "not a constant expression" }

but the cast seems to be valid: we do [expr.static.cast]/7, and
[expr.const] only says that a reinterpreter_cast and converting from
void* is invalid in constexpr.  The can_convert check rejected convering
from void *, but only when converting from a null pointer, so it's not
good enough.  So I've added a check to catch conversions from cv void*.
I realize it's not a great time to be adding additional checking, but
removing the can_convert check would then technically be a regression.

Let's limit the new check to only trigger for integer_zerop and then remove
it in GCC 12.

gcc/cp/ChangeLog:

	DR 1312
	PR c++/99176
	* constexpr.c (is_std_construct_at): New overload.
	(is_std_allocator_allocate): New overload.
	(cxx_eval_call_expression): Use the new overloads.
	(cxx_eval_constant_expression): Reject casting
	from void * as per DR 1312.  Don't check can_convert.

gcc/testsuite/ChangeLog:

	DR 1312
	PR c++/99176
	* g++.dg/cpp0x/constexpr-nullptr-2.C: Adjust dg-error.
	* g++.dg/cpp0x/constexpr-cast2.C: New test.
	* g++.dg/cpp0x/constexpr-cast3.C: New test.
2021-02-25 16:29:12 -05:00
Iain Sandoe
b8ff3f8efe coroutines : Call promise CTOR with parm copies [PR97587].
As the PR notes, we were calling the promise CTOR with the original
function parameters, not the copy (as pointed, a previous wording of
the section was unambiguous).  Fixed thus.

gcc/cp/ChangeLog:

	PR c++/97587
	* coroutines.cc (struct param_info): Track rvalue refs.
	(morph_fn_to_coro): Track rvalue refs, and call the promise
	CTOR with the frame copy of passed parms.

gcc/testsuite/ChangeLog:

	PR c++/97587
	* g++.dg/coroutines/coro1-refs-and-ctors.h: Add a CTOR with two
	reference parms, to distinguish the rvalue ref. variant.
	* g++.dg/coroutines/pr97587.C: New test.
2021-02-25 19:24:52 +00:00
Iain Sandoe
7005a50d01 coroutines : Remove throwing_cleanup marks from the ramp [PR95822].
The FE contains a mechanism for cleaning up return expressions if a
function throws during the execution of cleanups prior to the return.

If the original function has a return value with a non-trivial DTOR
and the body contains a var with a DTOR that might throw, the function
decl is marked "throwing_cleanup".

However, we do not [in the coroutine ramp function, which is
synthesised], use any body var types with DTORs that might throw.

The original body [which will then contain the type with the throwing
DTOR] is transformed into the actor function which only contains void
returns, and is also wrapped in a try-catch block.

So (a) the 'throwing_cleanup' is no longer correct for the ramp and
   (b) we do not need to transfer it to the actor which only contains
       void returns.

gcc/cp/ChangeLog:

	PR c++/95822
	* coroutines.cc (morph_fn_to_coro): Unconditionally remove any
	set throwing_cleanup marker.

gcc/testsuite/ChangeLog:

	PR c++/95822
	* g++.dg/coroutines/pr95822.C: New test.
2021-02-25 19:24:33 +00:00
Iain Sandoe
5051c12173 aarch64 : Mark rotate immediates with '#' as per DDI0487iFc.
The armv8_arm manual [C6.2.226, ROR (immediate)] uses a # in front
of the immediate rotation quantity.

Although, it seems, GAS is able to infer the # (or is leninent about
its absence) assemblers based on the LLVM back end expect it.

gcc/ChangeLog:

	* config/aarch64/aarch64.md (<optab>_rol<mode>3): Add a '#'
	mark in front of the immediate quantity.
	(<optab>_rolsi3_uxtw): Likewise.
2021-02-25 19:24:10 +00:00
Richard Earnshaw
44ab1cc1df arm: force use of r4 for __gnu_cmse_nonsecure_call when !FPCXT [PR99271]
Commit r10-6017 relaxed the constraint on thumb2 calls to
__gnu_cmse_nonsecure_call to allow any register for the call address.
Although the initial code expansion continues to use r4 with the FPCXT
extension is not enabled, the change was unsafe because subsequent
optimizations could use the additional freedom to change which
register was being used.

To fix this we need to split the output patterns in the machine
description to use distinct recognizers: one with the additional
freedom when FPCXT is enabled an another that retains the original
restrictions when the extension is not available.

gcc:
	PR target/99271
	* config/arm/thumb2.md (nonsecure_call_reg_thumb2_fpcxt): New pattern.
	(nonsecure_call_value_reg_thumb2_fpcxt): Likewise.
	(nonsecure_call_reg_thumb2): Restrict to using r4 for the callee
	address and disable when the FPCXT is not available.
	(nonsecure_call_value_reg_thumb2): Likewise.

gcc/testsuite:
	* gcc.target/arm/cmse/cmse-18.c: New test.
2021-02-25 17:16:40 +00:00
Nathan Sidwell
9592deabf3 c++: Rename new -flang-note-module-read option [PR 99166]
I realized that the just-added flang-note-module-read option should
also cover module writes, and was therefore misnamed.  This addresses
that, replacing it with a -flang-note-module-cmi pair of options.  As
this was such a recent addition, I didn't leave the old option
available.

	PR c++/99166
	gcc/c-family/
	* c.opt (-flang-info-module-cmi): Renamed option.
	gcc/
	* doc/invoke.texi (flang-info-module-cmi): Renamed option.
	gcc/cp/
	* module.cc (module_state::inform_cmi_p): Renamed field.
	(module_state::do_import): Adjust.
	(init_modules, finish_module_processing): Likewise.
	(handle_module_option): Likewise.
	gcc/testsuite/
	* g++.dg/modules/pr99166_a.X: Adjust.
	* g++.dg/modules/pr99166_b.C: Adjust.
	* g++.dg/modules/pr99166_c.C: Adjust.
	* g++.dg/modules/pr99166_d.C: Adjust.
2021-02-25 08:58:26 -08:00
Nathan Sidwell
9f08c08531 c++tools: Make NETWORKING define check consistent [PR 98318]
PR98318 also pointed out that the NETWORKING #define was being checked
with both #if and #ifdef.  Let's consistently use one form.

	c++tools/
	* server.cc: Use #if NETWORKING not #ifdef, to be consistent
	with elsewhere.
2021-02-25 08:58:26 -08:00
Jonathan Wakely
a47cec4ca7 libstdc++: Use uint32_t for all year_month_day::_S_from_days arithmetic
libstdc++-v3/ChangeLog:

	* include/std/chrono (year_month_day::_S_from_days): Perform
	all calculations with type uint32_t.
2021-02-25 16:57:20 +00:00
Hans-Peter Nilsson
232f746116 pr95690.f90: move error line for CRIS.
I don't know what it is that ix86, x86_64, Solaris and
apparently CRIS has in common here.

According to
https://gcc.gnu.org/pipermail/gcc-testresults/2021-February/652763.html
m68k-unknown-linux-gnu is also in that bunch, but since
there's a *-*-solaris* in the target specifier and also m68k
vs. m68k*, I'm leaving the adjustment to a maintainer.

gcc/testsuite:
	* gfortran.dg/pr95690.f90: CRIS error appears on line 5.
2021-02-25 17:32:37 +01:00
Tamar Christina
28af4b9a7c slp: Don't traverse tree on (nil) nodes.
The given testcase shows that one of the children of the complex MUL contains a
PHI node.  This results in the vectorizer having a child that's (nil).

The pattern matcher handles this correctly, but optimize_load_redistribution_1
needs to not traverse/inspect the NULL nodes.

This however does high-light a missed opportunity.  This testcase seems to
result in a different canonicalization than normally.

Normally the expressions are right leaning.  But sometimes, especially when type
casts are introduced the trees suddenly become left leaning. For instance this
testcase (even without type casts) won't detect the FMA form because the addition
gets the MUL node in the left and not right node as it expects.

Checking all forms would be quite expensive so for GCC 12 it probably makes sense to make
forms with type casts in them have the same form as those without?

gcc/ChangeLog:

	* tree-vect-slp.c (optimize_load_redistribution_1): Abort on NULL nodes.

gcc/testsuite/ChangeLog:

	* g++.dg/vect/simd-complex-num-null-node.cc: New test.
2021-02-25 16:27:50 +00:00
Vladimir N. Makarov
557a0d3b1b [PR99233] tesstsuite: Run test pr96264.c only for little endian
The test in question is assumed to work only for little endian target.

gcc/testsuite/ChangeLog:

	PR testsuite/99233
	* gcc.target/powerpc/pr96264.c: Run it only for powerpc64le.
2021-02-25 11:24:10 -05:00
Christophe Lyon
01c2ce169a PR middle-end/97172 - ICE: tree code 'ssa_name' is not supported in LTO streams
Skip test when -shared is not supported.

2021-02-25  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	PR middle-end/97172
	* gcc.dg/pr97172-2.c: Add dg-require-effective-target shared.
2021-02-25 16:03:28 +00:00
Jonathan Wakely
ed255fd5ed libstdc++: Document library versioning for GCC 11
libstdc++-v3/ChangeLog:

	* doc/xml/manual/abi.xml: Document versioning for GCC 11.
	* doc/html/manual/abi.html: Regenerate.
2021-02-25 15:35:59 +00:00
Jonathan Wakely
31002af904 libstdc++: Do not assume std::FILE is complete [PR 99270]
libstdc++-v3/ChangeLog:

	PR libstdc++/99270
	* testsuite/27_io/headers/cstdio/types_std.cc: Use pointer to
	FILE instead of FILE.
2021-02-25 15:35:58 +00:00
Andreas Schwab
e54e7286cc libstdc++: Update baseline symbols for {aarch64,ia64,m68k,riscv64}-linux
libstdc++-v3/
	* config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/ia64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/m68k-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/riscv64-linux-gnu/baseline_symbols.txt: Update.
2021-02-25 14:19:00 +01:00
Nathan Sidwell
2bf9e68a95 c++: Fix typo in module-mapper [PR 98318]
User reported this typo: '0' and '-' are right next to each other, and
as it happened I always had networking, so it went unnoticed.

	PR c++/98318
	gcc/cp/
	* mapper-client.cc (module_client::open_module_client): Fix typo
	of fd init.
2021-02-25 05:00:09 -08:00