gcc.git
4 years agoTestuite: Document environment setting directives
Tamar Christina [Fri, 17 Jul 2020 12:12:46 +0000 (13:12 +0100)]
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.

4 years agoTestsuite: Make it easier to debug environment setting functions
Tamar Christina [Fri, 17 Jul 2020 12:12:23 +0000 (13:12 +0100)]
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.

4 years agoArm: Add GCC_CPUINFO override
Tamar Christina [Fri, 17 Jul 2020 12:12:00 +0000 (13:12 +0100)]
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.

4 years agoAArch64: Add GCC_CPUINFO override
Tamar Christina [Fri, 17 Jul 2020 12:10:53 +0000 (13:10 +0100)]
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.

4 years agoAArch64: Fix bugs in -mcpu=native detection.
Tamar Christina [Fri, 17 Jul 2020 12:10:28 +0000 (13:10 +0100)]
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.

4 years agoamdgcn: Fix elf.h build issue
Andrew Stubbs [Fri, 17 Jul 2020 10:45:34 +0000 (11:45 +0100)]
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.

4 years agovector creation from two parts of two vectors produces TBL rather than ins (PR 93720)
Dmitrij Pochepko [Fri, 17 Jul 2020 09:24:46 +0000 (10:24 +0100)]
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>
4 years ago__builtin_shuffle sometimes should produce zip1 rather than TBL (PR82199)
Dmitrij Pochepko [Fri, 17 Jul 2020 09:20:12 +0000 (10:20 +0100)]
__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>
4 years agoAArch64: Add flags in built-in functions [PR94442]
xiezhiheng [Fri, 17 Jul 2020 09:00:37 +0000 (10:00 +0100)]
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.

4 years agogcc-changelog: Fix typo in output
Jonathan Wakely [Fri, 17 Jul 2020 08:53:19 +0000 (09:53 +0100)]
gcc-changelog: Fix typo in output

contrib/ChangeLog:

* gcc-changelog/git_update_version.py: Fix typo.

4 years agoFix PR96127
Andreas Krebbel [Fri, 17 Jul 2020 06:49:29 +0000 (08:49 +0200)]
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.

4 years agors6000/test: Add -fno-vect-cost-model to conv-vectorize-[12].c
Kewen Lin [Fri, 17 Jul 2020 05:31:03 +0000 (00:31 -0500)]
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.

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

4 years agocombine: Use single_set for is_just_move
Segher Boessenkool [Thu, 16 Jul 2020 23:42:46 +0000 (23:42 +0000)]
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.

4 years agoopenacc: Fix standalone attach for Fortran assumed-shape array pointers
Julian Brown [Tue, 9 Jun 2020 22:53:39 +0000 (15:53 -0700)]
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>
4 years agocoroutines: Correct frame capture of compiler temps [PR95591+4].
Iain Sandoe [Sat, 11 Jul 2020 07:49:33 +0000 (08:49 +0100)]
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.

4 years agoanalyzer: Use noexcept instead of throw() for C++11 and later (PR 96014)
Jonathan Wakely [Thu, 16 Jul 2020 10:44:32 +0000 (11:44 +0100)]
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.

4 years agoi386: Additional peephole2 to use flags from CMPXCHG more [PR96189]
Uros Bizjak [Thu, 16 Jul 2020 18:11:43 +0000 (20:11 +0200)]
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.

4 years agoReunify x86 stack checking implementation
Eric Botcazou [Thu, 16 Jul 2020 15:50:26 +0000 (17:50 +0200)]
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.

4 years agoc++: Add test for DR 188.
Marek Polacek [Thu, 16 Jul 2020 16:11:25 +0000 (12:11 -0400)]
c++: Add test for DR 188.

gcc/testsuite/ChangeLog:

DR 188
* g++.dg/DRs/dr188.C: New test.

4 years agoamdgcn: Handle early debug info in mkoffload
Andrew Stubbs [Thu, 9 Jul 2020 21:48:39 +0000 (22:48 +0100)]
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.

4 years agoFix ChangeLog PR number.
Uros Bizjak [Thu, 16 Jul 2020 14:37:04 +0000 (16:37 +0200)]
Fix ChangeLog PR number.

4 years agoc++: Get rid of convert_like* macros.
Marek Polacek [Wed, 15 Jul 2020 20:40:54 +0000 (16:40 -0400)]
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.

4 years agocoroutines: Spelling corrections in comments [NFC].
Iain Sandoe [Thu, 16 Jul 2020 10:49:55 +0000 (11:49 +0100)]
coroutines: Spelling corrections in comments [NFC].

Correct some typos.

gcc/cp/ChangeLog:

* coroutines.cc: Correct some spelling errors
in comments.

4 years agobuild: Fix TAGS target in gcc/Makefile.in
Andrea Corallo [Thu, 16 Jul 2020 09:20:28 +0000 (10:20 +0100)]
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'.

4 years agodoc: Document TARGET_TRULY_NOOP_TRUNCATION requires trunc?i?i2 patterns.
Roger Sayle [Thu, 16 Jul 2020 10:47:47 +0000 (11:47 +0100)]
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.

4 years ago[Ada] Misplace of internal master renaming declaration
Javier Miranda [Sat, 13 Jun 2020 12:21:19 +0000 (08:21 -0400)]
[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).

