platform/upstream/gcc.git
3 years ago[Ada] VxWorks inconsistent use of return type (Int_Unlock)
Doug Rupp [Mon, 12 Jul 2021 18:47:53 +0000 (11:47 -0700)]
[Ada] VxWorks inconsistent use of return type (Int_Unlock)

gcc/ada/

* libgnarl/s-osinte__vxworks.ads: Make procedure vice function.
* libgnarl/s-vxwext.ads: Likewise.
* libgnarl/s-vxwext__kernel-smp.adb: Likewise.
* libgnarl/s-vxwext__kernel.adb: Likewise.
* libgnarl/s-vxwext__kernel.ads: Likewise.
* libgnarl/s-vxwext__rtp-smp.adb: Likewise.
* libgnarl/s-vxwext__rtp.adb: Likewise.
* libgnarl/s-vxwext__rtp.ads: Likewise.
* libgnarl/s-taprop__vxworks.adb (Stop_All_Tasks): Call
Int_Unlock as a procedure.

3 years ago[Ada] VxWorks inconsistent use of return type (vx_freq_t)
Doug Rupp [Mon, 12 Jul 2021 17:52:32 +0000 (10:52 -0700)]
[Ada] VxWorks inconsistent use of return type (vx_freq_t)

gcc/ada/

* libgnarl/s-osinte__vxworks.ads (SVE): New package renaming
(vx_freq_t): New subtype.
(sysClkRateGet): Return vx_freq_t.
* libgnarl/s-vxwext.ads (vx_freq_t): New type.
* libgnarl/s-vxwext__kernel.ads: Likewise.
* libgnarl/s-vxwext__rtp.ads: Likewise.

3 years ago[Ada] Replace use of 'Image with use of Error_Msg_Uint
Ghjuvan Lacambre [Thu, 15 Jul 2021 09:11:00 +0000 (11:11 +0200)]
[Ada] Replace use of 'Image with use of Error_Msg_Uint

gcc/ada/

* sem_case.adb (Composite_Case_Ops): Replace 'Image with
Error_Msg_Uint.

3 years ago[Ada] Generate temporary for if-expression with -fpreserve-control-flow
Eric Botcazou [Thu, 15 Jul 2021 09:18:02 +0000 (11:18 +0200)]
[Ada] Generate temporary for if-expression with -fpreserve-control-flow

gcc/ada/

* exp_ch4.adb (Expand_N_If_Expression): Generate an intermediate
temporary when the expression is a condition in an outer decision
and control-flow optimizations are suppressed.

3 years ago[Ada] Add -gnatX support for casing on array values
Steve Baird [Fri, 9 Jul 2021 19:04:09 +0000 (12:04 -0700)]
[Ada] Add -gnatX support for casing on array values

gcc/ada/

* exp_ch5.adb (Expand_General_Case_Statement.Pattern_Match): Add
new function Indexed_Element to handle array element
comparisons. Handle case choices that are array aggregates,
string literals, or names denoting constants.
* sem_case.adb (Composite_Case_Ops.Array_Case_Ops): New package
providing utilities needed for casing on arrays.
(Composite_Case_Ops.Choice_Analysis): If necessary, include
array length as a "component" (like a discriminant) when
traversing components. We do not (yet) partition choice analysis
to deal with unequal length choices separately. Instead, we
embed everything in the minimum-dimensionality Cartesian product
space needed to handle all choices properly; this is determined
by the length of the longest choice pattern.
(Composite_Case_Ops.Choice_Analysis.Traverse_Discrete_Parts):
Include length as a "component" in the traversal if necessary.
(Composite_Case_Ops.Choice_Analysis.Parse_Choice.Traverse_Choice):
Add support for case choices that are string literals or names
denoting constants.
(Composite_Case_Ops.Choice_Analysis): Include length as a
"component" in the analysis if necessary.
(Check_Choices.Check_Case_Pattern_Choices.Ops.Value_Sets.Value_Index_Count):
Improve error message when capacity exceeded.
* doc/gnat_rm/implementation_defined_pragmas.rst: Update
documentation to reflect current implementation status.
* gnat_rm.texi: Regenerate.

3 years ago[Ada] Fix imprecise wording for error on scalar storage order
Eric Botcazou [Tue, 13 Jul 2021 09:23:38 +0000 (11:23 +0200)]
[Ada] Fix imprecise wording for error on scalar storage order

gcc/ada/

* freeze.adb (Check_Component_Storage_Order): Give a specific error
message for non-byte-aligned component in the packed case.  Replace
"composite" with "record" in both cases.

3 years ago[Ada] Make Ada.Task_Initialization compatible with No_Elaboration_Code_All
Arnaud Charlet [Mon, 12 Jul 2021 10:14:15 +0000 (06:14 -0400)]
[Ada] Make Ada.Task_Initialization compatible with No_Elaboration_Code_All

gcc/ada/

* libgnarl/a-tasini.ads, libgnarl/a-tasini.adb: Make compatible
with No_Elaboration_Code_All.
* libgnarl/s-taskin.ads, libgnarl/s-tassta.adb: Adjust
accordingly.

3 years ago[Ada] Change message format on missing return
Arnaud Charlet [Mon, 12 Jul 2021 09:33:26 +0000 (05:33 -0400)]
[Ada] Change message format on missing return

gcc/ada/

* sem_ch6.adb (Check_Returns): Change message on missing return.

3 years ago[Ada] Mark gnatfind and gnatxref obsolete
Arnaud Charlet [Mon, 12 Jul 2021 10:33:29 +0000 (06:33 -0400)]
[Ada] Mark gnatfind and gnatxref obsolete

gcc/ada/

* gnatfind.adb, gnatxref.adb: Mark these tools as obsolete
before removing them completely.

3 years agoSet bound/cmp/control for until wrap loop.
Jiufu Guo [Wed, 22 Sep 2021 05:20:29 +0000 (13:20 +0800)]
Set bound/cmp/control for until wrap loop.

In patch r12-3136, niter->control, niter->bound and niter->cmp are
derived from number_of_iterations_lt.  While for 'until wrap condition',
the calculation in number_of_iterations_lt is not align the requirements
on the define of them and requirements in determine_exit_conditions.

This patch calculate niter->control, niter->bound and niter->cmp in
number_of_iterations_until_wrap.

gcc/ChangeLog:

2021-09-22  Jiufu Guo  <guojiufu@linux.ibm.com>

PR tree-optimization/102087
* tree-ssa-loop-niter.c (number_of_iterations_until_wrap):
Update bound/cmp/control for niter.

gcc/testsuite/ChangeLog:

2021-09-22  Jiufu Guo  <guojiufu@linux.ibm.com>

* gcc.dg/pr102087.c: New test.
PR tree-optimization/102087

3 years agoCheck for BB before calling register_outgoing_edges.
Aldy Hernandez [Wed, 22 Sep 2021 07:30:21 +0000 (09:30 +0200)]
Check for BB before calling register_outgoing_edges.

We may be asked to fold an artificial statement not in the CFG.  Since
there are no outgoing edges from those, avoid calling
register_outgoing_edges.

Tested on x86-64 Linux.

gcc/ChangeLog:

* gimple-range-fold.cc (fold_using_range::range_of_range_op):
Move check for non-empty BB here.
(fur_source::register_outgoing_edges): ...from here.

3 years agopath solver: Use range_on_path_entry instead of looking at equivalences.
Aldy Hernandez [Wed, 22 Sep 2021 07:34:15 +0000 (09:34 +0200)]
path solver: Use range_on_path_entry instead of looking at equivalences.

Cycling through equivalences to improve a range is nowhere near as
efficient as asking the ranger what the range on entry is.

Testing on a hybrid VRP threader, shows that this improves our VRP
threading benefit from 14.5% to 18.5% and our overall jump threads from
0.85% to 1.28%.

Tested on x86-64 Linux.

gcc/ChangeLog:

* gimple-range-path.cc (path_range_query::internal_range_of_expr):
Remove call to improve_range_with_equivs.
(path_range_query::improve_range_with_equivs): Remove
* gimple-range-path.h: Remove improve_range_with_equivs.

3 years agoAVX512FP16: Add permutation and mask blend intrinsics.
dianhong xu [Tue, 22 Jun 2021 12:33:24 +0000 (20:33 +0800)]
AVX512FP16: Add permutation and mask blend intrinsics.

gcc/ChangeLog:

* config/i386/avx512fp16intrin.h:
(_mm512_mask_blend_ph): New intrinsic.
(_mm512_permutex2var_ph): Ditto.
(_mm512_permutexvar_ph): Ditto.
* config/i386/avx512fp16vlintrin.h:
(_mm256_mask_blend_ph): New intrinsic.
(_mm256_permutex2var_ph): Ditto.
(_mm256_permutexvar_ph): Ditto.
(_mm_mask_blend_ph): Ditto.
(_mm_permutex2var_ph): Ditto.
(_mm_permutexvar_ph): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-14.c: New test.

3 years agoAVX512FP16: Add complex conjugation intrinsic instructions.
dianhong xu [Tue, 22 Jun 2021 12:33:24 +0000 (20:33 +0800)]
AVX512FP16: Add complex conjugation intrinsic instructions.

gcc/ChangeLog:

* config/i386/avx512fp16intrin.h: Add new intrinsics.
(_mm512_conj_pch): New intrinsic.
(_mm512_mask_conj_pch): Ditto.
(_mm512_maskz_conj_pch): Ditto.
* config/i386/avx512fp16vlintrin.h: Add new intrinsics.
(_mm256_conj_pch): New intrinsic.
(_mm256_mask_conj_pch): Ditto.
(_mm256_maskz_conj_pch): Ditto.
(_mm_conj_pch): Ditto.
(_mm_mask_conj_pch): Ditto.
(_mm_maskz_conj_pch): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-conjugation-1.c: New test.
* gcc.target/i386/avx512fp16vl-conjugation-1.c: New test.

3 years agoAVX512FP16: Add reduce operators(add/mul/min/max).
dianhong xu [Mon, 21 Jun 2021 08:11:23 +0000 (16:11 +0800)]
AVX512FP16: Add reduce operators(add/mul/min/max).

