Commit Graph

178467 Commits

Author SHA1 Message Date
Thomas Koenig
3055d879ed Fix handling of implicit_pure by checking if non-pure procedures are called.
Procedures are marked as implicit_pure if they fulfill the criteria of
pure procedures.  In this case, a procedure was not marked as not being
implicit_pure which called another procedure, which had not yet been
marked as not being implicit_impure.

Fixed by iterating over all procedures, setting callers of procedures
which are non-pure and non-implicit_pure as non-implicit_pure and
doing this until no more procedure has been changed.

gcc/fortran/ChangeLog:

2020-07-19  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/96018
	* frontend-passes.c (gfc_check_externals): Adjust formatting.
	(implicit_pure_call): New function.
	(implicit_pure_expr): New function.
	(gfc_fix_implicit_pure): New function.
	* gfortran.h (gfc_fix_implicit_pure): New prototype.
	* parse.c (translate_all_program_units): Call gfc_fix_implicit_pure.
2020-07-19 12:23:43 +02:00
Hans-Peter Nilsson
7cc34b761c gcc.dg/attr-copy-6.c: Require visibility.
Another trivial one.

gcc/testsuite:
	* gcc.dg/attr-copy-6.c: Require visibility.
2020-07-19 05:55:18 +02:00
Hans-Peter Nilsson
4058650cf2 gcc.dg/Wno-frame-address.c: Skip for cris and mmix.
Long-standing FAIL remedied; committed.  Maybe better to list
the targets that *do* support arbitrary frame access?

gcc/testsuite:
	* gcc.dg/Wno-frame-address.c: Skip for cris and mmix.
2020-07-19 05:18:57 +02:00
GCC Administrator
aeb34e1514 Daily bump. 2020-07-19 00:16:22 +00:00
Jakub Jelinek
2f1d4cb54e testsuite: Fix pragma-eof.c failure due to added line to the test.
2020-07-18  Jakub Jelinek  <jakub@redhat.com>

	* c-c++-common/cpp/pragma-eof.c: Use .+3 instead of 6 in
	dg-error.
2020-07-18 23:09:56 +02:00
David Edelsohn
a36b14a333 fortran: Restore translation to hint.
This patch restore translation for the variable hint.  The translation
tag conflicted with the previous declaration of hint as char[] and
broke bootstrap, so the translation tags were removed.  The
declaration was changed to char *.  This patch restores the translation
tags to the string.

gcc/fortran/ChangeLog

2020-07-18  David Edelsohn  <dje.gcc@gmail.com>

	* check.c (gfc_invalid_boz): Mark hint for translation using _().
2020-07-18 12:06:52 -04:00
David Edelsohn
60c1baebba testsuite: fix goacc/finalize-1.f "original" regex for 32 bits.
The "bias" portion of the regex for "original" expects