4 years ago[Ada] AI12-0132 Freezing of renames_as_body
Arnaud Charlet [Thu, 11 Jun 2020 18:31:54 +0000 (14:31 -0400)]
[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.

4 years ago[Ada] Ongoing work for AI12-0212 : container aggregates
Ed Schonberg [Fri, 12 Jun 2020 18:57:02 +0000 (14:57 -0400)]
[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.

4 years ago[Ada] gnatbind: Fix No_Entry_Calls_In_Elaboration_Code message
Bob Duff [Fri, 12 Jun 2020 13:58:24 +0000 (09:58 -0400)]
[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.

4 years ago[Ada] Ada2020: AI12-0117 Restriction No_Tasks_Unassigned_To_CPU
Bob Duff [Thu, 11 Jun 2020 18:05:55 +0000 (14:05 -0400)]
[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.

4 years ago[Ada] Remove duplicated line
Eric Botcazou [Thu, 11 Jun 2020 23:22:29 +0000 (01:22 +0200)]
[Ada] Remove duplicated line

gcc/ada/

* impunit.adb (Non_Imp_File_Names_95): Remove duplicate entry.

4 years ago[Ada] Wrong execution of Tan on large argument
Arnaud Charlet [Thu, 11 Jun 2020 12:49:58 +0000 (08:49 -0400)]
[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.

4 years ago[Ada] Spurious error in instance nested in formal package
Ed Schonberg [Thu, 11 Jun 2020 15:34:26 +0000 (11:34 -0400)]
[Ada] Spurious error in instance nested in formal package

gcc/ada/

* sem_ch12.adb (Load_Parent_Of_Generic): If an ancestor is an
instance whose source appears within a formal package of the
current unit, there is no body of the ancestor needed to
complete the current generic compilation.

4 years ago[Ada] v7r2cert: minor refactoring
Doug Rupp [Mon, 8 Jun 2020 19:17:26 +0000 (12:17 -0700)]
[Ada] v7r2cert: minor refactoring

gcc/ada/

* libgnat/s-thread__ae653.adb (taskVarAdd): Defunct, so remove.
(Current_ATSD):  Make it a TLS variable.
(OK): Move to package scope.
(System.Storage_Elements): Import and Use.

4 years ago[Ada] Set missing Parent field of block entity
Eric Botcazou [Thu, 11 Jun 2020 13:25:44 +0000 (15:25 +0200)]
[Ada] Set missing Parent field of block entity

gcc/ada/

* exp_ch9.adb (Expand_N_Accept_Statement): Set Parent of the
created block entity to the created block statement.

4 years ago[Ada] AI12-0004 Normalization and allowed characters
Arnaud Charlet [Wed, 10 Jun 2020 12:26:06 +0000 (08:26 -0400)]
[Ada] AI12-0004 Normalization and allowed characters

gcc/ada/

* scng.adb (Scan): Detect wide characters not in NFKC.
* libgnat/a-chahan.adb, libgnat/a-chahan.ads,
libgnat/a-wichha.adb, libgnat/a-wichha.ads,
libgnat/a-wichun.adb, libgnat/a-wichun.ads,
libgnat/a-zchhan.adb, libgnat/a-zchhan.ads,
libgnat/a-zchuni.adb, libgnat/a-zchuni.ads (Is_NFKC): New.
* libgnat/s-utf_32.ads, libgnat/s-utf_32.adb (Is_UTF_32_NFKC):
New.

4 years ago[Ada] Ada2020: AI12-0117 Restriction No_Tasks_Unassigned_To_CPU
Bob Duff [Wed, 10 Jun 2020 19:55:32 +0000 (15:55 -0400)]
[Ada] Ada2020: AI12-0117 Restriction No_Tasks_Unassigned_To_CPU

gcc/ada/

* libgnat/s-rident.ads (Restriction_Id): Add
No_Tasks_Unassigned_To_CPU.

4 years ago[Ada] Adjust heuristics about size of static aggregates
Bob Duff [Tue, 9 Jun 2020 23:04:56 +0000 (19:04 -0400)]
[Ada] Adjust heuristics about size of static aggregates

gcc/ada/

* exp_aggr.adb (Max_Aggregate_Size): Use the small size of 64
when copying is needed (for example, for the initialization of a
local variable, and for assignment statements). Use the larger
size when static allocation can be done without copying.

4 years ago[Ada] Ada2020: AI12-0055 No_Dynamic_CPU_Assignment restriction
Bob Duff [Tue, 9 Jun 2020 14:53:23 +0000 (10:53 -0400)]
[Ada] Ada2020: AI12-0055 No_Dynamic_CPU_Assignment restriction

gcc/ada/

* libgnat/s-rident.ads (No_Dynamic_CPU_Assignment): New
restriction. Add it to all relevant profiles.
* sem_ch13.adb (Attribute_CPU): Check No_Dynamic_CPU_Assignment
restriction.
(Attribute_CPU, Attribute_Dispatching_Domain,
Attribute_Interrupt_Priority): Remove error checks -- these are
checked in the parser.
* sem_prag.adb (Pragma_CPU): Check No_Dynamic_CPU_Assignment
restriction.  We've got a little violation of DRY here.
* sem.ads, sem_ch3.ads: Minor comment fix.

4 years ago[Ada] Implicit dereferencing in container indexing
Gary Dismukes [Sun, 7 Jun 2020 23:41:15 +0000 (19:41 -0400)]
[Ada] Implicit dereferencing in container indexing

gcc/ada/

* sem_ch4.adb (Try_Container_Indexing): When the prefix type is
an access type, change it to the designated type, change the
prefix to an explicit dereference, and emit a ?d? warning for
the implicit dereference. Include a ??? comment questioning
whether this is the right context in which to perform the
implicit dereferencing.

4 years ago[Ada] AI12-0373 Additional check on Integer_Literal function
Arnaud Charlet [Mon, 8 Jun 2020 18:28:52 +0000 (14:28 -0400)]
[Ada] AI12-0373 Additional check on Integer_Literal function

gcc/ada/

* sem_ch13.adb (Validate_Literal_Aspect): Ensure that the
parameter is not aliased. Minor reformatting.
* sem_util.adb (Statically_Names_Object): Update comment.

4 years ago[Ada] Handle N_Others_Choice case in range-building function
Ghjuvan Lacambre [Fri, 5 Jun 2020 16:00:08 +0000 (18:00 +0200)]
[Ada] Handle N_Others_Choice case in range-building function

gcc/ada/

* sem_case.adb (Build_Choice): Set Is_Static_Expression flag.
(Lit_Of): Update specification to mention Is_Static_Expression
flag.
* sem_ch13.adb (Membership_Entry): Check for N_Others_Choice.

4 years ago[Ada] Ada2020: AI12-0289 Implicitly null excluding anon access
Bob Duff [Mon, 8 Jun 2020 17:54:27 +0000 (13:54 -0400)]
[Ada] Ada2020: AI12-0289 Implicitly null excluding anon access

gcc/ada/

* sem_ch6.adb (Null_Exclusions_Match): New function to check
that the null exclusions match, including in the case addressed
by this AI.
(Check_Conformance): Remove calls to Comes_From_Source
when calling Null_Exclusions_Match. These are not
needed, as indicated by an ancient "???" comment.

4 years ago[Ada] Spurious accessibility error on allocator in generic instance
Justin Squirek [Fri, 5 Jun 2020 19:41:33 +0000 (15:41 -0400)]
[Ada] Spurious accessibility error on allocator in generic instance

gcc/ada/

* exp_ch4.adb (Expand_N_Type_Conversion): Remove flawed test for
whether "statically deeper" accessibility rules apply to a given
target type and instead use the new routine
Statically_Deeper_Relation_Applies.
(Statically_Deeper_Relation_Applies): Created to centralize the
calculation of whether a target type within a conversion must
have static accessibility checks.
* sem_ch13.adb (Check_One_Function): Minor comment revision.

4 years ago[Ada] Small cleanup in interface with GCC back-end
Eric Botcazou [Mon, 8 Jun 2020 19:21:39 +0000 (21:21 +0200)]
[Ada] Small cleanup in interface with GCC back-end

gcc/ada/

* fe.h (Is_OK_Static_Expression): Delete.
* sem_eval.ads (Is_OK_Static_Expression): Remove WARNING note.

4 years ago[Ada] Incorrect static accessibility error in return aggregate
Justin Squirek [Fri, 22 May 2020 20:25:00 +0000 (16:25 -0400)]
[Ada] Incorrect static accessibility error in return aggregate

gcc/ada/

* einfo.adb, einfo.ads (Is_Named_Access_Type): Created for
readability.
* sem_ch6.adb (Check_Return_Construct_Accessibility): Add
special cases for formals.
* sem_util.adb (Object_Access_Level): Add handling of access
attributes and named access types in the general case.

4 years ago[Ada] Simplify detection of others choice with just one value
Piotr Trojanek [Mon, 8 Jun 2020 12:33:08 +0000 (14:33 +0200)]
[Ada] Simplify detection of others choice with just one value

gcc/ada/

* sem_case.adb (Build_Choice): Simplify.

4 years ago[Ada] Disable Initialize_Scalars on runtime files
Arnaud Charlet [Mon, 8 Jun 2020 08:10:29 +0000 (10:10 +0200)]
[Ada] Disable Initialize_Scalars on runtime files

gcc/ada/

* frontend.adb: Disable Initialize_Scalars on runtime files.

4 years ago[Ada] Do not perform null exclusion static checks on generated entities
Ghjuvan Lacambre [Fri, 5 Jun 2020 07:46:15 +0000 (09:46 +0200)]
[Ada] Do not perform null exclusion static checks on generated entities

gcc/ada/

* sem_ch3.adb (Analyze_Object_Declaration): Add
Comes_From_Source call.

4 years ago[Ada] Avoid false positive reported by CodePeer
Javier Miranda [Sat, 6 Jun 2020 15:26:18 +0000 (11:26 -0400)]
[Ada] Avoid false positive reported by CodePeer

gcc/ada/

* exp_attr.adb (Expand_Access_To_Protected_Op): Initialize
variable Sub to Empty to avoid false positive reported by
Codepeer.

4 years ago[Ada] Spurious redundant use clause warning
Arnaud Charlet [Fri, 5 Jun 2020 18:45:23 +0000 (14:45 -0400)]
[Ada] Spurious redundant use clause warning

gcc/ada/

* sem_ch8.adb (Note_Redundant_Use): Add missing warning tag.
Do not check for redundant use clauses in predefined units to avoid
misleading warnings that may occur as part of a rtsfind load.

4 years ago[Ada] Ada2020: AI12-0107 convention of By_Protected_Procedure
Javier Miranda [Wed, 3 Jun 2020 18:07:27 +0000 (14:07 -0400)]
[Ada] Ada2020: AI12-0107 convention of By_Protected_Procedure

gcc/ada/

* exp_attr.adb (Has_By_Protected_Procedure_Prefixed_View): New
subprogram.
(Expand_Access_To_Protected_Op): Adding support for prefixed
class-wide view with By_Protected_Procedure convention.
* sem_attr.adb (Get_Convention): New subprogram.
(Get_Kind): Adapted to use Get_Convention.
* sem_ch4.adb (Try_By_Protected_Procedure_Prefixed_View): New
subprogram.
(Analyze_Selected_Component): Invoke
Try_By_Protected_Procedure_Prefixed_View.
* sem_util.ads (Is_By_Protected_Procedure): New subprogram.
* sem_util.adb (Is_By_Protected_Procedure): New subprogram.

4 years ago[Ada] Overflow in string streaming
Arnaud Charlet [Fri, 5 Jun 2020 15:50:16 +0000 (11:50 -0400)]
[Ada] Overflow in string streaming

gcc/ada/

* libgnat/s-ststop.ads: Fix typo.
* libgnat/s-ststop.adb (Read, Write): Fix block number
computation to avoid overflows in case of large strings.

4 years ago[Ada] Add centralized capacity check in Generic_Bignums
Arnaud Charlet [Fri, 5 Jun 2020 09:40:55 +0000 (05:40 -0400)]
[Ada] Add centralized capacity check in Generic_Bignums

gcc/ada/

* libgnat/s-genbig.adb ("**"): Remove capacity limit check.
Improve code by using an extended return.
(Normalize): Perform capacity limit check here instead which is
the centralized place where (potentially large) big integers are
allocated.

4 years ago[Ada] AI12-0042: Type invariant checking rules
Gary Dismukes [Wed, 3 Jun 2020 23:53:33 +0000 (19:53 -0400)]
[Ada] AI12-0042: Type invariant checking rules

gcc/ada/

* exp_ch4.adb (Expand_N_Type_Conversion): Handle the case of
applying an invariant check for a conversion to a class-wide
type whose root type has a type invariant, when the conversion
appears within the immediate scope of the type and the
expression is of a specific tagged type.
* sem_ch3.adb (Is_Private_Primitive): New function to determine
whether a primitive subprogram is a private operation.
(Check_Abstract_Overriding): Enforce the restriction imposed by
AI12-0042 of requiring overriding of an inherited nonabstract
private operation when the ancestor has a class-wide type
invariant and the ancestor's private operation is visible.
(Derive_Subprogram): Set Requires_Overriding on a subprogram
inherited from a visible private operation of an ancestor to
which a Type_Invariant'Class expression applies.

4 years agolibsanitizer: Fix GetPcSpBp determination of SP on 32-bit Solaris/x86
Rainer Orth [Thu, 16 Jul 2020 08:38:48 +0000 (10:38 +0200)]
libsanitizer: Fix GetPcSpBp determination of SP on 32-bit Solaris/x86

The latest Solaris 11.4/x86 update uncovered a libsanitizer bug that
caused one test to FAIL for 32-bit:

+FAIL: c-c++-common/asan/null-deref-1.c   -O0  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O1  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O2  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O2 -flto  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c -O2 -flto -flto-partition=none
output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -O3 -g  output pattern test
+FAIL: c-c++-common/asan/null-deref-1.c   -Os  output pattern test

I've identified the problem and the fix has just landed in upstream
llvm-project:

https://reviews.llvm.org/D83664

Tested on i386-pc-solaris2.11 and x86_64-pc-linux.gnu.

libsanitizer:
* sanitizer_common/sanitizer_linux.cpp: Cherry-pick llvm-project
revision f0e9b76c3500496f8f3ea7abe6f4bf801e3b41e7.

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

4 years agoi386: Introduce peephole2 to use flags from CMPXCHG more [PR96189]
Uros Bizjak [Wed, 15 Jul 2020 19:27:00 +0000 (21:27 +0200)]
i386: Introduce 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:

        movl    %esi, %eax
        lock cmpxchgl   %edx, (%rdi)
        cmpl    %esi, %eax
        sete    %al

can be optimized by removing the unneeded comparison, since set ZF flag
signals that no update to EAX happened.

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

gcc/ChangeLog:
PR target/95355
* config/i386/sync.md
(peephole2 to remove unneded compare after CMPXCHG): New pattern.

gcc/testsuite/ChangeLog:
PR target/95355
* gcc.target/i386/pr96189.c: New test.

4 years agolibgomp.fortran/alloc-1.F90: Fix testcase for 32bit size_t
Tobias Burnus [Wed, 15 Jul 2020 15:23:04 +0000 (17:23 +0200)]
libgomp.fortran/alloc-1.F90: Fix testcase for 32bit size_t

libgomp/ChangeLog:

* testsuite/libgomp.fortran/alloc-1.F90: Use c_size_t to
avoid conversion on 32bit systems from 32bit to 64bit due
to -fdefault-integer-8.

4 years agoopenmp: Fix up loop-21.c
Jakub Jelinek [Wed, 15 Jul 2020 14:34:54 +0000 (16:34 +0200)]
openmp: Fix up loop-21.c

I've missed
+FAIL: libgomp.c/loop-21.c execution test
during testing of the recent patch.  The problem is that while
for the number of iterations computation it doesn't matter if we compute
min_inner_iterations as (m2 * first + n2 + (adjusted step) + m1 * first + n1) / step
or (m2 * last + n2 + (adjusted step) + m1 * last + n1) / step provided that
in the second case we use as factor (m1 - m2) * ostep / step rather than
(m2 - m1) * ostep / step, for the logical to actual iterator values computation
it does matter and in my hand written C implementations of all the cases (outer
vs. inner loop with increasing vs. decreasing iterator) I'm using the same computation
and it worked well for all the pseudo-random iterators testing it was doing.

It also means min_inner_iterations is misnamed, because it is not really
minimum number of inner iterations, whether the first or last outer iteration
results in the smaller or larger value of this can be (sometimes) only
determined at runtime.
So this patch also renames it to first_inner_iterations.

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

PR libgomp/96198
* omp-general.h (struct omp_for_data): Rename min_inner_iterations
member to first_inner_iterations, adjust comment.
* omp-general.c (omp_extract_for_data): Adjust for the above change.
Always use n1first and n2first to compute it, rather than depending
on single_nonrect_cond_code.  Similarly, always compute factor
as (m2 - m1) * outer_step / inner_step rather than sometimes m1 - m2
depending on single_nonrect_cond_code.
* omp-expand.c (expand_omp_for_init_vars): Rename min_inner_iterations
to first_inner_iterations and min_inner_iterationsd to
first_inner_iterationsd.

4 years agoc++: refactor some parser code
Nathan Sidwell [Wed, 15 Jul 2020 14:38:35 +0000 (07:38 -0700)]
c++: refactor some parser code

cp_parser_declaration copies tokens to local variables, before inspecting
(some of) their fields.  There's no need.  Just point at them in the token
buffer -- they don't move.  Also, we never look at the second token if the
first is EOF, so no need for some kind of dummy value in that case.

gcc/cp/
* parser.c (cp_parser_declaration): Avoid copying tokens.
(cp_parser_block_declaration): RAII token pointer.

4 years ago[Ada] Cleanup code related to object overlays
Piotr Trojanek [Fri, 5 Jun 2020 11:30:54 +0000 (13:30 +0200)]
[Ada] Cleanup code related to object overlays

gcc/ada/

* sem_util.adb (Find_Overlaid_Entity): Fix style in comment.
(Note_Possible_Modification): Simplify repeated calls to Ekind.

4 years ago[Ada] Cleanup in Convert_To_Positional after previous work
Eric Botcazou [Fri, 5 Jun 2020 09:35:25 +0000 (11:35 +0200)]
[Ada] Cleanup in Convert_To_Positional after previous work

gcc/ada/

* exp_aggr.adb (Flatten): Adjust description.
(Convert_To_Positional): Remove obsolete ??? comment and use
Compile_Time_Known_Value in the final test.

4 years ago[Ada] Ongoing work for AI12-0212: container aggregates
Arnaud Charlet [Wed, 3 Jun 2020 07:42:19 +0000 (03:42 -0400)]
[Ada] Ongoing work for AI12-0212: container aggregates

gcc/ada/

* par-ch4.adb (P_Iterated_Component_Association): Extended to
recognzize the similar Iterated_Element_Association. This node
is only generated when an explicit Key_Expression is given.
Otherwise the distinction between the two iterated forms is done
during semantic analysis.
* sinfo.ads: New node N_Iterated_Element_Association, for
Ada202x container aggregates.  New field Key_Expression.
* sinfo.adb: Subprograms for new node and newn field.
* sem_aggr.adb (Resolve_Iterated_Component_Association): Handle
the case where the Iteration_Scheme is an
Iterator_Specification.
* exp_aggr.adb (Wxpand_Iterated_Component): Handle a component
with an Iterated_Component_Association, generate proper loop
using given Iterator_Specification.
* exp_util.adb (Insert_Axtions): Handle new node as other
aggregate components.
* sem.adb, sprint.adb: Handle new node.
* tbuild.adb (Make_Implicit_Loop_Statement): Handle properly a
loop with an Iterator_ specification.

4 years ago[Ada] Fix logic in Allocate_Any_Controlled
Arnaud Charlet [Thu, 4 Jun 2020 18:18:18 +0000 (14:18 -0400)]
[Ada] Fix logic in Allocate_Any_Controlled

gcc/ada/

* libgnat/s-stposu.adb (Allocate_Any_Controlled): Fix logic in
lock/unlock.

4 years ago[Ada] Target name is an object reference
Piotr Trojanek [Thu, 28 May 2020 18:28:28 +0000 (20:28 +0200)]
[Ada] Target name is an object reference

gcc/ada/

* sem_util.adb (Is_Object_Reference): Return True on
N_Target_Name.

4 years ago[Ada] Spurious error on Predicate_Failure aspect
Arnaud Charlet [Thu, 4 Jun 2020 09:09:59 +0000 (05:09 -0400)]
[Ada] Spurious error on Predicate_Failure aspect

gcc/ada/

* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Add proper
handling of Aspect_Predicate_Failure, consistent with
Check_Aspect_At_Freeze_Point.

4 years ago[Ada] Mention -gnat2020 in error message
Arnaud Charlet [Thu, 4 Jun 2020 08:13:16 +0000 (10:13 +0200)]
[Ada] Mention -gnat2020 in error message

gcc/ada/

* sem_ch13.adb (Check_Aspect_Too_Late): Mention -gnat2020 switch
in error message.

4 years ago[Ada] Do not generate elaboration code for alignment aspect
Eric Botcazou [Thu, 4 Jun 2020 08:15:33 +0000 (10:15 +0200)]
[Ada] Do not generate elaboration code for alignment aspect

gcc/ada/

* einfo.ads (Delayed Freezing and Elaboration): Adjust description.
* freeze.adb (Freeze_Object_Declaration): Likewise.
* sem_ch3.adb (Delayed_Aspect_Present): Likewise.  Do not return
true for Alignment.
* sem_ch13.adb (Analyze_Aspect_Specifications): Do not always delay
for Alignment.  Moreover, for Alignment and various Size aspects,
do not delay if the expression is an attribute whose prefix is the
Standard package.

4 years ago[Ada] Do not generate extra copies inside initialization procedures
Eric Botcazou [Thu, 4 Jun 2020 07:56:02 +0000 (09:56 +0200)]
[Ada] Do not generate extra copies inside initialization procedures

gcc/ada/

* exp_ch6.adb (Requires_Atomic_Or_Volatile_Copy): Return false
inside an initialization procedure.

4 years ago[Ada] Guard against access to wrong fields in Is_Renaming
Ghjuvan Lacambre [Wed, 3 Jun 2020 09:09:20 +0000 (11:09 +0200)]
[Ada] Guard against access to wrong fields in Is_Renaming

gcc/ada/

* sem_util.adb (Is_Renaming): Add ekind checks.

4 years ago[Ada] Remove doc on obsolete tools
Arnaud Charlet [Wed, 3 Jun 2020 20:14:38 +0000 (16:14 -0400)]
[Ada] Remove doc on obsolete tools

gcc/ada/

* doc/gnat_ugn/gnat_utility_programs.rst: Remove doc on obsolete
tools.
* gnat_ugn.texi: Regenerate.

4 years ago[Ada] Assert failure with -gnatwr
Arnaud Charlet [Wed, 3 Jun 2020 16:27:43 +0000 (12:27 -0400)]
[Ada] Assert failure with -gnatwr

gcc/ada/

* sem_res.adb (Resolve_Type_Conversion): Protect against null
entity.  Add proper tag for -gnatwr warning.

4 years ago[Ada] Missing error on operator call
Arnaud Charlet [Wed, 3 Jun 2020 07:42:19 +0000 (03:42 -0400)]
[Ada] Missing error on operator call

gcc/ada/

* sem_ch6.adb (Analyze_Procedure_Call): Detect use of operators
in a procedure call.
* sem_util.adb: Minor edit.

4 years ago[Ada] Fix for possibly null ranges in 'Update and delta_aggregate
Piotr Trojanek [Tue, 2 Jun 2020 22:17:21 +0000 (00:17 +0200)]
[Ada] Fix for possibly null ranges in 'Update and delta_aggregate

gcc/ada/

* exp_spark.adb (Expand_SPARK_Delta_Or_Update): Apply scalar
range checks against the base type of an index type, not against
the index type itself.

4 years ago[Ada] Small addition and tweaks in documentation on freezing
Eric Botcazou [Wed, 3 Jun 2020 08:30:09 +0000 (10:30 +0200)]
[Ada] Small addition and tweaks in documentation on freezing

gcc/ada/

* einfo.ads (Delayed Freezing and Elaboration): Minor tweaks.
Document the discrepancy between the aspect and the non-aspect
cases for alignment settings in object declarations.

4 years ago[Ada] ACATS 4.1P [BDB4001] - 13.11.4(22-23/3) not enforced
Arnaud Charlet [Sat, 30 May 2020 18:04:33 +0000 (14:04 -0400)]
[Ada] ACATS 4.1P [BDB4001] - 13.11.4(22-23/3) not enforced

gcc/ada/

* exp_ch3.adb (Freeze_Type): Remove warning in expander,
replaced by a corresponding error in sem_ch13.adb. Replace
RTE_Available by RTU_Loaded to avoid adding unnecessary
dependencies.
* sem_ch13.adb (Associate_Storage_Pool): New procedure.
(Analyze_Attribute_Definition_Clause
[Attribute_Simple_Storage_Pool| Attribute_Storage_Pool]): Call
Associate_Storage_Pool to add proper legality checks on
subpools.

4 years ago[Ada] Mark standard containers as not in SPARK
Yannick Moy [Tue, 2 Jun 2020 12:16:25 +0000 (14:16 +0200)]
[Ada] Mark standard containers as not in SPARK

gcc/ada/

* libgnat/a-cbdlli.adb, libgnat/a-cbdlli.ads,
libgnat/a-cbhama.adb, libgnat/a-cbhama.ads,
libgnat/a-cbhase.adb, libgnat/a-cbhase.ads,
libgnat/a-cbmutr.adb, libgnat/a-cbmutr.ads,
libgnat/a-cborma.adb, libgnat/a-cborma.ads,
libgnat/a-cborse.adb, libgnat/a-cborse.ads,
libgnat/a-cbprqu.adb, libgnat/a-cbprqu.ads,
libgnat/a-cbsyqu.adb, libgnat/a-cbsyqu.ads,
libgnat/a-cdlili.adb, libgnat/a-cdlili.ads,
libgnat/a-cidlli.adb, libgnat/a-cidlli.ads,
libgnat/a-cihama.adb, libgnat/a-cihama.ads,
libgnat/a-cihase.adb, libgnat/a-cihase.ads,
libgnat/a-cimutr.adb, libgnat/a-cimutr.ads,
libgnat/a-ciorma.adb, libgnat/a-ciorma.ads,
libgnat/a-ciormu.adb, libgnat/a-ciormu.ads,
libgnat/a-ciorse.adb, libgnat/a-ciorse.ads,
libgnat/a-cohama.adb, libgnat/a-cohama.ads,
libgnat/a-cohase.adb, libgnat/a-cohase.ads,
libgnat/a-coinve.adb, libgnat/a-coinve.ads,
libgnat/a-comutr.adb, libgnat/a-comutr.ads,
libgnat/a-convec.adb, libgnat/a-convec.ads,
libgnat/a-coorma.adb, libgnat/a-coorma.ads,
libgnat/a-coormu.adb, libgnat/a-coormu.ads,
libgnat/a-coorse.adb, libgnat/a-coorse.ads: Add SPARK_Mode =>
Off.

4 years ago[Ada] Fix oversight in Delayed_Aspect_Present predicate
Eric Botcazou [Tue, 2 Jun 2020 22:08:17 +0000 (00:08 +0200)]
[Ada] Fix oversight in Delayed_Aspect_Present predicate

gcc/ada/

* sem_ch3.adb (Delayed_Aspect_Present): Fix oversight in loop.
* freeze.adb (Freeze_Object_Declaration): Use Declaration_Node
instead of Parent for the sake of consistency.

4 years ago[Ada] Wrong resolution of 'access in protected subprogram
Javier Miranda [Tue, 2 Jun 2020 19:46:10 +0000 (15:46 -0400)]
[Ada] Wrong resolution of 'access in protected subprogram

gcc/ada/

* sem_attr.adb (Resolve_Attribute): Resolve overloaded
N_Selected_Component prefix of 'Access. Required to handle
overloaded prefixed view of protected subprograms.

4 years ago[Ada] Documentation cleanups
Arnaud Charlet [Tue, 2 Jun 2020 12:40:26 +0000 (08:40 -0400)]
[Ada] Documentation cleanups

gcc/ada/

* doc/gnat_ugn/about_this_guide.rst: Remove old section and
update for Ada 202x.
* doc/gnat_ugn/getting_started_with_gnat.rst: Add a system
requirements section. Remove obsolete section and minimal
rewording on the getting started section.
* gnat_ugn.texi: Regenerate.

4 years ago[Ada] Fix slices and qualified expressions being effectively volatile
Piotr Trojanek [Sat, 30 May 2020 09:56:38 +0000 (11:56 +0200)]
[Ada] Fix slices and qualified expressions being effectively volatile

gcc/ada/

* exp_ch5.adb (Expand_Assign_Array): Use short-circuit operator
(style).
* sem_res.adb (Resolve_Indexed_Component): Fix style in comment.
* sem_util.adb (Is_Effectively_Volatile_Object): Handle slices
just like indexed components; handle qualified expressions and
type conversions lie in Is_OK_Volatile_Context.
(Is_OK_Volatile_Context): Handle qualified expressions just like
type conversions.

4 years ago[Ada] Cleanup condition for an effectively volatile array type
Piotr Trojanek [Fri, 29 May 2020 18:57:53 +0000 (20:57 +0200)]
[Ada] Cleanup condition for an effectively volatile array type

gcc/ada/

* sem_prag.adb (Atomic_Components): Simplify with Ekind_In.
(Complex_Representation): Fix type of E_Id, which just like when
for pragma Atomic_Components will hold an N_Identifier node, not
an entity.
* sem_util.adb (Is_Effectively_Volatile): Refactor to avoid
unnecessary computation.

4 years ago[Ada] Extend static functions
Arnaud Charlet [Wed, 27 May 2020 10:10:35 +0000 (06:10 -0400)]
[Ada] Extend static functions

gcc/ada/

* inline.adb, inline.ads
(Inline_Static_Expression_Function_Call): Renamed
Inline_Static_Function_Call.
* sem_ch13.adb (Analyze_Aspect_Static): Allow static intrinsic
imported functions under -gnatX.
* sem_util.ads, sem_util.adb (Is_Static_Expression_Function):
Renamed Is_Static_Function.
(Is_Static_Expression_Function_Call): Renamed
Is_Static_Function_Call.
* sem_ch6.adb, sem_elab.adb, sem_res.adb: Update calls to
Is_Static_Function*.
* sem_eval.adb (Fold_Dummy, Eval_Intrinsic_Call, Fold_Shift):
New.
(Eval_Call): Add support for intrinsic calls, code refactoring.
(Eval_Entity_Name): Code refactoring.
(Eval_Logical_Op): Update comment.
(Eval_Shift): Call Fold_Shift. Update comments.
* par-prag.adb (Par [Pragma_Extensions_Allowed]): Set
Ada_Version to Ada_Version_Type'Last to handle
Extensions_Allowed (On) consistently.
* opt.ads (Extensions_Allowed): Update documentation.
* sem_attr.adb: Update comment.
* doc/gnat_rm/implementation_defined_pragmas.rst: Update
documentation of Extensions_Allowed.
* gnat_rm.texi: Regenerate.

4 years ago[Ada] Potential access to uninitialized variable
Arnaud Charlet [Tue, 2 Jun 2020 06:57:11 +0000 (02:57 -0400)]
[Ada] Potential access to uninitialized variable

gcc/ada/

* sem_aggr.adb (Resolve_Iterated_Component_Association): Ensure
Typ is never accessed uninitialized.

4 years ago[Ada] Fix typo in "accommodate" in docs and comments
Piotr Trojanek [Fri, 8 May 2020 22:06:16 +0000 (00:06 +0200)]
[Ada] Fix typo in "accommodate" in docs and comments

gcc/ada/

* doc/gnat_rm/representation_clauses_and_pragmas.rst: Fix typo.
* gnat_rm.texi: Regenerate.
* libgnat/s-secsta.ads (Memory_Alignment): Likewise.

4 years ago[Ada] Minor reformatting of comments and some code, plus a typo correction
Gary Dismukes [Mon, 1 Jun 2020 19:22:48 +0000 (15:22 -0400)]
[Ada] Minor reformatting of comments and some code, plus a typo correction

gcc/ada/

* exp_ch6.adb: Add a comma and fix a typo (machinary =>
machinery) in comment.
* exp_aggr.adb: Reformat, fix capitalization, and add a couple
of commas in a comment. Adjust columns in several code
fragments.
* sem_aggr.adb: Reformat and add a comma in a comment.

4 years ago[Ada] Use Sloc of delay statement in timed entry call
Eric Botcazou [Mon, 1 Jun 2020 18:49:43 +0000 (20:49 +0200)]
[Ada] Use Sloc of delay statement in timed entry call

gcc/ada/

* exp_ch9.adb (Expand_N_Timed_Entry_Call): Use the Sloc of
the delay statement in the expansion.

4 years ago[Ada] Ongoing work for unnamed and named container aggregates
Ed Schonberg [Sun, 31 May 2020 20:01:41 +0000 (16:01 -0400)]
[Ada] Ongoing work for unnamed and named container aggregates

gcc/ada/

* sem_aggr.adb (Resolve_Iterated_Component_Association): New
procedure, internal to Resolve_Container_Aggregate, to complete
semantic analysis of Iterated_Component_Associations.
* exp_aggr.adb (Expand_Iterated_Component): New procedure,
internal to Expand_Container_Aggregate, to expand the construct
into an implicit loop that performs individual insertions into
the target aggregate.

4 years ago[Ada] Spurious accessibility error on allocator
Justin Squirek [Fri, 29 May 2020 19:44:50 +0000 (15:44 -0400)]
[Ada] Spurious accessibility error on allocator

gcc/ada/

* exp_ch6.adb (Make_Build_In_Place_Call_Allocator): Normalize
the associated node for internally generated objects to be like
their SOAAT counter-parts.

4 years ago[Ada] Fix potentially uninitialized variable flagged by CodePeer
Arnaud Charlet [Sat, 30 May 2020 18:01:17 +0000 (14:01 -0400)]
[Ada] Fix potentially uninitialized variable flagged by CodePeer

gcc/ada/

* libgnat/g-socket.adb (Wait_On_Socket): Fix potentially
uninitialized variable.

4 years agoc++: error recovery & pragmas
Nathan Sidwell [Wed, 15 Jul 2020 13:00:10 +0000 (06:00 -0700)]
c++: error recovery & pragmas

Parser error recovery can get confused by the tokens within a deferred
pragma, as treats those as regular tokens.  This adjusts the recovery
so that the pragma is treated as a unit.  Also, the preprocessor now
ensures that we never have an EOF token inside a pragma -- the pragma
is always closed first.

gcc/cp/
* parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
meeting a deferred pragma.
(cp_parser_skip_to_end_of_statement): Likewise.
(cp_parser_skip_to_end_of_block_or_statement): Likewise.
(cp_parser_skip_to_pragma_eol): We should never meet EOF.
(cp_parser_omp_declare_simd): Likewise.
(cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
(pragma_lex): Likewise.
gcc/testsuite/
* g++.dg/parse/pragma-recovery.C: New.

4 years agolibgomp.fortran/struct-elem-map-1.f90: Add char kind=4 tests
Tobias Burnus [Wed, 15 Jul 2020 10:29:44 +0000 (12:29 +0200)]
libgomp.fortran/struct-elem-map-1.f90: Add char kind=4 tests

As the Fortran PR 95837 has been fixed, the test could be be added.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/struct-elem-map-1.f90: Remove unused
variables; add character(kind=4) tests; update TODO comment.

4 years agofix _mm512_{,mask_}cmp*_p[ds]_mask at -O0 [PR96174]
Jakub Jelinek [Wed, 15 Jul 2020 09:34:44 +0000 (11:34 +0200)]
fix _mm512_{,mask_}cmp*_p[ds]_mask at -O0 [PR96174]

The _mm512_{,mask_}cmp_p[ds]_mask and also _mm_{,mask_}cmp_s[ds]_mask
intrinsics have an argument which must have a constant passed to it
and so use an inline version only for ifdef __OPTIMIZE__ and have
a #define for -O0.  But the _mm512_{,mask_}cmp*_p[ds]_mask intrinsics
don't need a constant argument, they are essentially the first
set with the constant added to them implicitly based on the comparison
name, and so there is no #define version for them (correctly).
But their inline versions are defined in between the first and s[ds]
set and so inside of ifdef __OPTIMIZE__, which means that with -O0
they aren't defined at all.

This patch fixes that by moving those after the #ifdef __OPTIMIZE #else
use #define #endif block.

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

PR target/96174
* config/i386/avx512fintrin.h (_mm512_cmpeq_pd_mask,
_mm512_mask_cmpeq_pd_mask, _mm512_cmplt_pd_mask,
_mm512_mask_cmplt_pd_mask, _mm512_cmple_pd_mask,
_mm512_mask_cmple_pd_mask, _mm512_cmpunord_pd_mask,
_mm512_mask_cmpunord_pd_mask, _mm512_cmpneq_pd_mask,
_mm512_mask_cmpneq_pd_mask, _mm512_cmpnlt_pd_mask,
_mm512_mask_cmpnlt_pd_mask, _mm512_cmpnle_pd_mask,
_mm512_mask_cmpnle_pd_mask, _mm512_cmpord_pd_mask,
_mm512_mask_cmpord_pd_mask, _mm512_cmpeq_ps_mask,
_mm512_mask_cmpeq_ps_mask, _mm512_cmplt_ps_mask,
_mm512_mask_cmplt_ps_mask, _mm512_cmple_ps_mask,
_mm512_mask_cmple_ps_mask, _mm512_cmpunord_ps_mask,
_mm512_mask_cmpunord_ps_mask, _mm512_cmpneq_ps_mask,
_mm512_mask_cmpneq_ps_mask, _mm512_cmpnlt_ps_mask,
_mm512_mask_cmpnlt_ps_mask, _mm512_cmpnle_ps_mask,
_mm512_mask_cmpnle_ps_mask, _mm512_cmpord_ps_mask,
_mm512_mask_cmpord_ps_mask): Move outside of __OPTIMIZE__ guarded
section.

* gcc.target/i386/avx512f-vcmppd-3.c: New test.
* gcc.target/i386/avx512f-vcmpps-3.c: New test.

4 years agobuiltins: Avoid useless char/short -> int promotions before atomics [PR96176]
Jakub Jelinek [Wed, 15 Jul 2020 09:26:22 +0000 (11:26 +0200)]
builtins: Avoid useless char/short -> int promotions before atomics [PR96176]

As mentioned in the PR, we generate a useless movzbl insn before lock cmpxchg.
The problem is that the builtin for the char/short cases has the arguments
promoted to int and combine gives up, because the instructions have
MEM_VOLATILE_P arguments and recog in that case doesn't recognize anything
when volatile_ok is false, and nothing afterwards optimizes the
(reg:SI a) = (zero_extend:SI (reg:QI a))
... (subreg:QI (reg:SI a) 0) ...

The following patch fixes it at expansion time, we already have a function
that is meant to undo the promotion, so this just adds the very common case
to that.

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

PR target/96176
* builtins.c: Include gimple-ssa.h, tree-ssa-live.h and
tree-outof-ssa.h.
(expand_expr_force_mode): If exp is a SSA_NAME with different mode
from MODE and get_gimple_for_ssa_name is a cast from MODE, use the
cast's rhs.

* gcc.target/i386/pr96176.c: New test.

4 years agors6000: Refine RTL unroll hook for small loops
guojiufu [Wed, 15 Jul 2020 08:07:47 +0000 (16:07 +0800)]
rs6000: Refine RTL unroll hook for small loops

For very small loops (< 6 insns), it would be fine to unroll 4
times to run fast with less latency and better cache usage.  Like
below loops:
 while (i) a[--i] = NULL;   while (p < e)  *d++ = *p++;

With this patch enhances, we could see some performance improvement
for some workloads(e.g. SPEC2017).

2020-07-13  Jiufu Guo   <guojiufu@cn.ibm.com>

* config/rs6000/rs6000.c (rs6000_loop_unroll_adjust): Refine hook.

4 years agolibgomp: Add Fortran routine support for allocators
Tobias Burnus [Wed, 15 Jul 2020 06:33:20 +0000 (08:33 +0200)]
libgomp: Add Fortran routine support for allocators

libgomp/ChangeLog:

* allocator.c: Add ialias for omp_init_allocator and
omp_destroy_allocator.
* configure.ac: Set INTPTR_T_KIND.
* configure: Regenerate.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* fortran.c (omp_init_allocator_, omp_destroy_allocator_,
omp_set_default_allocator_, omp_get_default_allocator_): New
functions and ialias_redirect.
* icv.c: Add ialias for omp_set_default_allocator and
omp_get_default_allocator.
* libgomp.map (OMP_5.0.1): Add omp_init_allocator_,
omp_destroy_allocator_, omp_set_default_allocator_ and
omp_get_default_allocator_.
* omp_lib.f90.in: Add allocator traits parameters, declare
allocator routines and add related kind parameters.
* omp_lib.h.in: Likewise.
* testsuite/libgomp.c-c++-common/alloc-2.c: Fix sizeof.
* testsuite/libgomp.fortran/alloc-1.F90: New test.
* testsuite/libgomp.fortran/alloc-2.F90: New test.
* testsuite/libgomp.fortran/alloc-3.F: New test.
* testsuite/libgomp.fortran/alloc-4.f90: New test.
* testsuite/libgomp.fortran/alloc-5.f90: New test.

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

4 years agoc++: Add new test [PR59978]
Marek Polacek [Tue, 14 Jul 2020 21:31:08 +0000 (17:31 -0400)]
c++: Add new test [PR59978]

Fixed in r224162.  That came without a test so adding this one.
Previously, we issued a bogus "too few arguments to function" error.

gcc/testsuite/ChangeLog:

PR c++/59978
* g++.dg/cpp0x/vt-59978.C: New test.