gcc/ChangeLog:

* config/i386/avx512fp16intrin.h (_MM512_REDUCE_OP): New macro
(_mm512_reduce_add_ph): New intrinsic.
(_mm512_reduce_mul_ph): Ditto.
(_mm512_reduce_min_ph): Ditto.
(_mm512_reduce_max_ph): Ditto.
* config/i386/avx512fp16vlintrin.h
(_MM256_REDUCE_OP/_MM_REDUCE_OP): New macro.
(_mm256_reduce_add_ph): New intrinsic.
(_mm256_reduce_mul_ph): Ditto.
(_mm256_reduce_min_ph): Ditto.
(_mm256_reduce_max_ph): Ditto.
(_mm_reduce_add_ph): Ditto.
(_mm_reduce_mul_ph): Ditto.
(_mm_reduce_min_ph): Ditto.
(_mm_reduce_max_ph): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-reduce-op-1.c: New test.
* gcc.target/i386/avx512fp16vl-reduce-op-1.c: Ditto.

3 years agoAVX512FP16: Support load/store/abs intrinsics.
dianhong xu [Tue, 15 Jun 2021 09:00:35 +0000 (17:00 +0800)]
AVX512FP16: Support load/store/abs intrinsics.

gcc/ChangeLog:

* config/i386/avx512fp16intrin.h (__m512h_u, __m256h_u,
__m128h_u): New typedef.
(_mm512_load_ph): New intrinsic.
(_mm256_load_ph): Ditto.
(_mm_load_ph): Ditto.
(_mm512_loadu_ph): Ditto.
(_mm256_loadu_ph): Ditto.
(_mm_loadu_ph): Ditto.
(_mm512_store_ph): Ditto.
(_mm256_store_ph): Ditto.
(_mm_store_ph): Ditto.
(_mm512_storeu_ph): Ditto.
(_mm256_storeu_ph): Ditto.
(_mm_storeu_ph): Ditto.
(_mm512_abs_ph): Ditto.
* config/i386/avx512fp16vlintrin.h
(_mm_abs_ph): Ditto.
(_mm256_abs_ph): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-13.c: New test.

3 years agoSmall tweak to comments in range_cannot_be_superflat
Eric Botcazou [Wed, 22 Sep 2021 10:18:48 +0000 (12:18 +0200)]
Small tweak to comments in range_cannot_be_superflat

gcc/ada/
* gcc-interface/decl.c (range_cannot_be_superflat): Tweak comments.

3 years agoIBM Z: TPF: Add cc clobber to profiling expanders
Andreas Krebbel [Wed, 22 Sep 2021 10:13:05 +0000 (12:13 +0200)]
IBM Z: TPF: Add cc clobber to profiling expanders

The code sequence emitted uses CC internally.

gcc/ChangeLog:

* config/s390/tpf.md (prologue_tpf, epilogue_tpf): Add cc clobber.

3 years agoFortran: Add gfc_simple_for_loop aux function
Tobias Burnus [Wed, 22 Sep 2021 09:11:00 +0000 (11:11 +0200)]
Fortran: Add gfc_simple_for_loop aux function

Function to generate a simple loop (to be used internally).
Callers will be added in follow-up commits.

gcc/fortran/
* trans-expr.c (gfc_simple_for_loop): New.
* trans.h (gfc_simple_for_loop): New prototype.

3 years agoobstack.h __PTR_ALIGN vs. ubsan
Alan Modra [Wed, 1 Sep 2021 23:35:05 +0000 (09:05 +0930)]
obstack.h __PTR_ALIGN vs. ubsan

Current ubsan complains on every use of __PTR_ALIGN (when ptrdiff_t is
as large as a pointer), due to making calculations relative to a NULL
pointer.  This patch avoids the problem by extracting out and
simplifying __BPTR_ALIGN for the usual case.  I've continued to use
ptrdiff_t here, where it might be better to throw away __BPTR_ALIGN
entirely and just assume uintptr_t exists.

* obstack.h (__PTR_ALIGN): Expand and simplify __BPTR_ALIGN
rather than calculating relative to a NULL pointer.

3 years agoIBM Z: Fix PR102222
Andreas Krebbel [Wed, 22 Sep 2021 07:32:21 +0000 (09:32 +0200)]
IBM Z: Fix PR102222

Avoid emitting a strict low part move if the insv target actually
affects the whole target reg.

gcc/ChangeLog:

PR target/102222
* config/s390/s390.c (s390_expand_insv): Emit a normal move if it
is actually a full copy of the source operand into the target.
Don't emit a strict low part move if source and target mode match.

gcc/testsuite/ChangeLog:

* gcc.target/s390/pr102222.c: New test.

3 years agoopenmp: Fix OpenMP expansion of scope with non-fallthrugh body [PR102415]
Jakub Jelinek [Wed, 22 Sep 2021 07:32:32 +0000 (09:32 +0200)]
openmp: Fix OpenMP expansion of scope with non-fallthrugh body [PR102415]

I've used function for omp single expansion also for omp scope.  That is
mostly ok, but as the testcase shows, there is one important difference.
The omp single expansion always has a fallthru body, because it during
omp lowering expands the body as if wrapped in an if to simulate that
one thread runs the body and others wait (unless nowait) until it completes
and continue.  omp scope is invoked by all threads and so if the body
is non-fallthru, the barrier (unless nowait) at the end will not be reached
by any of the threads.

The following patch fixes that by handling the case where cfg pass optimizes
away the exit bb of it gracefully.

2021-09-22  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/102415
* omp-expand.c (expand_omp_single): If region->exit is NULL,
assert region->entry is GIMPLE_OMP_SCOPE region and return.

* c-c++-common/gomp/scope-3.c: New test.

3 years agoopenmp: Add support for allocator and align modifiers on allocate clauses
Jakub Jelinek [Wed, 22 Sep 2021 07:29:13 +0000 (09:29 +0200)]
openmp: Add support for allocator and align modifiers on allocate clauses

As the allocate-2.c testcase shows, this change isn't 100% backwards compatible,
one could have allocate and/or align functions that return an OpenMP allocator
handle and previously it would call those functions and now would use those
names as keywords for the modifiers.  But it allows specify extra alignment
requirements for the allocations.

2021-09-22  Jakub Jelinek  <jakub@redhat.com>

gcc/
* tree.h (OMP_CLAUSE_ALLOCATE_ALIGN): Define.
* tree.c (omp_clause_num_ops): Change number of OMP_CLAUSE_ALLOCATE
arguments from 2 to 3.
* tree-pretty-print.c (dump_omp_clause): Print allocator() around
allocate clause allocator and print align if present.
* omp-low.c (scan_sharing_clauses): Force allocate_map entry even
for omp_default_mem_alloc if align modifier is present.  If align
modifier is present, use TREE_LIST to encode both allocator and
align.
(lower_private_allocate, lower_rec_input_clauses, create_task_copyfn):
Handle align modifier on allocator clause if present.
gcc/c-family/
* c-omp.c (c_omp_split_clauses): Copy over OMP_CLAUSE_ALLOCATE_ALIGN.
gcc/c/
* c-parser.c (c_parser_omp_clause_allocate): Parse allocate clause
modifiers.
gcc/cp/
* parser.c (cp_parser_omp_clause_allocate): Parse allocate clause
modifiers.
* semantics.c (finish_omp_clauses) <OMP_CLAUSE_ALLOCATE>: Perform
semantic analysis of OMP_CLAUSE_ALLOCATE_ALIGN.
* pt.c (tsubst_omp_clauses) <case OMP_CLAUSE_ALLOCATE>: Handle
also OMP_CLAUSE_ALLOCATE_ALIGN.
gcc/testsuite/
* c-c++-common/gomp/allocate-6.c: New test.
* c-c++-common/gomp/allocate-7.c: New test.
* g++.dg/gomp/allocate-4.C: New test.
libgomp/
* testsuite/libgomp.c-c++-common/allocate-2.c: New test.
* testsuite/libgomp.c-c++-common/allocate-3.c: New test.

3 years agolibgcc, X86: Adjust guard for Mach-O code.
Iain Sandoe [Wed, 22 Sep 2021 06:42:21 +0000 (07:42 +0100)]
libgcc, X86: Adjust guard for Mach-O code.

Existing code in the sfp-machine header has been using __MACH__
as a guard for Mach-O, where currently symbols aliases are not
supported.

__MACH__ is not a sufficient guard for this, since the define
is also emitted for HURD, at least.

Fixed by amending the guard to use __APPLE__ instead.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
libgcc/ChangeLog:

* config/i386/sfp-machine.h: Guard Mach-O-specific code
using __APPLE__.

3 years agoSupport 64bit fma/fms/fnma/fnms under avx512vl.
liuhongt [Wed, 22 Sep 2021 01:54:08 +0000 (09:54 +0800)]
Support 64bit fma/fms/fnma/fnms under avx512vl.

gcc/ChangeLog:

* config/i386/i386.md (define_attr "isa"): Add
fma_or_avx512vl.
(define_attr "enabled"): Correspond fma_or_avx512vl to
TARGET_FMA || TARGET_AVX512VL.
* config/i386/mmx.md (fmav2sf4): Extend to AVX512 fma.
(fmsv2sf4): Ditto.
(fnmav2sf4): Ditto.
(fnmsv2sf4): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512vl-pr95046.c: New test.

3 years agoAdjust testcase.
liuhongt [Wed, 22 Sep 2021 05:14:42 +0000 (13:14 +0800)]
Adjust testcase.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr92658-avx512f.c: Refine testcase.
* gcc.target/i386/pr92658-avx512vl.c: Adjust scan-assembler,
only v2di->v2qi truncate is not supported, v4di->v4qi should
be supported.

3 years agoAVX512FP16: Add expander for cstorehf4.
liuhongt [Mon, 13 Jul 2020 08:04:05 +0000 (16:04 +0800)]
AVX512FP16: Add expander for cstorehf4.

gcc/ChangeLog:

* config/i386/i386.md (cstorehf3): New define_expand.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-builtin-fpcompare-1.c: New test.
* gcc.target/i386/avx512fp16-builtin-fpcompare-2.c: New test.