bias: (integer(kind=<N>) parm.0.data - (integer(kind=<N>)) del_f_p.data

(or cpo_f_p.data)

on 32 bit platforms, the dump file can show (signed int) instead of
(integer(kind=8)... .  This patch adjusts the regex to allow any content
containing the word int between the parentheses.

2020-07-18  David Edelsohn  <dje.gcc@gmail.com>

gcc/testsuite/ChangeLog

	* gfortran.dg/goacc/finalize-1.f: Adjust regex for 32 bits.
2020-07-18 12:00:41 -04:00
H.J. Lu
7aa22a8f1a x86-64: Define ASM_OUTPUT_ALIGNED_DECL_LOCAL
Define ASM_OUTPUT_ALIGNED_DECL_LOCAL for large local common symbol.

gcc/

	PR target/95620
	* config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): New.

libgomp/

	PR target/95620
	* testsuite/libgomp.c/pr95620.c: New test.
2020-07-18 08:51:54 -07:00
Hans-Peter Nilsson
0b7e26d8f9 testsuite/c-c++-common/cpp/pragma-eof.c: Add missing require fopenmp
Committed as obvious.  Gets rid of a spurious failure for mmix.

gcc/testsuite:
	* c-c++-common/cpp/pragma-eof.c: Require fopenmp.
2020-07-18 05:28:20 +02:00
Peter Bergner
8a8c257356 rs6000: Generate _Decimal128 to _Decimal32 hardware conversion instructions
We do not currently generate hardware conversion instructions when
converting from _Decimal128 to _Decimal32.  There is no one instruction
that does the conversion, so we currently call the __dpd_trunctdsd2
lib function to do the conversion for us.  However, there is a short
sequence of dfp hardware instructions that will do the conversion
correctly.

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

gcc/
	PR target/92488
	* config/rs6000/dfp.md (trunctdsd2): New define_insn.
	* config/rs6000/rs6000.md (define_attr "isa"): Add p9.
	(define_attr "enabled"): Handle p9.

gcc/testsuite/
	PR target/92488
	* gcc.target/powerpc/convert-fp-128.c (bl, drsp, drdpq): Update counts.
	(__dpd_trunctdsd2): Make conditional on !hard_dfp.
	(__dpd_extendsddd2, __dpd_extendsdtd2, __dpd_truncddsd2,
	__dpd_extendddtd2, __dpd_trunctddd2): Use !hard_dfp.
	* gcc.target/powerpc/pr92488.c: New test.
2020-07-17 21:11:23 -05:00
GCC Administrator
ab660b01c3 Daily bump. 2020-07-18 00:16:24 +00:00
Ian Lance Taylor
d5dfd4793f libgo: update to Go 1.14.6 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/243317
2020-07-17 14:28:28 -07:00
Iain Sandoe
f1b6e46c41 libstdc++, coroutine: Add missing constexpr markers.
The methods of the trivial awaitables are intended to
be constexpr.

libstdc++-v3/ChangeLog:

	* include/std/coroutine: Mark the methods of the
	trivial awaitables as constexpr.
2020-07-17 19:51:09 +01:00
Marek Polacek
e7f0873a9c c++: Diagnose cv-qualified decltype(auto) [PR79815]
"If the placeholder is the decltype(auto) type-specifier, T shall be the
placeholder alone." but we weren't detecting "const decltype(auto)".

I've just expanded the existing diagnostic detecting "decltype(auto) &"
and similar.

gcc/cp/ChangeLog:

	PR c++/79815
	* decl.c (grokdeclarator): Detect cv-qual decltype(auto).
	* pt.c (do_auto_deduction): Likewise.

gcc/testsuite/ChangeLog:

	PR c++/79815
	* g++.dg/cpp1y/auto-fn59.C: New test.
2020-07-17 11:43:39 -04:00
Roger Sayle
c08ff9f819 middle-end: Prefer TRULY_NOOP_TRUNCATION_MODES_P over raw target hook.
2020-07-16  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	* function.c (assign_parm_setup_block): Use the macro
	TRULY_NOOP_TRUNCATION_MODES_P instead of calling
	targetm.truly_noop_truncation directly.
2020-07-17 14:06:45 +01:00
H.J. Lu
737355072a x86: Rename VF_AVX512VL_VF1_128_256 to VF1_AVX512ER_128_256
Since ix86_emit_swsqrtsf shouldn't be called with DF vector modes, rename
VF_AVX512VL_VF1_128_256 to VF1_AVX512ER_128_256 and drop DF vector modes.

gcc/

	PR target/96186
	PR target/88713
	* config/i386/sse.md (VF_AVX512VL_VF1_128_256): Renamed to ...
	(VF1_AVX512ER_128_256): This.  Drop DF vector modes.
	(rsqrt<mode>2): Replace VF_AVX512VL_VF1_128_256 with
	VF1_AVX512ER_128_256.

gcc/testsuite/

	PR target/96186
	PR target/88713
	* gcc.target/i386/pr88713-3.c: New test.
2020-07-17 05:29:30 -07:00
Tamar Christina
8bc83ee378 AArch64: Add test for -mcpu=native
This adds some tests to the GCC testsuite for testing the
-mcpu=native code.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/cpunative/aarch64-cpunative.exp: New test.
	* gcc.target/aarch64/cpunative/info_0: New test.
	* gcc.target/aarch64/cpunative/info_1: New test.
	* gcc.target/aarch64/cpunative/info_10: New test.
	* gcc.target/aarch64/cpunative/info_11: New test.
	* gcc.target/aarch64/cpunative/info_12: New test.
	* gcc.target/aarch64/cpunative/info_13: New test.
	* gcc.target/aarch64/cpunative/info_14: New test.
	* gcc.target/aarch64/cpunative/info_15: New test.
	* gcc.target/aarch64/cpunative/info_2: New test.
	* gcc.target/aarch64/cpunative/info_3: New test.
	* gcc.target/aarch64/cpunative/info_4: New test.
	* gcc.target/aarch64/cpunative/info_5: New test.
	* gcc.target/aarch64/cpunative/info_6: New test.
	* gcc.target/aarch64/cpunative/info_7: New test.
	* gcc.target/aarch64/cpunative/info_8: New test.
	* gcc.target/aarch64/cpunative/info_9: New test.
	* gcc.target/aarch64/cpunative/native_cpu_0.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_1.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_10.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_11.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_12.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_13.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_14.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_15.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_2.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_3.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_4.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_5.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_6.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_7.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_8.c: New test.
	* gcc.target/aarch64/cpunative/native_cpu_9.c: New test.
2020-07-17 13:13:12 +01:00
Tamar Christina
7c4491e33d Testuite: Document environment setting directives
This document some of the existing DejaGnu directives to modify
environment variables before test or compiler invocations.

gcc/ChangeLog:

	* doc/sourcebuild.texi (dg-set-compiler-env-var,
	dg-set-target-env-var): Document.
2020-07-17 13:12:46 +01:00
Tamar Christina
e410cbff5d Testsuite: Make it easier to debug environment setting functions
This adds verbose output to dg-set-compiler-env-var and dg-set-target-env-var
so you can actually see what they're setting when you add -v -v.

gcc/testsuite/ChangeLog:

	* lib/gcc-dg.exp (dg-set-compiler-env-var, dg-set-target-env-var): Add
	verbose output.
2020-07-17 13:12:23 +01:00
Tamar Christina
34a6c43487 Arm: Add GCC_CPUINFO override
This adds an in intentionally undocumented environment variable
GCC_CPUINFO which can be used to test -mcpu=native.

Tests using these are added later on.

gcc/ChangeLog:

	* config/arm/driver-arm.c (host_detect_local_cpu): Add GCC_CPUINFO.
2020-07-17 13:12:00 +01:00
Tamar Christina
55f6addc0c AArch64: Add GCC_CPUINFO override
This adds an in intentionally undocumented environment variable
GCC_CPUINFO which can be used to test -mcpu=native.

Tests using this are added later on.

gcc/ChangeLog:

	* config/aarch64/driver-aarch64.c (host_detect_local_cpu):
	Add GCC_CPUINFO.
2020-07-17 13:10:53 +01:00
Tamar Christina
b399f3c642 AArch64: Fix bugs in -mcpu=native detection.
This patch fixes a couple of issues in AArch64's -mcpu=native processing:

The buffer used to read the lines from /proc/cpuinfo is 128 bytes long.  While
this was enough in the past with the increase in architecture extensions it is
no longer enough.   It results in two bugs:

1) No option string longer than 127 characters is correctly parsed.  Features
   that are supported are silently ignored.