3 years agoAVX512FP16: Add expander for ceil/floor/trunc/roundeven.
liuhongt [Mon, 13 Jul 2020 06:19:21 +0000 (14:19 +0800)]
AVX512FP16: Add expander for ceil/floor/trunc/roundeven.

gcc/ChangeLog:

* config/i386/i386.md (<rounding_insn>hf2): New expander.
(sse4_1_round<mode>2): Extend from MODEF to MODEFH.
* config/i386/sse.md (*sse4_1_round<ssescalarmodesuffix>):
Extend from VF_128 to VFH_128.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-builtin-round-1.c: New test.

3 years agoAVX512FP16: Add expander for sqrthf2.
liuhongt [Fri, 10 Jul 2020 07:22:30 +0000 (15:22 +0800)]
AVX512FP16: Add expander for sqrthf2.

gcc/ChangeLog:

* config/i386/i386-features.c (i386-features.c): Handle
E_HFmode.
* config/i386/i386.md (sqrthf2): New expander.
(*sqrthf2): New define_insn.
* config/i386/sse.md
(*<sse>_vmsqrt<mode>2<mask_scalar_name><round_scalar_name>):
Extend to VFH_128.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-builtin-sqrt-1.c: New test.
* gcc.target/i386/avx512fp16vl-builtin-sqrt-1.c: New test.

3 years agoAVX512FP16: Add testcases for vfcmaddcsh/vfmaddcsh/vfcmulcsh/vfmulcsh.
liuhongt [Mon, 2 Mar 2020 10:00:49 +0000 (18:00 +0800)]
AVX512FP16: Add testcases for vfcmaddcsh/vfmaddcsh/vfcmulcsh/vfmulcsh.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-vfcmaddcsh-1a.c: New test.
* gcc.target/i386/avx512fp16-vfcmaddcsh-1b.c: Ditto.
* gcc.target/i386/avx512fp16-vfcmulcsh-1a.c: Ditto.
* gcc.target/i386/avx512fp16-vfcmulcsh-1b.c: Ditto.
* gcc.target/i386/avx512fp16-vfmaddcsh-1a.c: Ditto.
* gcc.target/i386/avx512fp16-vfmaddcsh-1b.c: Ditto.
* gcc.target/i386/avx512fp16-vfmulcsh-1a.c: Ditto.
* gcc.target/i386/avx512fp16-vfmulcsh-1b.c: Ditto.
* gcc.target/i386/avx512fp16-complex-constraints.c: Ditto.

3 years agoAVX512FP16: Add vfcmaddcsh/vfmaddcsh/vfcmulcsh/vfmulcsh.
liuhongt [Mon, 2 Mar 2020 09:58:04 +0000 (17:58 +0800)]
AVX512FP16: Add vfcmaddcsh/vfmaddcsh/vfcmulcsh/vfmulcsh.

gcc/ChangeLog:

* config/i386/avx512fp16intrin.h (_mm_mask_fcmadd_sch):
New intrinsic.
(_mm_mask3_fcmadd_sch): Likewise.
(_mm_maskz_fcmadd_sch): Likewise.
(_mm_fcmadd_sch): Likewise.
(_mm_mask_fmadd_sch): Likewise.
(_mm_mask3_fmadd_sch): Likewise.
(_mm_maskz_fmadd_sch): Likewise.
(_mm_fmadd_sch): Likewise.
(_mm_mask_fcmadd_round_sch): Likewise.
(_mm_mask3_fcmadd_round_sch): Likewise.
(_mm_maskz_fcmadd_round_sch): Likewise.
(_mm_fcmadd_round_sch): Likewise.
(_mm_mask_fmadd_round_sch): Likewise.
(_mm_mask3_fmadd_round_sch): Likewise.
(_mm_maskz_fmadd_round_sch): Likewise.
(_mm_fmadd_round_sch): Likewise.
(_mm_fcmul_sch): Likewise.
(_mm_mask_fcmul_sch): Likewise.
(_mm_maskz_fcmul_sch): Likewise.
(_mm_fmul_sch): Likewise.
(_mm_mask_fmul_sch): Likewise.
(_mm_maskz_fmul_sch): Likewise.
(_mm_fcmul_round_sch): Likewise.
(_mm_mask_fcmul_round_sch): Likewise.
(_mm_maskz_fcmul_round_sch): Likewise.
(_mm_fmul_round_sch): Likewise.
(_mm_mask_fmul_round_sch): Likewise.
(_mm_maskz_fmul_round_sch): Likewise.
* config/i386/i386-builtin.def: Add corresponding new builtins.
* config/i386/sse.md
(avx512fp16_fmaddcsh_v8hf_maskz<round_expand_name>): New expander.
(avx512fp16_fcmaddcsh_v8hf_maskz<round_expand_name>): Ditto.
(avx512fp16_fma_<complexopname>sh_v8hf<mask_scalarcz_name><round_scalarcz_name>):
New define insn.
(avx512fp16_<complexopname>sh_v8hf_mask<round_name>): Ditto.
(avx512fp16_<complexopname>sh_v8hf<mask_scalarc_name><round_scalarcz_name>):
Ditto.
* config/i386/subst.md (mask_scalarcz_name): New.
(mask_scalarc_name): Ditto.
(mask_scalarc_operand3): Ditto.
(mask_scalarcz_operand4): Ditto.
(round_scalarcz_name): Ditto.
(round_scalarc_mask_operand3): Ditto.
(round_scalarcz_mask_operand4): Ditto.
(round_scalarc_mask_op3): Ditto.
(round_scalarcz_mask_op4): Ditto.
(round_scalarcz_constraint): Ditto.
(round_scalarcz_nimm_predicate): Ditto.
(mask_scalarcz): Ditto.
(mask_scalarc): Ditto.
(round_scalarcz): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx-1.c: Add test for new builtins.
* gcc.target/i386/sse-13.c: Ditto.
* gcc.target/i386/sse-23.c: Ditto.
* gcc.target/i386/sse-14.c: Add test for new intrinsics.
* gcc.target/i386/sse-22.c: Ditto.

3 years agoAVX512FP16: Add testcases for vfcmaddcph/vfmaddcph/vfcmulcph/vfmulcph.
liuhongt [Mon, 2 Mar 2020 09:59:20 +0000 (17:59 +0800)]
AVX512FP16: Add testcases for vfcmaddcph/vfmaddcph/vfcmulcph/vfmulcph.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-helper.h
(init_src): Adjust init value.
(NET_CMASK): New net mask for complex input.
* gcc.target/i386/avx512fp16-vfcmaddcph-1a.c: New test.
* gcc.target/i386/avx512fp16-vfcmaddcph-1b.c: Ditto.
* gcc.target/i386/avx512fp16-vfcmulcph-1a.c: Ditto.
* gcc.target/i386/avx512fp16-vfcmulcph-1b.c: Ditto.
* gcc.target/i386/avx512fp16-vfmaddcph-1a.c: Ditto.
* gcc.target/i386/avx512fp16-vfmaddcph-1b.c: Ditto.
* gcc.target/i386/avx512fp16-vfmulcph-1a.c: Ditto.
* gcc.target/i386/avx512fp16-vfmulcph-1b.c: Ditto.
* gcc.target/i386/avx512fp16vl-vfcmaddcph-1a.c: Ditto.
* gcc.target/i386/avx512fp16vl-vfcmaddcph-1b.c: Ditto.
* gcc.target/i386/avx512fp16vl-vfcmulcph-1a.c: Ditto.
* gcc.target/i386/avx512fp16vl-vfcmulcph-1b.c: Ditto.
* gcc.target/i386/avx512fp16vl-vfmaddcph-1a.c: Ditto.
* gcc.target/i386/avx512fp16vl-vfmaddcph-1b.c: Ditto.
* gcc.target/i386/avx512fp16vl-vfmulcph-1a.c: Ditto.
* gcc.target/i386/avx512fp16vl-vfmulcph-1b.c: Ditto.

3 years agoAVX512FP16: Add vfcmaddcph/vfmaddcph/vfcmulcph/vfmulcph
liuhongt [Mon, 2 Mar 2020 09:49:32 +0000 (17:49 +0800)]
AVX512FP16: Add vfcmaddcph/vfmaddcph/vfcmulcph/vfmulcph

gcc/ChangeLog:

* config/i386/avx512fp16intrin.h (_mm512_fcmadd_pch):
New intrinsic.
(_mm512_mask_fcmadd_pch): Likewise.
(_mm512_mask3_fcmadd_pch): Likewise.
(_mm512_maskz_fcmadd_pch): Likewise.
(_mm512_fmadd_pch): Likewise.
(_mm512_mask_fmadd_pch): Likewise.
(_mm512_mask3_fmadd_pch): Likewise.
(_mm512_maskz_fmadd_pch): Likewise.
(_mm512_fcmadd_round_pch): Likewise.
(_mm512_mask_fcmadd_round_pch): Likewise.
(_mm512_mask3_fcmadd_round_pch): Likewise.
(_mm512_maskz_fcmadd_round_pch): Likewise.
(_mm512_fmadd_round_pch): Likewise.
(_mm512_mask_fmadd_round_pch): Likewise.
(_mm512_mask3_fmadd_round_pch): Likewise.
(_mm512_maskz_fmadd_round_pch): Likewise.
(_mm512_fcmul_pch): Likewise.
(_mm512_mask_fcmul_pch): Likewise.
(_mm512_maskz_fcmul_pch): Likewise.
(_mm512_fmul_pch): Likewise.
(_mm512_mask_fmul_pch): Likewise.
(_mm512_maskz_fmul_pch): Likewise.
(_mm512_fcmul_round_pch): Likewise.
(_mm512_mask_fcmul_round_pch): Likewise.
(_mm512_maskz_fcmul_round_pch): Likewise.
(_mm512_fmul_round_pch): Likewise.
(_mm512_mask_fmul_round_pch): Likewise.
(_mm512_maskz_fmul_round_pch): Likewise.
* config/i386/avx512fp16vlintrin.h (_mm_fmadd_pch):
New intrinsic.
(_mm_mask_fmadd_pch): Likewise.
(_mm_mask3_fmadd_pch): Likewise.
(_mm_maskz_fmadd_pch): Likewise.
(_mm256_fmadd_pch): Likewise.
(_mm256_mask_fmadd_pch): Likewise.
(_mm256_mask3_fmadd_pch): Likewise.
(_mm256_maskz_fmadd_pch): Likewise.
(_mm_fcmadd_pch): Likewise.
(_mm_mask_fcmadd_pch): Likewise.
(_mm_mask3_fcmadd_pch): Likewise.
(_mm_maskz_fcmadd_pch): Likewise.
(_mm256_fcmadd_pch): Likewise.
(_mm256_mask_fcmadd_pch): Likewise.
(_mm256_mask3_fcmadd_pch): Likewise.
(_mm256_maskz_fcmadd_pch): Likewise.
(_mm_fmul_pch): Likewise.
(_mm_mask_fmul_pch): Likewise.
(_mm_maskz_fmul_pch): Likewise.
(_mm256_fmul_pch): Likewise.
(_mm256_mask_fmul_pch): Likewise.
(_mm256_maskz_fmul_pch): Likewise.
(_mm_fcmul_pch): Likewise.
(_mm_mask_fcmul_pch): Likewise.
(_mm_maskz_fcmul_pch): Likewise.
(_mm256_fcmul_pch): Likewise.
(_mm256_mask_fcmul_pch): Likewise.
(_mm256_maskz_fcmul_pch): Likewise.
* config/i386/i386-builtin-types.def (V8HF_FTYPE_V8HF_V8HF_V8HF,
V8HF_FTYPE_V16HF_V16HF_V16HF, V16HF_FTYPE_V16HF_V16HF_V16HF_UQI,
V32HF_FTYPE_V32HF_V32HF_V32HF_INT,
V32HF_FTYPE_V32HF_V32HF_V32HF_UHI_INT): Add new builtin types.
* config/i386/i386-builtin.def: Add new builtins.
* config/i386/i386-expand.c: Handle new builtin types.
* config/i386/subst.md (SUBST_CV): New.
(maskc_name): Ditto.
(maskc_operand3): Ditto.
(maskc): Ditto.
(sdc_maskz_name): Ditto.
(sdc_mask_op4): Ditto.
(sdc_mask_op5): Ditto.
(sdc_mask_mode512bit_condition): Ditto.
(sdc): Ditto.
(round_maskc_operand3): Ditto.
(round_sdc_mask_operand4): Ditto.
(round_maskc_op3): Ditto.
(round_sdc_mask_op4): Ditto.
(round_saeonly_sdc_mask_operand5): Ditto.
* config/i386/sse.md (unspec): Add complex fma unspecs.
(avx512fmaskcmode): New.
(UNSPEC_COMPLEX_F_C_MA): Ditto.
(UNSPEC_COMPLEX_F_C_MUL): Ditto.
(complexopname): Ditto.
(<avx512>_fmaddc_<mode>_maskz<round_expand_name>): New expander.
(<avx512>_fcmaddc_<mode>_maskz<round_expand_name>): Ditto.
(fma_<complexopname>_<mode><sdc_maskz_name><round_name>): New
define insn.
(<avx512>_<complexopname>_<mode>_mask<round_name>): Ditto.
(<avx512>_<complexopname>_<mode><maskc_name><round_name>): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx-1.c: Add test for new builtins.
* gcc.target/i386/sse-13.c: Ditto.
* gcc.target/i386/sse-23.c: Ditto.
* gcc.target/i386/sse-14.c: Add test for new intrinsics.
* gcc.target/i386/sse-22.c: Ditto.

3 years agors6000: Parameterize some const values for density test
Kewen Lin [Wed, 22 Sep 2021 03:25:54 +0000 (22:25 -0500)]
rs6000: Parameterize some const values for density test

This patch follows the discussion here[1], where Segher suggested
parameterizing those exact magic constants for density heuristics,
to make it easier to tweak if need.

The change here should be "No Functional Change".  But I verified
it with SPEC2017 at option sets O2-vect and Ofast-unroll on Power8,
the result is neutral as expected.

[1]https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579121.html

gcc/ChangeLog:

* config/rs6000/rs6000.opt (rs6000-density-pct-threshold,
rs6000-density-size-threshold, rs6000-density-penalty,
rs6000-density-load-pct-threshold,
rs6000-density-load-num-threshold): New parameter.
* config/rs6000/rs6000.c (rs6000_density_test): Adjust with
corresponding parameters.

3 years agoc++: fix template instantiation comparison in redeclarations
Barrett Adair [Wed, 15 Sep 2021 20:26:22 +0000 (15:26 -0500)]
c++: fix template instantiation comparison in redeclarations

This change fixes a primordial c++11 frontend defect where function template
redeclarations with trailing return types that used dependent
sizeof/alignof/noexcept expressions in template value arguments failed to
compare as equivalent to the identical primary template declaration. By
forcing structural AST comparison of the template arguments, we no longer
require TYPE_CANONICAL to match in this case. The new canon-type-{15..18}.C
tests failed with all prior GCC versions, where the redeclarations were
incorrectly reported as ambiguous overloads. The new dependent-name{15,16}.C
tests are regression tests for sneaky problems encountered during
development of this fix. Note that this fix does not address the use of parm
objects' constexpr members as template arguments within a declaration (a
superficially similar longstanding defect).

gcc/cp/ChangeLog:

* pt.c (find_parm_usage_r): New walk_tree callback to find func
parms.
(any_template_arguments_need_structural_equality_p): New special
case.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-52830.C: Remove unwanted dg-ice.
* g++.dg/template/canon-type-15.C: New test.
* g++.dg/template/canon-type-16.C: New test.
* g++.dg/template/canon-type-17.C: New test.
* g++.dg/template/canon-type-18.C: New test.
* g++.dg/template/dependent-name15.C: New regression test.
* g++.dg/template/dependent-name16.C: New regression test.

3 years agoDaily bump.
GCC Administrator [Wed, 22 Sep 2021 00:16:28 +0000 (00:16 +0000)]
Daily bump.

3 years agoruntime: set runtime.GOROOT value at build time
Ian Lance Taylor [Tue, 21 Sep 2021 18:44:26 +0000 (11:44 -0700)]
runtime: set runtime.GOROOT value at build time

In Go 1.17 the gc toolchain changed to set runtime.GOROOT in cmd/link
(previously it was runtime/internal/sys.GOROOT).  Do the same in libgo.

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

gotools/:
* Makefile.am (check-runtime): Add goroot.go to --extrafiles.
* Makefile.in: Regenerate.

3 years agopath solver: Use ranger to solve unknowns.
Aldy Hernandez [Tue, 21 Sep 2021 07:24:12 +0000 (09:24 +0200)]
path solver: Use ranger to solve unknowns.

The default behavior for the path solver is to resort to VARYING when
the range for an unknown SSA is outside the given path.  This is both
cheap and fast, but fails to get a significant amount of ranges that
traditionally the DOM and VRP threaders could get.

This patch uses the ranger to resolve any unknown names upon entry to
the path.  It also uses equivalences to improve ranges.

gcc/ChangeLog:

* gimple-range-path.cc (path_range_query::defined_outside_path):
New.
(path_range_query::range_on_path_entry): New.
(path_range_query::internal_range_of_expr): Resolve unknowns
with ranger.
(path_range_query::improve_range_with_equivs): New.
(path_range_query::ssa_range_in_phi): Resolve unknowns with
ranger.
* gimple-range-path.h (class path_range_query): Add
defined_outside_path, range_on_path_entry, and
improve_range_with_equivs.

3 years agopath solver: Add related SSAs to solvable set.
Aldy Hernandez [Tue, 21 Sep 2021 07:21:55 +0000 (09:21 +0200)]
path solver: Add related SSAs to solvable set.

The path solver takes an initial set of SSA names which are deemed
interesting.  These are then solved along the path.  Adding any copies
of said SSA names to the list of interesting names yields significantly
better results.  This patch adds said copies to the already provided
list.

Currently this code is guarded by "m_resolve", which is the more
expensive mode, but it would be reasonable to make it available always,
especially since adding more imports usually has minimal impact on the
processing time.  I will investigate and make it universally available
if this is indeed the case.

gcc/ChangeLog:

* gimple-range-path.cc (path_range_query::add_to_imports): New.
(path_range_query::add_copies_to_imports): New.
(path_range_query::precompute_ranges): Call
add_copies_to_imports.
* gimple-range-path.h (class path_range_query): Add prototypes
for add_copies_to_imports and add_to_imports.

3 years agopath solver: Remove useless code.
Aldy Hernandez [Tue, 21 Sep 2021 07:17:57 +0000 (09:17 +0200)]
path solver: Remove useless code.

gcc/ChangeLog:

* gimple-range-path.cc (path_range_query::range_defined_in_block):
Remove useless code.

3 years agopath solver: Add relation support.
Aldy Hernandez [Tue, 21 Sep 2021 07:04:20 +0000 (09:04 +0200)]
path solver: Add relation support.

This patch adds relational support to the path solver.  It uses a
path_oracle that keeps track of relations within a path which are
augmented by relations on entry to the path.  With it, range_of_stmt,
range_of_expr, and friends can give relation aware answers.

gcc/ChangeLog:

* gimple-range-fold.h (class fur_source): Make oracle protected.
* gimple-range-path.cc (path_range_query::path_range_query): Add
resolve argument.  Initialize oracle.
(path_range_query::~path_range_query): Delete oracle.
(path_range_query::range_of_stmt): Adapt to use relations.
(path_range_query::precompute_ranges): Pre-compute relations.
(class jt_fur_source): New
(jt_fur_source::jt_fur_source): New.
(jt_fur_source::register_relation): New.
(jt_fur_source::query_relation): New.
(path_range_query::precompute_relations): New.
(path_range_query::precompute_phi_relations): New.
* gimple-range-path.h (path_range_query): Add resolve argument.
Add oracle, precompute_relations, precompute_phi_relations.
* tree-ssa-threadbackward.c (back_threader::back_threader): Pass
resolve argument to solver.

3 years agoMove postfold_gcond_edges into fur_source.
Aldy Hernandez [Sun, 19 Sep 2021 16:33:37 +0000 (18:33 +0200)]
Move postfold_gcond_edges into fur_source.

The code registering outgoing edges from a cond is living in
fold_using_range, which makes it difficult to be called from other
places.  Also, it refuses to register relations on the outgoing
destinations that have more than one predecessor.  This latter issue is
a problem because we would like to register outgoing edges along a path
in the path solver (regardless of single_pred_p).

gcc/ChangeLog:

* gimple-range-fold.cc (fold_using_range::range_of_range_op):
Rename postfold_gcond_edges to register_outgoing_edges and
adapt.
(fold_using_range::postfold_gcond_edges): Rename...
(fur_source::register_outgoing_edges): ...to this.
* gimple-range-fold.h (postfold_gcond_edges): Rename to
register_outgoing_edges and move to fur_source.

3 years agoDo not query SCEV in range_of_phi unless dominators are available.
Aldy Hernandez [Tue, 21 Sep 2021 06:28:28 +0000 (08:28 +0200)]
Do not query SCEV in range_of_phi unless dominators are available.

SCEV won't work without dominators and we can get called without
dominators from debug_ranger.

Another option would be to rename scev_initialized_p to something like
scev_available_p and move the check there.  For now, this will do.

gcc/ChangeLog:

* gimple-range-fold.cc (fold_using_range::range_of_phi): Check
dom_info_available_p.

3 years agoAllocate non_null_ref tables at creation.
Aldy Hernandez [Tue, 21 Sep 2021 06:26:50 +0000 (08:26 +0200)]
Allocate non_null_ref tables at creation.

Preallocating the space is slightly cheaper than calling
safe_grow_cleared.

gcc/ChangeLog:

* gimple-range-cache.cc (non_null_ref::non_null_ref): Use create
and quick_grow_cleared instead of safe_grow_cleared.

3 years ago[Ada] Add some comments in init.c about the lynx178 signal handler
Doug Rupp [Wed, 7 Jul 2021 16:38:34 +0000 (09:38 -0700)]
[Ada] Add some comments in init.c about the lynx178 signal handler

gcc/ada/

* init.c (__gnat_error_handler) [LynxOS]: Add a comment about
missing optional args.

3 years ago[Ada] Rename "optional" node subtypes that allow Empty
Yannick Moy [Mon, 12 Jul 2021 10:44:36 +0000 (12:44 +0200)]
[Ada] Rename "optional" node subtypes that allow Empty

gcc/ada/

* gen_il-gen.adb (Put_Opt_Subtype): Add suffix.

3 years ago[Ada] Spurious dynamic accessibility check on allocator
Justin Squirek [Fri, 9 Jul 2021 00:33:05 +0000 (20:33 -0400)]
[Ada] Spurious dynamic accessibility check on allocator

gcc/ada/

* sem_util.adb (Accessibility_Level): Remove spurious special
case for protected type components.
* exp_ch4.adb (Generate_Accessibility_Check): Use general
Accessibility_Level instead of the low-level function
Type_Access_Level.

3 years ago[Ada] Regenerate gnat_ugn.texi
Eric Botcazou [Fri, 9 Jul 2021 15:53:12 +0000 (17:53 +0200)]
[Ada] Regenerate gnat_ugn.texi

gcc/ada/

* gnat_ugn.texi: Regenerate.

3 years ago[Ada] SCOs: generate 'P' decisions for [Type_]Invariant pragmas
Matthieu Eyraud [Wed, 7 Jul 2021 17:33:25 +0000 (19:33 +0200)]
[Ada] SCOs: generate 'P' decisions for [Type_]Invariant pragmas

gcc/ada/

* par_sco.adb (Traverse_One): Add support for pragma Invariant /
Type_Invariant.

3 years ago[Ada] Add "optional" node subtypes that allow Empty
Bob Duff [Thu, 8 Jul 2021 17:26:53 +0000 (13:26 -0400)]
[Ada] Add "optional" node subtypes that allow Empty

gcc/ada/

* gen_il-gen.adb (Put_Opt_Subtype): Print out subtypes of the
form:
subtype Opt_N_Declaration is
Node_Id with Predicate =>
Opt_N_Declaration = Empty or else
Opt_N_Declaration in N_Declaration_Id;
One for each node or entity type, with the predicate allowing
Empty.
* atree.adb (Parent, Set_Parent): Remove unnecessary "Atree.".

3 years ago[Ada] bindgen: support additional features on targets suppressing the standard lib
Patrick Bernardi [Fri, 9 Jul 2021 10:29:04 +0000 (20:29 +1000)]
[Ada] bindgen: support additional features on targets suppressing the standard lib

gcc/ada/

* bindgen.adb (Gen_Adainit): For targets that suppress the
standard library: set the default stack size global variable if
a value is provided via the -d switch, and generate a call to
__gnat_initialize_stack_limit if stack checking using stack
limits is enabled.

3 years ago[Ada] Fix regression in ACATS bdd2006 and bdd2007
Bob Duff [Thu, 8 Jul 2021 16:55:38 +0000 (12:55 -0400)]
[Ada] Fix regression in ACATS bdd2006 and bdd2007

gcc/ada/

* sem_ch13.adb (Stream_Size): Print message about allowed stream
sizes even if other error were already found. This avoids
falling into the 'else', which prints "Stream_Size cannot be
given for...", which is misleading -- the Size COULD be given if
it were correct.

3 years ago[Ada] Set related expression for external DISCR symbols in Build_Temporary
Daniel Mercier [Fri, 2 Jul 2021 10:57:53 +0000 (12:57 +0200)]
[Ada] Set related expression for external DISCR symbols in Build_Temporary

gcc/ada/

* exp_util.adb (Build_Temporary): In case of an external DISCR
symbol, set the related expression for CodePeer so that a more
comprehensible message can be emitted to the user.

3 years ago[Ada] Minor tweaks to System.Dwarf_Line
Eric Botcazou [Thu, 8 Jul 2021 07:54:14 +0000 (09:54 +0200)]
[Ada] Minor tweaks to System.Dwarf_Line

gcc/ada/

* libgnat/s-dwalin.adb (Parse_Header): Tweak comments.
(Read_Entry_Format_Array): Tweak exception message.
(Symbolic_Address.Set_Result): Likewise.

3 years ago[Ada] Crash on build of Initialization procedure for derived container
Ed Schonberg [Wed, 7 Jul 2021 14:56:48 +0000 (10:56 -0400)]
[Ada] Crash on build of Initialization procedure for derived container

gcc/ada/

* exp_ch7.adb (Make_Init_Call): Add guard to protect against a
missing initialization procedure for a type.

3 years ago[Ada] Cleanup old VxWorks in Makefile.rtl
Doug Rupp [Tue, 6 Jul 2021 20:42:31 +0000 (13:42 -0700)]
[Ada] Cleanup old VxWorks in Makefile.rtl

gcc/ada/

* Makefile.rtl: Remove unused VxWorks sections.
* libgnarl/s-vxwext__noints.adb: Remove.
* libgnarl/s-vxwext__vthreads.ads: Remove.
* libgnat/a-elchha__vxworks-ppc-full.adb: Remove.
* libgnat/s-osprim__vxworks.adb: Remove.
* libgnat/s-osvers__vxworks-653.ads: Remove.
* libgnat/system-vxworks-e500-vthread.ads: Remove.
* libgnat/system-vxworks-ppc-vthread.ads: Remove.
* libgnat/system-vxworks-x86-vthread.ads: Remove.

3 years ago[Ada] Add assertions to Uintp (UI_Is_In_Int_Range)
Bob Duff [Tue, 6 Jul 2021 21:12:32 +0000 (17:12 -0400)]
[Ada] Add assertions to Uintp (UI_Is_In_Int_Range)

gcc/ada/

* uintp.ads, uintp.adb (UI_Is_In_Int_Range): Change the type of
the formal parameter to Valid_Uint. Remove code that preserved
the previous behavior, and replace it with an assertion. The
previous behavior is no longer needed given the recent change to
gigi.
(No, Present): Add comment.

3 years ago[Ada] Remove if_expression
Bob Duff [Tue, 6 Jul 2021 20:56:58 +0000 (16:56 -0400)]
[Ada] Remove if_expression

gcc/ada/

* sem_eval.adb (Fold_Shift): Replace an if_expression with an
if_statement.

3 years ago[Ada] Add assertions to Uintp
Bob Duff [Mon, 5 Jul 2021 22:01:22 +0000 (18:01 -0400)]
[Ada] Add assertions to Uintp

gcc/ada/

* uintp.ads, uintp.adb: Add assertions.
(Ubool, Opt_Ubool): New "boolean" subtypes.
(UI_Is_In_Int_Range): The parameter should probably be
Valid_Uint, but we don't change that for now, because it causes
failures in gigi.
* sem_util.ads, sem_util.adb (Is_True, Is_False,
Static_Boolean): Use Opt_Ubool subtype.  Document the fact that
Is_True (No_Uint) = True.  Implement Is_False in terms of
Is_True.  We considered changing Static_Boolean to return Uint_1
in case of error, but that doesn't fit in well with
Static_Integer.
(Has_Compatible_Alignment_Internal): Deal with cases where Offs
is No_Uint. Change one "and" to "and then" to ensure we don't
pass No_Uint to ">", which would violate the new assertions.
* exp_util.adb, freeze.adb, sem_ch13.adb: Avoid violating new
assertions in Uintp.

3 years ago[Ada] Small optimization to DWARF 5 mode in System.Dwarf_Line
Eric Botcazou [Tue, 6 Jul 2021 14:47:31 +0000 (16:47 +0200)]
[Ada] Small optimization to DWARF 5 mode in System.Dwarf_Line

gcc/ada/

* libgnat/s-dwalin.adb (To_File_Name): Fetch only the last string
from the .debug_line_str section.
(Symbolic_Address.Set_Result): Likewise.