2) It incorrectly enables features that are not present on the machine:
  a) It checks for substring matching instead of full word matching.  This makes
     it incorrectly detect sb support when ssbs is provided instead.
  b) Due to the truncation at the 127 char border it also incorrectly enables
     features due to the full feature being cut off and the part that is left
     accidentally enables something else.

This breaks -mcpu=native detection on some of our newer system.

The patch fixes these issues by reading full lines up to the \n in a string.
This gives us the full feature line.  Secondly it creates a set from this string
to:

 1) Reduce matching complexity from O(n*m) to O(n*logm).
 2) Perform whole word matching instead of substring matching.

To make this code somewhat cleaner I also changed from using char* to using
std::string and std::set.

Note that I have intentionally avoided the use of ifstream and stringstream
to make it easier to backport.  I have also not change the substring matching
for the initial line classification as I cannot find a documented cpuinfo format
which leads me to believe there may be kernels out there that require this which
may be why the original code does this.

I also do not want this to break if the kernel adds a new line that is long and
indents the file by two tabs to keep everything aligned.  In short I think an
imprecise match is the right thing here.

Test for this is added as the last thing in this series as it requires some
changes to be made to be able to test this.

gcc/ChangeLog:

	* config/aarch64/driver-aarch64.c (INCLUDE_SET): New.
	(parse_field): Use std::string.
	(split_words, readline, find_field): New.
	(host_detect_local_cpu): Fix truncation issues.
2020-07-17 13:10:28 +01:00
Andrew Stubbs
42b47dae49 amdgcn: Fix elf.h build issue
Allow building on systems with elf.h that includes AMDGPU definitions,
partially or completely.