3 years ago[Ada] Follow-up tweaks to System.Dwarf_Line
Eric Botcazou [Tue, 6 Jul 2021 10:18:57 +0000 (12:18 +0200)]
[Ada] Follow-up tweaks to System.Dwarf_Line

gcc/ada/

* libgnat/s-dwalin.adb (Skip_Form): Fix cases of DW_FORM_addrx
and DW_FORM_implicit_const.  Replace Constraint_Error with
Dwarf_Error.

3 years ago[Ada] exp_pakd.adb: work around spurious Codepeer warnings
Ghjuvan Lacambre [Mon, 5 Jul 2021 15:08:56 +0000 (17:08 +0200)]
[Ada] exp_pakd.adb: work around spurious Codepeer warnings

gcc/ada/

* exp_pakd.adb (Expand_Packed_Not): Replace expression with
statement.

3 years ago[Ada] Fix ignored dynamic predicates specified through "predicate" aspect
Ghjuvan Lacambre [Fri, 2 Jul 2021 14:09:27 +0000 (16:09 +0200)]
[Ada] Fix ignored dynamic predicates specified through "predicate" aspect

gcc/ada/

* sem_eval.adb (Is_Static_Subtype): Take predicates created
through "predicate" pragma into account.

3 years ago[Ada] rtems: add 128bit support for aarch64
Frederic Konrad [Tue, 29 Jun 2021 09:21:26 +0000 (11:21 +0200)]
[Ada] rtems: add 128bit support for aarch64

gcc/ada/

* Makefile.rtl (aarch64-rtems*): Add GNATRTL_128BIT_PAIRS to
the LIBGNAT_TARGET_PAIRS list and also GNATRTL_128BIT_OBJS to
the EXTRA_GNATRTL_NONTASKING_OBJS list.

3 years ago[Ada] Presence of abstract operator function causes resolution problems
Gary Dismukes [Fri, 2 Jul 2021 20:51:31 +0000 (16:51 -0400)]
[Ada] Presence of abstract operator function causes resolution problems

gcc/ada/

* sem_ch4.adb (Remove_Abstract_Operations): Add condition to
test for an E_Operator as part of criteria for setting
Abstract_Op on interpretations involving predefined operators.

3 years ago[Ada] Interface behaves differently from abstract tagged null
Javier Miranda [Fri, 2 Jul 2021 17:13:12 +0000 (13:13 -0400)]
[Ada] Interface behaves differently from abstract tagged null

gcc/ada/

* exp_ch6.adb (Expand_Simple_Function_Return): For explicit
dereference of type conversion, enable code that ensures that
the tag of the result is that of the result type.

3 years ago[Ada] Clean up uses of Esize and RM_Size
Bob Duff [Fri, 2 Jul 2021 15:41:28 +0000 (11:41 -0400)]
[Ada] Clean up uses of Esize and RM_Size

gcc/ada/

* einfo-utils.adb: Add support (currently disabled) for using
"initial zero" instead of "Uint_0" to represent "unknown".  Call
Known_ functions, instead of evilly duplicating their code
inline.
* fe.h (No_Uint_To_0): New function to convert No_Uint to
Uint_0, in order to preserve existing behavior.
(Copy_Esize, Copy_RM_Size): New imports from Einfo.Utils.
* cstand.adb: Set size fields of Standard_Debug_Renaming_Type
and Standard_Exception_Type.
* checks.adb, exp_attr.adb, exp_ch3.adb, exp_ch5.adb,
exp_ch6.adb, exp_pakd.adb, exp_util.adb, freeze.adb, itypes.adb,
layout.adb, repinfo.adb, sem_attr.adb, sem_ch12.adb,
sem_ch13.adb, sem_ch13.ads, sem_ch3.adb, sem_ch7.adb,
sem_util.adb: Protect calls with Known_..., use Copy_...  Remove
assumption that Uint_0 represents "unknown".
* types.ads (Nonzero_Int): New subtype.
* gcc-interface/decl.c, gcc-interface/trans.c: Protect calls
with Known_... and use Copy_...  as appropriate, to avoid
blowing up in unknown cases. Similarly, call No_Uint_To_0 to
preserve existing behavior.

3 years ago[Ada] Enforce legality rule for Predicate_Failure aspect specifications
Steve Baird [Fri, 2 Jul 2021 00:03:25 +0000 (17:03 -0700)]
[Ada] Enforce legality rule for Predicate_Failure aspect specifications

gcc/ada/

* sem_ch13.adb (Analyze_Aspect_Specifications): Add a new nested
function, Directly_Specified, and then use it in the
implementation of the required check.

3 years ago[Ada] Refactor sort procedures of doubly linked list containers
Steve Baird [Wed, 30 Jun 2021 23:42:54 +0000 (16:42 -0700)]
[Ada] Refactor sort procedures of doubly linked list containers

gcc/ada/

* libgnat/a-costso.ads, libgnat/a-costso.adb: A new library
unit, Ada.Containers.Stable_Sorting, which exports a pair of
generics (one within the other) which are instantiated by each
of the 5 doubly-linked list container generics to implement
their respective Sort procedures. We use a pair of generics,
rather than a single generic, in order to further reduce code
duplication. The outer generic takes a formal private Node_Ref
type representing a reference to a linked list element. For some
instances, the corresponding actual parameter will be an access
type; for others, it will be the index type for an array.
* Makefile.rtl: Include new Ada.Containers.Stable_Sorting unit.
* libgnat/a-cbdlli.adb, libgnat/a-cdlili.adb,
libgnat/a-cfdlli.adb, libgnat/a-cidlli.adb, libgnat/a-crdlli.adb
(Sort): Replace existing Sort implementation with a call to an
instance of
Ada.Containers.Stable_Sorting.Doubly_Linked_List_Sort. Declare
the (trivial) actual parameters needed to declare that instance.
* libgnat/a-cfdlli.ads: Fix a bug encountered during testing in
the postcondition for M_Elements_Sorted. With a partial
ordering, it is possible for all three of (X < Y), (Y < X),
and (X = Y) to be simultaneously false, so that case needs to
handled correctly.

3 years ago[Ada] Update comment for Error_Msg_Internal
Piotr Trojanek [Thu, 1 Jul 2021 13:42:56 +0000 (15:42 +0200)]
[Ada] Update comment for Error_Msg_Internal

gcc/ada/

* errout.adb (Error_Msg_Internal): Fix references to Sptr and
Optr in comment; fix grammar of "low-level" where it is used as
an adjective.

3 years ago[Ada] Simplify iteration when printing error message spans
Piotr Trojanek [Thu, 1 Jul 2021 13:40:00 +0000 (15:40 +0200)]
[Ada] Simplify iteration when printing error message spans

gcc/ada/

* errout.adb (Write_Source_Code_Lines): Use Cur_Loc before
incrementing it, so that we don't need to decrement it.

3 years ago[Ada] Exception raised on empty file in GNATprove mode
Yannick Moy [Thu, 1 Jul 2021 07:36:53 +0000 (09:36 +0200)]
[Ada] Exception raised on empty file in GNATprove mode

gcc/ada/

* errout.adb (Get_Line_End): Do not allow the result to go past
the end of the buffer.

3 years ago[Ada] Refine patch for spurious link error involving discriminated types
Ed Schonberg [Wed, 30 Jun 2021 22:11:11 +0000 (18:11 -0400)]
[Ada] Refine patch for spurious link error involving discriminated types

gcc/ada/

* sem_ch3.adb (Process_Discriminant_Expressions): If the
constraint is for a Component_Definition that appears in a
Component_Declaration, the entity to be used to create the
potentially global symbol is the Defining_Identifier of the
Component_Declaration.

3 years ago[Ada] Remove "with GNAT.OS_Lib;" from libgnat/a-stbufi.ads
Bob Duff [Wed, 30 Jun 2021 12:33:26 +0000 (08:33 -0400)]
[Ada] Remove "with GNAT.OS_Lib;" from libgnat/a-stbufi.ads

gcc/ada/

* libgnat/a-stbufi.ads, libgnat/a-stbufi.adb: Change all
occurrences of GNAT.OS_Lib to System.OS_Lib.

3 years agoEvaluate 'random ()' to '0' in 'pass_omp_oacc_neuter_broadcast'
Thomas Schwinge [Tue, 21 Sep 2021 06:54:49 +0000 (08:54 +0200)]
Evaluate 'random ()' to '0' in 'pass_omp_oacc_neuter_broadcast'

Julian Brown,
<http://mid.mail-archive.com/20210920134603.16459021@squid.athome>:

| [...] the randomness shouldn't be necessary for the
| correctness of the patch (i.e. it could just be "base = bounds_lo", or
| indeed folded into the line after).
|
| The "ar.invalid ()" case happens when we fail to allocate a block of
| memory in LDS space for broadcasting a particular set of variables,
| and trigger a fall-back path in the broadcasting code that adds extra
| barriers around the broadcast in question. I imagine I was thinking
| that adding randomness could mean we can "get lucky" sometimes and
| avoid needing those barriers in some cases, but in fact I don't think
| that was implemented, so the randomness is useless. (Or it could just
| have been leftover debug code... oops).

gcc/
PR other/102408
* omp-oacc-neuter-broadcast.cc (oacc_do_neutering): Evaluate
'random ()' to '0'.

3 years agoarm: pass architecture extensions to assembler if supported
Richard Earnshaw [Tue, 21 Sep 2021 10:14:46 +0000 (11:14 +0100)]
arm: pass architecture extensions to assembler if supported

When I originally added the new extended architecture features support
to GCC, the assembler was unable to parse the new feature lists on the
command-line and would throw an error.  This has now been fixed in GAS
and the behaviour is the same as GCC.

So this patch adds a configure-time test for the assembler in use to
detect that it is recent enough to support this behaviour and then
enables passing the architecture extensions to the assembler when this
is the case.

Although the assembly output generated by GCC does not rely on this,
this should ease some issues when using GCC as a driver for compiling
source written directly in assembly language when the programmer was
expecting the appropriate options to be passed on the command line.

gcc/ChangeLog:

* configure.ac: Detect when the assembler supports new-style
architecture extensions.
* common/config/arm/arm-common.c (arm_rewrite_mcpu): Return
the full CPU string if the assembler can grok it.
(arm_rewrite_march): Likewise but for the architecture.
* config.in: Regenerate.
* configure: Regenerate.

3 years agotree-optimization/102421 - copy alignment info when splitting groups
Richard Biener [Tue, 21 Sep 2021 07:39:12 +0000 (09:39 +0200)]
tree-optimization/102421 - copy alignment info when splitting groups

This makes sure to copy and adjust alignment info when we are splitting
DR groups after alignment analysis.

2021-09-21  Richard Biener  <rguenther@suse.de>

PR tree-optimization/102421
* tree-vect-loop.c (vect_dissolve_slp_only_groups): Copy and
adjust alignment info.

* g++.dg/vect/pr102421.cc: New testcase.

3 years agoFix no_fsanitize_address effective target
Eric Botcazou [Tue, 21 Sep 2021 07:25:47 +0000 (09:25 +0200)]
Fix no_fsanitize_address effective target

The implementation of the no_fsanitize_address effective target was copied
from asan-dg.exp without realizing that it does not work outside of this
context (there is a comment explaining why).  As a consequence, it always
returns 0, so for example the directive in gnat.dg/asan1.adb:

{ dg-skip-if "no address sanitizer" { no_fsanitize_address } }

does not work.  This led some people to add the nonsensical:

{ dg-require-effective-target no_fsanitize_address }

to sanitizer tests, e.g. g++.dg/warn/uninit-pr93100.C, thus disabling them
everywhere instead of just for the problematic targets.

gcc/testsuite/
* lib/target-supports.exp (no_fsanitize_address): Add missing bits.
* gcc.dg/uninit-pr93100.c: Skip if no_fsanitize_address.
* gcc.dg/pr91441.c: Likewise.
* gcc.dg/pr96260.c: Likewise.
* gcc.dg/pr96307.c: Likewise.
* g++.dg/warn/uninit-pr93100.C: Likewise.
* gnat.dg/asan1.adb: Likewise.

* gcc.dg/Wstringop-overflow-70.c: Adjust for SPARC.
* g++.dg/abi/anon4.C: Likewise.

3 years agoFortran: Fix -Wno-missing-include-dirs handling [PR55534]
Tobias Burnus [Tue, 21 Sep 2021 06:27:00 +0000 (08:27 +0200)]
Fortran: Fix -Wno-missing-include-dirs handling [PR55534]

gcc/fortran/ChangeLog:

PR fortran/55534
* cpp.c: Define GCC_C_COMMON_C for #include "options.h" to make
cpp_reason_option_codes available.
(gfc_cpp_register_include_paths): Make static, set pfile's
warn_missing_include_dirs and move before caller.
(gfc_cpp_init_cb): New, cb code moved from ...
(gfc_cpp_init_0): ... here.
(gfc_cpp_post_options): Call gfc_cpp_init_cb.
(cb_cpp_diagnostic_cpp_option): New. As implemented in c-family
to match CppReason flags to -W... names.
(cb_cpp_diagnostic): Use it to replace single special case.
* cpp.h (gfc_cpp_register_include_paths): Remove as now static.
* gfortran.h (gfc_check_include_dirs): New prototype.
(gfc_add_include_path): Add new bool arg.
* options.c (gfc_init_options): Don't set -Wmissing-include-dirs.
(gfc_post_options): Set it here after commandline processing. Call
gfc_add_include_path with defer_warn=false.
(gfc_handle_option): Call it with defer_warn=true.
* scanner.c (gfc_do_check_include_dir, gfc_do_check_include_dirs,
gfc_check_include_dirs): New. Diagnostic moved from ...
(add_path_to_list): ... here, which came before cmdline processing.
Take additional bool defer_warn argument.
(gfc_add_include_path): Take additional defer_warn arg.
* scanner.h (struct gfc_directorylist): Reorder for alignment issues,
add new 'bool warn'.

libgfortran/ChangeLog:
PR fortran/55534
* configure.ac (AM_FCFLAGS): Add -Wno-missing-include-dirs.
* configure: Regenerate.

libgomp/ChangeLog:
PR fortran/55534
* testsuite/libgomp.fortran/fortran.exp: Add -Wno-missing-include-dirs
to ALWAYS_CFLAGS.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.

gcc/testsuite/ChangeLog:
* gfortran.dg/include_6.f90: Change dg-error to
dg-warning and update pattern.
* gfortran.dg/include_14.f90: New test.
* gfortran.dg/include_15.f90: New test.
* gfortran.dg/include_16.f90: New test.
* gfortran.dg/include_17.f90: New test.
* gfortran.dg/include_18.f90: New test.
* gfortran.dg/include_19.f90: New test.
* gfortran.dg/include_20.f90: New test.
* gfortran.dg/include_21.f90: New test.

3 years agoipa-fnsummary: Remove inconsistent bp_pack_value
Kewen Lin [Tue, 21 Sep 2021 02:00:04 +0000 (21:00 -0500)]
ipa-fnsummary: Remove inconsistent bp_pack_value

There is one inconsistent bit-field streaming out and in.
On the side of streaming in:

    bp_pack_value (&bp, info->inlinable, 1);
    bp_pack_value (&bp, false, 1);
    bp_pack_value (&bp, info->fp_expressions, 1);

while on the side of the streaming out:

    info->inlinable = bp_unpack_value (&bp, 1);
    info->fp_expressions = bp_unpack_value (&bp, 1)

The removal of Cilk Plus support r8-4956 missed to remove
the streaming out of the bit, instead just change the value
for streaming out to be always false.

By hacking fp_expression_p to always return true, I can see
it reads the wrong fp_expressions value (false) out in wpa.

gcc/ChangeLog:

* ipa-fnsummary.c (ipa_fn_summary_write): Remove inconsistent
bitfield stream out.

3 years agoC++: add type checking for static local vector variable in template
wangpc [Sat, 18 Sep 2021 05:53:09 +0000 (13:53 +0800)]
C++: add type checking for static local vector variable in template

This patch moves verify_type_context from start_decl_1 to cp_finish_decl to
do more type checking such as static local vector variable in C++ template.

2021-08-06  wangpc  <pc.wang@linux.alibaba.com>

gcc/cp/ChangeLog

* decl.c (start_decl_1): Move verify_type_context to ...
(cp_finish_decl): ... to here.

gcc/testsuite/ChangeLog

* g++.target/aarch64/sve/static-var-in-template.C: New test.

3 years agoDaily bump.
GCC Administrator [Tue, 21 Sep 2021 00:16:31 +0000 (00:16 +0000)]
Daily bump.

3 years agoUse EDGE_EXECUTABLE in ranger and return UNDEFINED for those edges.
Andrew MacLeod [Tue, 24 Aug 2021 16:13:24 +0000 (12:13 -0400)]
Use EDGE_EXECUTABLE in ranger and return UNDEFINED for those edges.

If an incoming edge is UNDEFINED, don't process it.  Track if other edges
equate to a single value, and add an equivalence if appropriate.

gcc/
* gimple-range-fold.cc (fold_using_range::range_of_phi): Ignore
undefined edges, apply an equivalence if appropriate.
* gimple-range-gori.cc (gori_compute::outgoing_edge_range_p): Return
UNDEFINED if EDGE_EXECUTABLE is not set.
* gimple-range.cc (gimple_ranger::gimple_ranger): Set all edges
as EXECUTABLE upon startup.
(gimple_ranger::range_on_edge): Return UNDEFINED for edges without
EDGE_EXECUTABLE set.
* vr-values.c (set_and_propagate_unexecutable): New.
(simplify_using_ranges::fold_cond): Call set_and_propagate.
(simplify_using_ranges::simplify_switch_using_ranges): Ditto.
* vr-values.h: Add prototype.

gcc/testsuite/
* gcc.dg/tree-ssa/evrp-ignore.c: New.

3 years agoMake each def a new equivalency record.
Andrew MacLeod [Fri, 17 Sep 2021 18:58:06 +0000 (14:58 -0400)]
Make each def a new equivalency record.

Create a new equivalency set at each def point killing any equivalencies
coming into the block from back edges.  Do not add equivalences for PHI
arguments defined in this block.

* value-relation.cc (equiv_oracle::register_initial_def): New.
(equiv_oracle::register_relation): Call register_initial_def.
(equiv_oracle::add_equiv_to_block): New.  Split register_relation.
(relation_oracle::register_stmt): Check def block of PHI arguments.
* value-relation.h (equiv_oracle): Add new prototypes.

3 years agoMAINTAINERS: add myself as Fortran reviewer
Harald Anlauf [Mon, 20 Sep 2021 20:16:18 +0000 (22:16 +0200)]
MAINTAINERS: add myself as Fortran reviewer

ChangeLog:

* MAINTAINERS (Reviewers): Add myself as Fortran reviewer.

3 years agoc-family: Add more predefined macros for math flags
Matthias Kretz [Wed, 30 Jun 2021 08:41:33 +0000 (10:41 +0200)]
c-family: Add more predefined macros for math flags

Library code, especially in headers, sometimes needs to know how the
compiler interprets / optimizes floating-point types and operations.
This information can be used for additional optimizations or for
ensuring correctness. This change makes -freciprocal-math,
-fno-signed-zeros, -fno-trapping-math, -fassociative-math, and
-frounding-math report their state via corresponding pre-defined macros.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
gcc/testsuite/ChangeLog:

* gcc.dg/associative-math-1.c: New test.
* gcc.dg/associative-math-2.c: New test.
* gcc.dg/no-signed-zeros-1.c: New test.
* gcc.dg/no-signed-zeros-2.c: New test.
* gcc.dg/no-trapping-math-1.c: New test.
* gcc.dg/no-trapping-math-2.c: New test.
* gcc.dg/reciprocal-math-1.c: New test.
* gcc.dg/reciprocal-math-2.c: New test.
* gcc.dg/rounding-math-1.c: New test.
* gcc.dg/rounding-math-2.c: New test.

gcc/c-family/ChangeLog:

* c-cppbuiltin.c (c_cpp_builtins_optimize_pragma): Define or
undefine __RECIPROCAL_MATH__, __NO_SIGNED_ZEROS__,
__NO_TRAPPING_MATH__, __ASSOCIATIVE_MATH__, and
__ROUNDING_MATH__ according to the new optimization flags.

gcc/ChangeLog:

* cppbuiltin.c (define_builtin_macros_for_compilation_flags):
Define __RECIPROCAL_MATH__, __NO_SIGNED_ZEROS__,
__NO_TRAPPING_MATH__, __ASSOCIATIVE_MATH__, and
__ROUNDING_MATH__ according to their corresponding flags.
* doc/cpp.texi: Document __RECIPROCAL_MATH__,
__NO_SIGNED_ZEROS__, __NO_TRAPPING_MATH__, __ASSOCIATIVE_MATH__,
and __ROUNDING_MATH__.

3 years ago[Ada] Remove redundant checks for non-empty list of aspects
Piotr Trojanek [Mon, 28 Jun 2021 20:34:10 +0000 (22:34 +0200)]
[Ada] Remove redundant checks for non-empty list of aspects

gcc/ada/

* inline.adb (Has_Excluded_Declaration): Remove redundant guard;
the guarded code will call First on a No_List, which is
well-defined and gives Empty.

3 years ago[Ada] Fix shadowing in conditions for inlining
Piotr Trojanek [Mon, 28 Jun 2021 20:30:40 +0000 (22:30 +0200)]
[Ada] Fix shadowing in conditions for inlining

gcc/ada/

* inline.adb (Has_Excluded_Declaration): Rename and reduce scope
of a local variable.

3 years ago[Ada] Present and No functions for type Uint
Bob Duff [Tue, 29 Jun 2021 00:02:20 +0000 (20:02 -0400)]
[Ada] Present and No functions for type Uint

gcc/ada/

* uintp.ads, uintp.adb (Present, No): New functions for
comparing with No_Uint.
* checks.adb, einfo-utils.adb, exp_aggr.adb, exp_attr.adb,
exp_ch3.adb, exp_ch4.adb, exp_dbug.adb, exp_disp.adb,
exp_util.adb, repinfo.adb, repinfo-input.adb, scn.adb,
sem_attr.adb, sem_ch13.adb, sem_eval.adb, sem_util.adb,
sinfo-utils.adb, treepr.adb: Use Present (...) instead of "...
/= No_Uint", and No (...) instead of "... = No_Uint".

3 years ago[Ada] Add SPARK_Mode => Off to System.File_Control_Block
Claire Dross [Tue, 29 Jun 2021 08:38:31 +0000 (10:38 +0200)]
[Ada] Add SPARK_Mode => Off to System.File_Control_Block

gcc/ada/

* libgnat/s-ficobl.ads: The entire package has a SPARK_Mode =>
Off aspect.

3 years ago[Ada] Use OS_Time for interface to TZ functions.
Doug Rupp [Tue, 22 Jun 2021 15:31:50 +0000 (08:31 -0700)]
[Ada] Use OS_Time for interface to TZ functions.

gcc/ada/

* libgnat/a-calend.adb: Remove time_t, replace with OS_Time.
* libgnat/s-os_lib.ads: Fix comments regarding time_t conversion
functions to reflect the use of To_Ada in in Ada.Calendar
package body.
* sysdep.c (__gnat_localtime_tzoff): Use OS_Time instead of
time_t.

3 years ago[Ada] Accept volatile expressions as non-scalar actual parameters
Piotr Trojanek [Mon, 28 Jun 2021 12:20:34 +0000 (14:20 +0200)]
[Ada] Accept volatile expressions as non-scalar actual parameters

gcc/ada/

* sem_res.adb (Resolve_Actual): Remove

3 years ago[Ada] Clean up Uint fields, remove unused routines
Bob Duff [Sun, 27 Jun 2021 15:03:20 +0000 (11:03 -0400)]
[Ada] Clean up Uint fields, remove unused routines

gcc/ada/

* einfo-utils.ads, einfo-utils.adb, fe.h, einfo.ads,
gen_il-fields.ads: Remove unused and no-longer-used routines.
Move related routines together.  Rewrite incorrect
documentation, and documentation that will be incorrect when
e.g. Esize-related routines are fixed.  Remove unused field
Normalized_Position_Max.
* cstand.adb, exp_pakd.adb, freeze.adb,
gen_il-gen-gen_entities.adb, itypes.adb, layout.adb,
sem_ch10.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb,
sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_prag.adb,
sem_util.adb, ttypes.ads: Update calls to routines removed from
or renamed in Einfo.Utils.
* uintp.ads (Upos): Fix this subtype, which was unintentionally
declared to include Uint_0.

3 years ago[Ada] Cleanups related to building of dispatch tables
Piotr Trojanek [Fri, 25 Jun 2021 14:10:30 +0000 (16:10 +0200)]
[Ada] Cleanups related to building of dispatch tables

gcc/ada/

* exp_ch7.adb (Expand_N_Package_Declaration): Fix wording in
comment.
* exp_disp.adb (Mark_DT): Remove unnecessary initialization of
I_Depth.

3 years ago[Ada] Accept volatile properties on constant objects
Piotr Trojanek [Mon, 21 Jun 2021 10:08:29 +0000 (12:08 +0200)]
[Ada] Accept volatile properties on constant objects

gcc/ada/

* contracts.adb (Add_Contract_Item): Accept volatile-related
properties on constants.
(Analyze_Object_Contract): Check external properties on
constants; accept volatile constants.
(Check_Type_Or_Object_External_Properties): Replace "variable"
with "object" in error messages; replace Decl_Kind with a local
constant.
* sem_prag.adb (Analyze_Pragma): Accept volatile-related
properties on constants.

3 years ago[Ada] SPARK proof of the Ada.Strings.Fixed library
Pierre-Alexandre Bazin [Fri, 18 Jun 2021 10:09:48 +0000 (12:09 +0200)]
[Ada] SPARK proof of the Ada.Strings.Fixed library

gcc/ada/

* libgnat/a-strfix.adb ("*"): Added loop invariants and lemmas
for proof.
(Delete): Added assertions for proof, and conditions to avoid
overflow.
(Head): Added loop invariant.
(Insert): Same as Delete.
(Move): Declared with SPARK_Mode Off.
(Overwrite): Added assertions for proof, and conditions to avoid
overflow.
(Replace_Slice): Added assertions for proof, and conditions to
avoid overflow.
(Tail): Added loop invariant and avoided overflows.
(Translate): Added loop invariants.
(Trim): Ensured empty strings returned start at 1.
* libgnat/a-strfix.ads (Index): Rewrote contract cases for
easier proof.
(Index_Non_Blank): Separated the null string case.
(Count): Specified Mapping shouldn't be null.
(Find_Token): Specified Source'First should be Positive when no
From is given.
(Translate): Specified Mapping shouldn't be null.
("*"): Rewrote postcondition for easier proof.
* libgnat/a-strsea.adb (Belongs): Added postcondition.
(Count): Rewrote loops and added loop invariants to avoid
overflows.
(Find_Token): Added loop invariants.
(Index): Rewrote loops to avoid overflows and added loop
invariants for proof.
(Index_Non_Blank): Added loop invariants.
(Is_Identity): New function isolated without SPARK_Mode.
* libgnat/a-strsea.ads: Fix starting comment as package is no
longer private.
(Match): Declared ghost expression function Match.
(Is_Identity): Described identity in the postcondition.
(Index, Index_Non_Blank, Count, Find_Token): Added contract from
a-strfix.ads.

3 years ago[Ada] Minor style fixes in Resolve_Aspect_Aggregate
Piotr Trojanek [Fri, 27 Nov 2020 14:36:36 +0000 (15:36 +0100)]
[Ada] Minor style fixes in Resolve_Aspect_Aggregate

gcc/ada/

* sem_ch13.adb (Resolve_Aspect_Aggregate): Move comments after
specs; fix typo in header box; cleanup whitespace.

3 years ago[Ada] Adjust latest change for ELF platforms
Eric Botcazou [Sat, 26 Jun 2021 18:50:58 +0000 (20:50 +0200)]
[Ada] Adjust latest change for ELF platforms

gcc/ada/

* libgnat/s-objrea.adb (Get_Load_Address): Return 0 for ELF.

3 years ago[Ada] Add support for PE-COFF PIE to System.Dwarf_Line
Eric Botcazou [Thu, 24 Jun 2021 10:19:36 +0000 (12:19 +0200)]
[Ada] Add support for PE-COFF PIE to System.Dwarf_Line

gcc/ada/

* adaint.c (__gnat_get_executable_load_address): Add Win32 support.
* libgnat/s-objrea.ads (Get_Xcode_Bounds): Fix typo in comment.
(Object_File): Minor reformatting.
(ELF_Object_File): Uncomment predicate.
(PECOFF_Object_File): Likewise.
(XCOFF32_Object_File): Likewise.
* libgnat/s-objrea.adb: Minor reformatting throughout.
(Get_Load_Address): Implement for PE-COFF.
* libgnat/s-dwalin.ads: Remove clause for System.Storage_Elements
and use consistent wording in comments.
(Dwarf_Context): Set type of Low, High and Load_Address to Address.
* libgnat/s-dwalin.adb (Get_Load_Displacement): New function.
(Is_Inside): Call Get_Load_Displacement.
(Low_Address): Likewise.
(Open): Adjust to type change.
(Aranges_Lookup): Change type of Addr to Address.
(Read_Aranges_Entry): Likewise for Start and adjust.
(Enable_Cach): Adjust to type change.
(Symbolic_Address): Change type of Addr to Address.
(Symbolic_Traceback): Call Get_Load_Displacement.

3 years ago[Ada] Fix repeated generation of dispatch tables in CodePeer mode
Piotr Trojanek [Fri, 25 Jun 2021 10:45:57 +0000 (12:45 +0200)]
[Ada] Fix repeated generation of dispatch tables in CodePeer mode

gcc/ada/

* exp_disp.adb (Make_DT): Move call to Set_Has_Dispatch_Table,
so it is executed regardless of the Generate_SCIL mode.