gcc/ChangeLog:

	* config/gcn/mkoffload.c (EM_AMDGPU): Undefine before defining.
	(ELFOSABI_AMDGPU_HSA): Likewise.
	(ELFABIVERSION_AMDGPU_HSA): Likewise.
	(EF_AMDGPU_MACH_AMDGCN_GFX803): Likewise.
	(EF_AMDGPU_MACH_AMDGCN_GFX900): Likewise.
	(EF_AMDGPU_MACH_AMDGCN_GFX906): Likewise.
	(reserved): Delete.
2020-07-17 11:51:26 +01:00
Dmitrij Pochepko
c9c87e6f9c vector creation from two parts of two vectors produces TBL rather than ins (PR 93720)
The following patch enables vector permutations optimization by trying
to use ins instruction instead of slow and generic tbl.

example:

vector float f0(vector float a, vector float b)
{
  return __builtin_shuffle (a, a, (vector int){3, 1, 2, 3});
}

was compiled into:
...
	adrp    x0, .LC0
	ldr     q1, [x0, #:lo12:.LC0]
	tbl     v0.16b, {v0.16b}, v1.16b
...

and after patch:
...
	ins     v0.s[0], v0.s[3]
...

bootstrapped and tested on aarch64-linux-gnu with no regressions

gcc/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

	PR target/93720
	* config/aarch64/aarch64.c (aarch64_evpc_ins): New function.
	(aarch64_expand_vec_perm_const_1): Call it.
	* config/aarch64/aarch64-simd.md (aarch64_simd_vec_copy_lane): Make
	public, and add a "@" prefix.

gcc/testsuite/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

	PR target/93720
	* gcc.target/aarch64/vins-1.c: New test.
	* gcc.target/aarch64/vins-2.c: New test.
	* gcc.target/aarch64/vins-3.c: New test.

Co-Authored-By: Dmitrij Pochepko <dmitrij.pochepko@bell-sw.com>
2020-07-17 10:24:46 +01:00
Dmitrij Pochepko
7efc03fd2c __builtin_shuffle sometimes should produce zip1 rather than TBL (PR82199)
The following patch enables vector permutations optimization by using
another vector element size when applicable.  It allows usage of simpler
instructions in applicable cases.

example:

vector float f(vector float a, vector float b)
{
  return __builtin_shuffle  (a, b, (vector int){0, 1, 4,5});
}

was compiled into:
...
	adrp    x0, .LC0
	ldr     q2, [x0, #:lo12:.LC0]
	tbl     v0.16b, {v0.16b - v1.16b}, v2.16b
...

and after patch:
...
	zip1    v0.2d, v0.2d, v1.2d
...

bootstrapped and tested on aarch64-linux-gnu with no regressions

gcc/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

	PR target/82199
	* config/aarch64/aarch64.c (aarch64_evpc_reencode): New function.
	(aarch64_expand_vec_perm_const_1): Call it.

gcc/testsuite/ChangeLog:

2020-07-17  Andrew Pinski  <apinksi@marvell.com>

	PR target/82199
	* gcc.target/aarch64/vdup_n_3.c: New test.
	* gcc.target/aarch64/vzip_1.c: New test.
	* gcc.target/aarch64/vzip_2.c: New test.
	* gcc.target/aarch64/vzip_3.c: New test.
	* gcc.target/aarch64/vzip_4.c: New test.

Co-Authored-By: Dmitrij Pochepko <dmitrij.pochepko@bell-sw.com>
2020-07-17 10:20:12 +01:00
xiezhiheng
bf592b2ff7 AArch64: Add flags in built-in functions [PR94442]
2020-07-17  Zhiheng Xie  <xiezhiheng@huawei.com>

gcc/ChangeLog:

	* config/aarch64/aarch64-builtins.c (enum aarch64_type_qualifiers):
	Add new field flags.
	(VAR1): Add new field FLAG in macro.
	(VAR2): Likewise.
	(VAR3): Likewise.
	(VAR4): Likewise.
	(VAR5): Likewise.
	(VAR6): Likewise.
	(VAR7): Likewise.
	(VAR8): Likewise.
	(VAR9): Likewise.
	(VAR10): Likewise.
	(VAR11): Likewise.
	(VAR12): Likewise.
	(VAR13): Likewise.
	(VAR14): Likewise.
	(VAR15): Likewise.
	(VAR16): Likewise.
	(aarch64_general_fold_builtin): Likewise.
	(aarch64_general_gimple_fold_builtin): Likewise.
	* config/aarch64/aarch64-simd-builtins.def: Add default flag for
	each built-in function.
	* config/aarch64/geniterators.sh: Add new field in BUILTIN macro.
2020-07-17 10:00:37 +01:00
Jonathan Wakely
0c1d1c0103 gcc-changelog: Fix typo in output
contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: Fix typo.
2020-07-17 09:53:19 +01:00
Andreas Krebbel
8002956182 Fix PR96127
In s390_expand_insv the movstrict patterns are always generated with a
CC clobber although only movstricthi actually needs one.  The patch
invokes the expanders instead of constructing the pattern by hand.

Bootstrapped and regression tested on s390x.

gcc/ChangeLog:

	PR target/96127
	* config/s390/s390.c (s390_expand_insv): Invoke the movstrict
	expanders to generate the pattern.
	* config/s390/s390.md ("*movstricthi", "*movstrictqi"): Remove the
	'*' to have callable expanders.

gcc/testsuite/ChangeLog:

	PR target/96127
	* gcc.target/s390/pr96127.c: New test.
2020-07-17 09:26:49 +02:00
Kewen Lin
0757d3660c rs6000/test: Add -fno-vect-cost-model to conv-vectorize-[12].c
In my testing with cost tweaking for vector with length, I found
two cases below didn't get the expected output.  Since the expected
instructions reply on the vectorization occurrence, we don't expect
vectorization gets disabled by cost model.

To make it not fragile, the fix is to force it without vect cost model.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/conv-vectorize-1.c: Add option
	-fno-vect-cost-model.
	* gcc.target/powerpc/conv-vectorize-2.c: Likewise.
2020-07-17 00:31:03 -05:00
GCC Administrator
96686b3fcd Daily bump. 2020-07-17 00:16:27 +00:00
Segher Boessenkool
84c5396d4b combine: Use single_set for is_just_move
Since we now only call is_just_move on the original instructions, we
always have an rtx_insn* (not just a pattern), so we can use single_set
on it.  This makes no detectable difference at all on all thirty Linux
targets I test, but it does help cris, and it is simpler, cleaner code
anyway.

2020-07-16  Hans-Peter Nilsson  <hp@axis.com>
	    Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/93372
	* combine.c (is_just_move): Take an rtx_insn* as argument.  Use
	single_set on it.
2020-07-16 23:52:19 +00:00
Julian Brown
39dda00208 openacc: Fix standalone attach for Fortran assumed-shape array pointers
This patch makes it so that an "attach" operation for a Fortran pointer
with an array descriptor copies that array descriptor to the target,
and similarly that detach operations release the array descriptor.

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

gcc/fortran/
	* trans-openmp.c (gfc_trans_omp_clauses): Rework OpenACC
	attach/detach handling for arrays with descriptors.

gcc/testsuite/
	* gfortran.dg/goacc/attach-descriptor.f90: New test.

libgomp/
	* testsuite/libgomp.oacc-fortran/attach-descriptor-1.f90: New test.
	* testsuite/libgomp.oacc-fortran/attach-descriptor-2.f90: New test.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
2020-07-16 14:12:53 -07:00
Iain Sandoe
0f66b8486c coroutines: Correct frame capture of compiler temps [PR95591+4].
When a full expression contains a co_await (or co_yield), this means
that it might be suspended; which would destroy temporary variables
(on a stack for example).  However the language guarantees that such
temporaries are live until the end of the expression.

In order to preserve this, we 'promote' temporaries where necessary
so that they are saved in the coroutine frame (which allows them to
remain live potentially until the frame is destroyed).  In addition,
sub-expressions that produce control flow (such as TRUTH_AND/OR_IF
or COND_EXPR) must be handled specifically to ensure that await
expressions are properly expanded.

This patch corrects two mistakes in which we were (a) failing to
promote some temporaries and (b) we we failing to sequence DTORs for
the captures properly. This manifests in a number of related (but not
exact duplicate) PRs.

The revised code collects the actions into one place and maps all the
control flow into one form - a benefit of this is that co_returns are
now expanded earlier (which provides an opportunity to address PR95517
in some future patch).

We replace a statement that contains await expression(s) with a bind
scope that has a variable list describing the temporaries that have
been 'promoted' and a statement list that contains a series of cleanup
expressions for each of those.  Where we encounter nested conditional
expressions, these are wrapped in a try-finally block with a guard var
for each sub-expression variable that needs a DTOR.  The guards are all
declared and initialized to false before the first conditional sub-
expression.  The 'finally' block contains a series of if blocks (one
per guard variable) enclosing the relevant DTOR.

Variables listed in a bind scope in this manner are automatically moved
to a coroutine frame version by existing code (so we re-use that rather
than having a separate mechanism).

gcc/cp/ChangeLog:

	PR c++/95591
	PR c++/95599
	PR c++/95823
	PR c++/95824
	PR c++/95895
	* coroutines.cc (struct coro_ret_data): Delete.
	(coro_maybe_expand_co_return): Delete.
	(co_return_expander): Delete.
	(expand_co_returns): Delete.
	(co_await_find_in_subtree): Remove unused name.
	(build_actor_fn): Remove unused parm, remove handling
	for co_return expansion.
	(register_await_info): Demote duplicate info message to a
	warning.
	(coro_make_frame_entry): Move closer to use site.
	(struct susp_frame_data): Add fields for final suspend label
	and a flag to indicate await expressions with initializers.
	(captures_temporary): Delete.
	(register_awaits): Remove unused code, update comments.
	(find_any_await): New.
	(tmp_target_expr_p): New.
	(struct interesting): New.
	(find_interesting_subtree): New.
	(struct var_nest_node): New.
	(flatten_await_stmt): New.
	(handle_nested_conditionals): New.
	(process_conditional): New.
	(replace_statement_captures): Rename to...
	(maybe_promote_temps): ... this.
	(maybe_promote_captured_temps): Delete.
	(analyze_expression_awaits): Check for await expressions with
	initializers.  Simplify handling for truth-and/or-if.
	(expand_one_truth_if): Simplify (map cases that need expansion
	to COND_EXPR).
	(await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
	handling for truth-and/or-if expressions.
	(register_local_var_uses): Ensure that we create names in the
	implementation namespace.
	(morph_fn_to_coro): Add final suspend label to suspend frame
	callback data and remove it from the build_actor_fn call.

gcc/testsuite/ChangeLog:

	PR c++/95591
	PR c++/95599
	PR c++/95823
	PR c++/95824
	PR c++/95895
	* g++.dg/coroutines/pr95591.C: New test.
	* g++.dg/coroutines/pr95599.C: New test.
	* g++.dg/coroutines/pr95823.C: New test.
	* g++.dg/coroutines/pr95824.C: New test.
2020-07-16 22:01:52 +01:00
Jonathan Wakely
75edc31f9e analyzer: Use noexcept instead of throw() for C++11 and later (PR 96014)
gcc/testsuite/ChangeLog:

	PR testsuite/96014
	* g++.dg/analyzer/pr94028.C: Replace dynamic exception
	specification with noexcept-specifier for C++11 and later.
2020-07-16 21:24:24 +01:00
Uros Bizjak
cc1ef413a8 i386: Additional peephole2 to use flags from CMPXCHG more [PR96189]
CMPXCHG instruction sets ZF flag if the values in the destination operand
and EAX register are equal; otherwise the ZF flag is cleared and value
from destination operand is loaded to EAX. Following assembly:

        xorl    %eax, %eax
        lock cmpxchgl   %edx, (%rdi)
        testl   %eax, %eax
        sete    %al

can be optimized by removing the unneeded comparison, since set ZF flag
signals that no update to EAX happened.  This patch adds peephole2
pattern to also handle XOR zeroing and load of -1 by OR.

2020-07-16  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
	PR target/96189
	* config/i386/sync.md
	(peephole2 to remove unneded compare after CMPXCHG):
	New pattern, also handle XOR zeroing and load of -1 by OR.

gcc/testsuite/ChangeLog:
	PR target/96189
	* gcc.target/i386/pr96189-1.c: New test.
2020-07-16 20:13:06 +02:00
Eric Botcazou
f569026aa3 Reunify x86 stack checking implementation
The stack clash protection mechanism in the x86 back-end was implemented
by largely duplicating the existing stack checking implementation.  Now
the only significant difference between them is the probing window, which
is shifted by 1 probing interval (not 2 as documented in explow.c), but we
can certainly do 1 more probe for stack checking even if it is redundant
in almost all cases.

gcc/ChangeLog:
	* config/i386/i386.c (ix86_compute_frame_layout): Minor tweak.
	(ix86_adjust_stack_and_probe): Delete.
	(ix86_adjust_stack_and_probe_stack_clash): Rename to above and add
	PROTECTION_AREA parameter.  If it is true, probe PROBE_INTERVAL plus
	a small dope beyond SIZE bytes.
	(ix86_emit_probe_stack_range): Use local variable.
	(ix86_expand_prologue): Adjust calls to ix86_adjust_stack_and_probe
	and tidy up the stack checking code.
	* explow.c (get_stack_check_protect): Fix head comment.
	(anti_adjust_stack_and_probe_stack_clash): Likewise.
	(allocate_dynamic_stack_space): Add comment.

	* tree-nested.c (lookup_field_for_decl): Set the DECL_IGNORED_P and
	TREE_NO_WARNING but not TREE_ADDRESSABLE flags on the field.
2020-07-16 18:13:56 +02:00
Marek Polacek
a54d71cb66 c++: Add test for DR 188.
gcc/testsuite/ChangeLog:

	DR 188
	* g++.dg/DRs/dr188.C: New test.
2020-07-16 12:11:42 -04:00
Andrew Stubbs
a4f49061b6 amdgcn: Handle early debug info in mkoffload
Forward the early debug information from the input LTO file to the output
HSACO file, in the same way lto-wrapper does.  This is a little more
complicated, however, because the ELF file containing the debug needs to be
converted from x86_64 to amdgcn, and because the offloaded code will have less
content than the host program the debug info describes.

gcc/ChangeLog:

	* config/gcn/mkoffload.c: Include simple-object.h and elf.h.
	(EM_AMDGPU): New macro.
	(ELFOSABI_AMDGPU_HSA): New macro.
	(ELFABIVERSION_AMDGPU_HSA): New macro.
	(EF_AMDGPU_MACH_AMDGCN_GFX803): New macro.
	(EF_AMDGPU_MACH_AMDGCN_GFX900): New macro.
	(EF_AMDGPU_MACH_AMDGCN_GFX906): New macro.
	(R_AMDGPU_NONE): New macro.
	(R_AMDGPU_ABS32_LO): New macro.
	(R_AMDGPU_ABS32_HI): New macro.
	(R_AMDGPU_ABS64): New macro.
	(R_AMDGPU_REL32): New macro.
	(R_AMDGPU_REL64): New macro.
	(R_AMDGPU_ABS32): New macro.
	(R_AMDGPU_GOTPCREL): New macro.
	(R_AMDGPU_GOTPCREL32_LO): New macro.
	(R_AMDGPU_GOTPCREL32_HI): New macro.
	(R_AMDGPU_REL32_LO): New macro.
	(R_AMDGPU_REL32_HI): New macro.
	(reserved): New macro.
	(R_AMDGPU_RELATIVE64): New macro.
	(gcn_s1_name): Delete global variable.
	(gcn_s2_name): Delete global variable.
	(gcn_o_name): Delete global variable.
	(gcn_cfile_name): Delete global variable.
	(files_to_cleanup): New global variable.
	(offload_abi): New global variable.
	(tool_cleanup): Use files_to_cleanup, not explicit list.
	(copy_early_debug_info): New function.
	(main): New local variables gcn_s1_name, gcn_s2_name, gcn_o_name,
	gcn_cfile_name.
	Create files_to_cleanup obstack.
	Recognize -march options.
	Copy early debug info from input .o files.
2020-07-16 16:05:45 +01:00
Uros Bizjak
866c5bfd9c Fix ChangeLog PR number. 2020-07-16 16:37:04 +02:00
Marek Polacek
3594ef5521 c++: Get rid of convert_like* macros.
The convert_like* macros were introduced in

  2000-03-05  Nathan Sidwell  <nathan@codesourcery.com>

        * call.c (convert_like): Macrofy.
        (convert_like_with_context): New macro.

but now we can use overloading so we can do away with the macros.
I've also taken this chance to rename _real to _internal to make it
clear that it should not be called directly.

No functional change intended.

gcc/cp/ChangeLog:

	* call.c (convert_like): Remove macro and introduce a new
	wrapper instead.
	(convert_like_with_context): Likewise.
	(convert_like_real): Rename to convert_like.
	(convert_like_real_1): Rename to convert_like_internal.  Call
	convert_like instead of convert_like_real therein.
	(perform_direct_initialization_if_possible): Call convert_like
	instead of convert_like_real.
2020-07-16 09:29:38 -04:00
Iain Sandoe
a2086f986e coroutines: Spelling corrections in comments [NFC].
Correct some typos.

gcc/cp/ChangeLog:

	* coroutines.cc: Correct some spelling errors
	in comments.
2020-07-16 13:57:17 +01:00
Andrea Corallo
53a1cb8e74 build: Fix TAGS target in gcc/Makefile.in
gcc/ChangeLog:

2020-07-16  Andrea Corallo  <andrea.corallo@arm.com>

	* Makefile.in (TAGS): Remove 'params.def'.
2020-07-16 14:44:45 +02:00
Roger Sayle
5abe0d81db doc: Document TARGET_TRULY_NOOP_TRUNCATION requires trunc?i?i2 patterns.
2020-07-16  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog:
	* target.def (TARGET_TRULY_NOOP_TRUNCATION): Clarify that
	targets that return false, indicating SUBREGs shouldn't be
	used, also need to provide a trunc?i?i2 optab that performs this
	truncation.
	* doc/tm.texi: Regenerate.
2020-07-16 11:47:47 +01:00
Javier Miranda
135c02769b [Ada] Misplace of internal master renaming declaration
gcc/ada/

	* exp_ch3.adb (Expand_N_Full_Type_Declaration): Ensure a _master
	declaration on limited types that might have tasks.
	* exp_ch9.adb (Build_Master_Renaming): For private types, if we
	are processing declarations in the private part, ensure that
	master is inserted before its full declaration; otherwise the
	master renaming may be inserted in the public part of the
	package (and hence before the declaration of its _master
	variable).
2020-07-16 05:18:20 -04:00
Arnaud Charlet
ca320dabf0 [Ada] AI12-0132 Freezing of renames_as_body
gcc/ada/

	* sem_ch8.adb (Analyze_Subprogram_Renaming): A renames-as-body
	freezes the expression of any expression function that it
	renames.
2020-07-16 05:18:19 -04:00
Ed Schonberg
7a21651f33 [Ada] Ongoing work for AI12-0212 : container aggregates
gcc/ada/

	* sem_aggr.adb (Resolve_Container_Aggregate): Add semantic
	checks for indexed aggregates, including component associations
	and iterated component associations.
	* exp_aggr.adb (Expand_Iterated_Component): New subprogram,
	subsidiary of Expand_Container_Aggreggate, used for positional,
	named, and indexed aggregates.
	(Aggregate_Size): New subprogram to precompute the size of an
	indexed aggregate prior to call to allocate it.
	(Expand_Range_Component): New subprogram so generate loop for a
	component association given by a range or a subtype name in an
	indexed aggregate.
2020-07-16 05:18:18 -04:00
Bob Duff
81fcf43389 [Ada] gnatbind: Fix No_Entry_Calls_In_Elaboration_Code message
gcc/ada/

	* bindo-diagnostics.adb (Output_Invocation_Related_Suggestions):
	Use Cumulative_Restrictions.Set, because Restriction_Active only
	works at compile time.
2020-07-16 05:18:18 -04:00
Bob Duff
47484baae5 [Ada] Ada2020: AI12-0117 Restriction No_Tasks_Unassigned_To_CPU
gcc/ada/

	* gnatbind.adb (Gnatbind): For No_Tasks_Unassigned_To_CPU, check
	that CPU has been set on the main subprogram.
	(Restriction_Could_Be_Set): Don't print
	No_Tasks_Unassigned_To_CPU if it would violate the
	above-mentioned rule. Up to now, all restrictions were checked
	by the compiler, with the binder just checking for consistency.
	But the compiler can't know which subprogram is the main, so
	it's impossible to check this one at compile time.
	* restrict.ads, restrict.adb: Misc refactoring. Change Warning
	to Warn, for consistency, since most already use Warn.
	(Set_Restriction): New convenience routine.
	* sem_ch13.adb (Attribute_CPU): Check
	No_Tasks_Unassigned_To_CPU.
	* sem_prag.adb (Pragma_CPU): Check No_Tasks_Unassigned_To_CPU.
	Misc refactoring.
	* tbuild.ads, tbuild.adb (Sel_Comp): New functions for building
	selected components.
2020-07-16 05:18:17 -04:00
Eric Botcazou
22157c64fc [Ada] Remove duplicated line
gcc/ada/

	* impunit.adb (Non_Imp_File_Names_95): Remove duplicate entry.
2020-07-16 05:18:16 -04:00
Arnaud Charlet
0b043c8fea [Ada] Wrong execution of Tan on large argument
gcc/ada/

	* Makefile.rtl: replace a-numaux__x86.ads by
	a-numaux__libc-x86.ads and a-numaux__x86.adb by
	a-numaux__dummy.adb.
	* libgnat/a-numaux__x86.ads, libgnat/a-numaux__x86.adb: Removed.
	* libgnat/a-numaux__dummy.adb: New.
2020-07-16 05:18:15 -04:00