188354 Commits

Author SHA1 Message Date
Piotr Trojanek
37a3df0d9a [Ada] Remove global parameter in Global contracts of Ada.Strings.Bounded
gcc/ada/

	* libgnat/a-strbou.ads (Generic_Bounded_Length): Remove non-null
	Global contracts.
2021-09-23 13:06:13 +00:00
Steve Baird
62e66ee5bf [Ada] Update "Implementation Defined Characteristics" documentation.
gcc/ada/

	* doc/gnat_rm/implementation_defined_characteristics.rst: Update
	this section to reflect the current version of Ada RM M.2.
	* gnat_rm.texi: Regenerate.
2021-09-23 13:06:13 +00:00
Bill Schmidt
16e3d6b8b2 rs6000: Add psabi diagnostic for C++ zero-width bit field ABI change
Previously zero-width bit fields were removed from structs, so that otherwise
homogeneous aggregates were treated as such and	passed in FPRs and VSRs.
This was incorrect behavior per	the ELFv2 ABI.	Now that these fields are no
longer being removed, we generate the correct parameter	passing	code.  Alert
the unwary user	in the rare cases where	this behavior changes.

2021-09-23  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	PR target/102024
	* config/rs6000/rs6000-call.c (rs6000_aggregate_candidate): Detect
	zero-width bit fields and return indicator.
	(rs6000_discover_homogeneous_aggregate): Diagnose when the
	presence of a zero-width bit field changes parameter passing in
	GCC 12.

gcc/testsuite/
	PR target/102024
	* g++.target/powerpc/pr102024.C: New.
2021-09-23 07:40:34 -05:00
Aldy Hernandez
0044691620 Remove dominator check in fold_using_range::range_of_phi.
Revert the following patch, as it was an artifact of diagnostic code
being run with improper IL.

commit 64b80b8819f9ea74712625bceb0ec4388e25f67d
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Tue Sep 21 08:28:28 2021 +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.

gcc/ChangeLog:

	* gimple-range-fold.cc (fold_using_range::range_of_phi):
	Remove dominator check.
2021-09-23 13:08:27 +02:00
Aldy Hernandez
f3d357bab3 Hoist edge calculations in precompute_relations.
Tested on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range-path.cc (path_range_query::precompute_relations):
	Hoist edge calculations before using EDGE_SUCC.
2021-09-23 13:08:27 +02:00
Jonathan Wakely
d917742fe2 configure: Update --help output for --with-multilib-list
The list of architectures that support the option is incomplete.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Jim Wilson <jimw@sifive.com>

gcc/ChangeLog:

	* configure.ac: Fix --with-multilib-list description.
	* configure: Regenerate.
2021-09-23 11:30:27 +01:00
Richard Biener
c0cc62b32d tree-optimization/102448 - clear copied alignment info from vect
This fixes the previous change which removed setting alignment info
from the vectorizers idea of how a pointer is being used but left
in place the copied info from DR_PTR_INFO without realizing that this
is in fact _not_ the alignment of the access but the alignment of
a base pointer contained in it.

The following makes sure to not use that info.

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

	PR tree-optimization/102448
	* tree-vect-data-refs.c (vect_duplicate_ssa_name_ptr_info):
	Clear alignment info copied from DR_PTR_INFO.
2021-09-23 11:17:33 +02:00
Hongyu Wang
9ce500289a AVX512FP16: Enable vec_cmpmn/vcondmn expanders for HF modes.
gcc/ChangeLog:

	* config/i386/i386-expand.c (ix86_use_mask_cmp_p): Enable
	HFmode mask_cmp.
	* config/i386/sse.md (sseintvecmodelower): Add HF vector modes.
	(<avx512>_store<mode>_mask): Extend to support HF vector modes.
	(vec_cmp<mode><avx512fmaskmodelower>): Likewise.
	(vcond_mask_<mode><avx512fmaskmodelower>): Likewise.
	(vcond<mode><mode>): New expander.
	(vcond<mode><sseintvecmodelower>): Likewise.
	(vcond<sseintvecmodelower><mode>): Likewise.
	(vcondu<mode><sseintvecmodelower>): Likewise.

gcc/testsuite/ChangeLog:

	* g++.target/i386/avx512fp16-vcondmn-vec.C: New test.
	* g++.target/i386/avx512fp16-vcondmn-minmax.C: Ditto.
	* gcc.target/i386/avx512fp16-vcondmn-loop-1.c: Ditto.
	* gcc.target/i386/avx512fp16-vcondmn-loop-2.c: Ditto.
	* gcc.target/i386/avx512fp16-vec_cmpmn.c: Ditto.
2021-09-23 17:05:02 +08:00
Hongyu Wang
3829793c50 AVX512FP16: add truncmn2/extendmn2 expanders
gcc/ChangeLog:

	* config/i386/sse.md (extend<ssePHmodelower><mode>2):
	New expander.
	(extendv4hf<mode>2): Likewise.
	(extendv2hfv2df2): Likewise.
	(trunc<mode><ssePHmodelower>2): Likewise.
	(avx512fp16_vcvt<castmode>2ph_<mode>): Rename to ...
	(trunc<mode>v4hf2): ... this, and drop constraints.
	(avx512fp16_vcvtpd2ph_v2df): Rename to ...
	(truncv2dfv2hf2): ... this, and likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-trunc-extendvnhf.c: New test.
2021-09-23 17:05:02 +08:00
Hongyu Wang
25faed6f37 AVX512FP16: Add float(uns)?mn2 expander
gcc/ChangeLog:

	* config/i386/sse.md (float<floatunssuffix><mode><ssePHmodelower>2):
	New expander.
	(avx512fp16_vcvt<floatsuffix><sseintconvert>2ph_<mode>):
	Rename to ...
	(float<floatunssuffix><mode>v4hf2): ... this, and drop constraints.
	(avx512fp16_vcvt<floatsuffix>qq2ph_v2di): Rename to ...
	(float<floatunssuffix>v2div2hf2): ... this, and likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-floatvnhf.c: New test.
2021-09-23 17:05:02 +08:00
Hongyu Wang
60698a19c7 AVX512FP16: Add fix(uns)?_truncmn2 for HF scalar and vector modes
NB: 64bit/32bit vectorize for HFmode is not supported for now, will
adjust this patch when V2HF/V4HF operations supported.

gcc/ChangeLog:

	* config/i386/i386.md (fix<fixunssuffix>_trunchf<mode>2): New expander.
	(fixuns_trunchfhi2): Likewise.
	(*fixuns_trunchfsi2zext): New define_insn.
	* config/i386/sse.md (ssePHmodelower): New mode_attr.
	(fix<fixunssuffix>_trunc<ssePHmodelower><mode>2):
	New expander for same element vector fix_truncate.
	(fix<fixunssuffix>_trunc<ssePHmodelower><mode>2):
	Likewise for V4HF to V4SI/V4DI fix_truncate.
	(fix<fixunssuffix>_truncv2hfv2di2):
	Likeise for V2HF to V2DI fix_truncate.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-trunchf.c: New test.
	* gcc.target/i386/avx512fp16-truncvnhf.c: Ditto.
2021-09-23 17:05:02 +08:00
Hongyu Wang
fccd8855ed AVX512FP16: Add expander for smin/maxhf3.
gcc/ChangeLog:

	* config/i386/i386.md (<code>hf3): New expander.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-builtin-minmax-1.c: New test.
2021-09-23 17:05:02 +08:00
liuhongt
1041111f19 AVX512FP16: Add expander for fmahf4
gcc/ChangeLog:

	* config/i386/sse.md (FMAMODEM): extend to handle FP16.
	(VFH_SF_AVX512VL): Extend to handle HFmode.
	(VF_SF_AVX512VL): Deleted.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-fma-1.c: New test.
	* gcc.target/i386/avx512fp16vl-fma-1.c: New test.
	* gcc.target/i386/avx512fp16vl-fma-vectorize-1.c: New test.
2021-09-23 17:05:02 +08:00
liuhongt
cb8d916eef AVX512FP16: Add expander for rint/nearbyinthf2.
gcc/ChangeLog:

	* config/i386/i386.md (rinthf2): New expander.
	(nearbyinthf2): New expander.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-builtin-round-1.c: Add new testcase.
2021-09-23 17:05:01 +08:00
Jakub Jelinek
0d39eb28fd openmp: Diagnose omp::directive attribute without balanced token argument [PR102413]
If omp::directive attribute argument starting with the opening ( is not a balanced
token sequence, then cp_parser_skip_balanced_tokens (parser, 1) returns 1,
but the code was subtracting 2 from it and iterating until it was 0, so for the
non-balanced case it iterated from (size_t) -1 down to 0.

The following patch just diagnoses that as an error.

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

	PR c++/102413
	* parser.c (cp_parser_omp_directive_args): Diagnose if omp::directive
	is not followed by a balanced token sequence starting with open paren.

	* g++.dg/gomp/attrs-14.C: New test.
2021-09-23 10:10:58 +02:00
Aldy Hernandez
4c0c43623e Overhaul jump thread state in forward threader.
I've been pulling state from across the forward jump threader into the
jt_state class, but it it still didn't feel right.  The ultimate goal
was to keep track of candidate threading paths so that the simplifier
could simplify statements with the path as context.  This patch completes
the transition, while cleaning up a lot of things in the process.

I've revamped both state and the simplifier such that a base state class
contains only the blocks as they're registered, and any pass specific
knowledge is where it belongs... in the pass.  This allows VRP to keep
its const and copies business, and DOM to keep this as well as its evrp
client.  This makes the threader cleaner, as it will now have no knowledge
of either const/copies or evrp.

This also paves the wave for the upcoming hybrid threader, which will
just derive the state class and provide almost nothing, since the ranger
doesn't need to register any equivalences or ranges as it folds.

There is some code duplication in the simplifier, since both the DOM and
VRP clients use a vr_values based simplifier, but this is temporary as
the VRP client is about to be replaced with a hybrid ranger.

For a better view of what this patch achieves, here are the base
classes:

class jt_state
{
public:
  virtual ~jt_state () { }
  virtual void push (edge);
  virtual void pop ();
  virtual void register_equiv (tree dest, tree src, bool update_range =
false);
  virtual void register_equivs_edge (edge e);
  virtual void register_equivs_stmt (gimple *, basic_block,
				     class jt_simplifier *);
  virtual void record_ranges_from_stmt (gimple *stmt, bool temporary);
  void get_path (vec<basic_block> &);
  void append_path (basic_block);
  void dump (FILE *);
  void debug ();
private:
  auto_vec<basic_block> m_blocks;
};

class jt_simplifier
{
public:
  virtual ~jt_simplifier () { }
  virtual tree simplify (gimple *, gimple *, basic_block, jt_state *) =
0;
};

There are no functional changes.

gcc/ChangeLog:

	* tree-ssa-dom.c (class dom_jump_threader_simplifier): Rename...
	(class dom_jt_state): ...this and provide virtual overrides.
	(dom_jt_state::register_equiv): New.
	(class dom_jt_simplifier): Rename from
	dom_jump_threader_simplifier.
	(dom_jump_threader_simplifier::simplify): Rename...
	(dom_jt_simplifier::simplify): ...to this.
	(pass_dominator::execute): Use dom_jt_simplifier and
	dom_jt_state.
	* tree-ssa-threadedge.c (jump_threader::jump_threader):
	Clean-up.
	(jt_state::register_equivs_stmt): Abstract out...
	(jump_threader::record_temporary_equivalences_from_stmts_at_dest):
	...from here.
	(jump_threader::thread_around_empty_blocks): Update state.
	(jump_threader::thread_through_normal_block): Same.
	(jt_state::jt_state): Remove.
	(jt_state::push): Remove pass specific bits.  Keep block vector
	updated.
	(jt_state::append_path): New.
	(jt_state::pop): Remove pass specific bits.
	(jt_state::register_equiv): Same.
	(jt_state::record_ranges_from_stmt): Same.
	(jt_state::register_equivs_on_edge): Same.  Rename...
	(jt_state::register_equivs_edge):  ...to this.
	(jt_state::dump): New.
	(jt_state::debug): New.
	(jump_threader_simplifier::simplify): Remove.
	(jt_state::get_path): New.
	* tree-ssa-threadedge.h (class jt_simplifier): Make into a base
	class.  Expose common functionality as virtual methods.
	(class jump_threader_simplifier): Same.  Rename...
	(class jt_simplifier): ...to this.
	* tree-vrp.c (class vrp_jump_threader_simplifier): Rename...
	(class vrp_jt_simplifier): ...to this. Provide pass specific
	overrides.
	(class vrp_jt_state): New.
	(vrp_jump_threader_simplifier::simplify): Rename...
	(vrp_jt_simplifier::simplify): ...to this.  Inline code from
	what used to be the base class.
	(vrp_jump_threader::vrp_jump_threader): Use vrp_jt_state and
	vrp_jt_simplifier.
2021-09-23 08:05:48 +02:00
GCC Administrator
e4777439fc Daily bump. 2021-09-23 00:16:29 +00:00
Sandra Loosemore
5098e7077b Fortran: diagnostic for argument w/type parameters for assumed-type dummy
2021-09-22  Sandra Loosemore  <sandra@codesourcery.com>

	PR fortran/101319

gcc/fortran/
	* interface.c (gfc_compare_actual_formal): Extend existing
	assumed-type diagnostic to also check for argument with type
	parameters.

gcc/testsuite/
	* gfortran.dg/c-interop/assumed-type-dummy.f90: Remove xfail.
2021-09-22 17:11:08 -07:00
Sandra Loosemore
7a40f2e748 Fortran: Fixes for F2018 C838 (PR fortran/101334)
The compiler was failing to diagnose the error required by F2018 C838
when passing an assumed-rank array argument to a non-assumed-rank dummy.
It was also incorrectly giving an error for calls to the 2-argument form
of the ASSOCIATED intrinsic, which is supposed to be permitted by C838.

2021-09-19  Sandra Loosemore  <sandra@codesourcery.com>

	PR fortran/101334

gcc/fortran/
	* check.c (gfc_check_associated): Allow an assumed-rank
	array for the pointer argument.
	* interface.c (compare_parameter): Also give rank mismatch
	error on assumed-rank array.

gcc/testsuite/
	* gfortran.dg/c-interop/c535b-2.f90: Remove xfails.
	* gfortran.dg/c-interop/c535b-3.f90: Likewise.
2021-09-22 17:10:57 -07:00
Sandra Loosemore
8fa9e73e6d Fortran: Fix testcases that violate C838, + revealed ICE
The three test cases fixed in this patch violated F2018 C838, which
only allows passing an assumed-rank argument to an assumed-rank dummy.
Wrapping the call in "select rank" revealed a null pointer dereference
which is fixed by guarding the use of the result of
GFC_DECL_SAVED_DESCRIPTOR similar to what is already done elsewhere.

2021-09-19  Sandra Loosemore  <sandra@codesourcery.com>

gcc/fortran/
	* trans-stmt.c (trans_associate_var): Check that result of
	GFC_DECL_SAVED_DESCRIPTOR is not null before using it.

gcc/testsuite/
	* gfortran.dg/assumed_rank_18.f90 (g): Wrap call to h in
	select rank.
	* gfortran.dg/assumed_type_10.f90 (test_array): Likewise for
	call to test_lib.
	* gfortran.dg/assumed_type_11.f90 (test_array): Likewise.
2021-09-22 17:09:29 -07:00
Tobias Burnus
83aac69883 Fortran: Improve -Wmissing-include-dirs warnings [PR55534]
It turned out that enabling the -Wmissing-include-dirs for libcpp did output
too many warnings – at least as run with -B and similar options during the
GCC build and warning for internal include dirs like finclude, unlikely of
relevance to for a real-world user.
This patch now only warns for -I and -J by default but permits to get the
full warnings including libcpp ones with -Wmissing-include-dirs. It
additionally documents this in the manual.

With that change, the -Wno-missing-include-dirs could be removed
from libgfortran's configure and libgomp's testsuite always cflags.
This reverts those bits of the previous
commit r12-3722-g417ea5c02cef7f000e66d1af22b066c2c1cda047

Additionally, it turned out that all call to load_file called exit
explicitly - except for the main file via gfc_init -> gfc_new_file. The
latter also output a file not existing fatal error, such that two errors
where printed. Now exit is called in line with the other users of
load_file.

Finally, when compileing with "nonexisting/file.f90", first a warning that
"nonexisting" does not exist as include path was printed before the file
not found error was printed. Now the directory in which the physical file
is located is added silently, relying on the file-not-found diagnostic for
those.

	PR fortran/55534
gcc/ChangeLog:

	* doc/invoke.texi (-Wno-missing-include-dirs.): Document Fortran
	behavior.

gcc/fortran/ChangeLog:

	* cpp.c (gfc_cpp_register_include_paths, gfc_cpp_post_options):
	Add new bool verbose_missing_dir_warn argument.
	* cpp.h (gfc_cpp_post_options): Update prototype.
	* f95-lang.c (gfc_init): Remove duplicated file-not found diag.
	* gfortran.h (gfc_check_include_dirs): Takes bool
	verbose_missing_dir_warn arg.
	(gfc_new_file): Returns now void.
	* options.c (gfc_post_options): Update to warn for -I and -J,
	only, by default but for all when user requested.
	* scanner.c (gfc_do_check_include_dir):
	(gfc_do_check_include_dirs, gfc_check_include_dirs): Take bool
	verbose warn arg and update to avoid printing the same message
	twice or never.
	(load_file): Fix indent.
	(gfc_new_file): Return void and exit when load_file failed
	as all other load_file users do.

libgfortran/ChangeLog:

	* configure.ac (AM_FCFLAGS): Revert r12-3722 by removing
	-Wno-missing-include-dirs.
	* configure: Regenerate.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/fortran.exp (ALWAYS_CFLAGS): Revert
	r12-3722 by removing -Wno-missing-include-dirs.
	* testsuite/libgomp.oacc-fortran/fortran.exp (ALWAYS_CFLAGS): Likewise.

gcc/testsuite/ChangeLog:

	* gfortran.dg/include_14.f90: Add -J testcase and update dg-output.
	* gfortran.dg/include_15.f90: Likewise.
	* gfortran.dg/include_16.f90: Likewise.
	* gfortran.dg/include_17.f90: Likewise.
	* gfortran.dg/include_18.f90: Likewise.
	* gfortran.dg/include_19.f90: Likewise.
2021-09-22 20:58:35 +02:00
Roger Sayle
8f571e6471 More NEGATE_EXPR folding in match.pd
As observed by Jakub in comment #2 of PR 98865, the expression -(a>>63)
is optimized in GENERIC but not in GIMPLE.  Investigating further it
turns out that this is one of a few transformations performed by
fold_negate_expr in fold-const.c that aren't yet performed by match.pd.
This patch moves/duplicates them there, and should be relatively safe
as these transformations are already performed by the compiler, but
just in different passes.

This revised patch adds a Boolean simplify argument to tree-ssa-sccvn.c's
vn_nary_build_or_lookup_1 to control whether simplification should be
performed before value numbering, updating the callers, but then
avoiding simplification when constructing/value-numbering NEGATE_EXPR.
This avoids the regression of gcc.dg/tree-ssa/ssa-free-88.c, and enables
the new test case(s) to pass.

2021-09-22  Roger Sayle  <roger@nextmovesoftware.com>
	    Richard Biener  <rguenther@suse.de>

gcc/ChangeLog
	* match.pd (negation simplifications): Implement some negation
	folding transformations from fold-const.c's fold_negate_expr.
	* tree-ssa-sccvn.c (vn_nary_build_or_lookup_1): Add a SIMPLIFY
	argument, to control whether the op should be simplified prior
	to looking up/assigning a value number.
	(vn_nary_build_or_lookup): Update call to vn_nary_build_or_lookup_1.
	(vn_nary_simplify): Likewise.
	(visit_nary_op): Likewise, but when constructing a NEGATE_EXPR
	now call vn_nary_build_or_lookup_1 disabling simplification.

gcc/testsuite/ChangeLog
	* gcc.dg/fold-negate-1.c: New test case.
2021-09-22 19:17:49 +01:00
H.J. Lu
2f2dcbe471 x86: Clean up gcc.target/i386/auto-init-* tests
1. Replace ia32 with { ! lp64 } to enable ILP32 tests for -mx32.
2. Replace lp64 with { ! ia32 } to enable x86-64 ISA tests for -mx32.
3. For auto-init-3.c, add -msse and -mfpmath=387 for ia32.

	* gcc.target/i386/auto-init-2.c: Replace ia32 with { ! lp64 }.
	* gcc.target/i386/auto-init-3.c (dg-options): Add -msse.
	(dg-additional-options): Add -mfpmath=387 for ia32.
	Replace lp64 with { ! ia32 }. Add a space after ia32.
	* gcc.target/i386/auto-init-4.c: Replace lp64 with { ! ia32 }.
	* gcc.target/i386/auto-init-5.c: Likewise.
	* gcc.target/i386/auto-init-padding-3.c: Likewise.
	* gcc.target/i386/auto-init-padding-7.c: Likewise.
	* gcc.target/i386/auto-init-padding-8.c: Likewise.
	* gcc.target/i386/auto-init-padding-9.c: Likewise.
2021-09-22 10:00:02 -07:00
Patrick Palka
9329344a6d c++: concept-ids and value-dependence [PR102412]
The problem here is that uses_template_parms returns true for all
concept-ids (even those with non-dependent arguments), so when a concept-id
is used as a default template argument then during deduction the default
argument is considered dependent even after substituting into it, which
leads to deduction failure (from type_unification_real).

This patch fixes this by implementing the resolution of CWG 2446 which
says a concept-id is dependent only if its arguments are.

	DR 2446
	PR c++/102412

gcc/cp/ChangeLog:

	* constexpr.c (cxx_eval_constant_expression)
	<case TEMPLATE_ID_EXPR>: Check value_dependent_expression_p
	instead of processing_template_decl.
	* pt.c (value_dependent_expression_p) <case TEMPLATE_ID_EXPR>:
	Return true only if any_dependent_template_arguments_p.
	(instantiation_dependent_r) <case CALL_EXPR>: Remove this case.
	<case TEMPLATE_ID_EXPR>: Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-nondep2.C: New test.
	* g++.dg/cpp2a/concepts-nondep3.C: New test.
2021-09-22 11:16:53 -04:00
Yannick Moy
0988829edd [Ada] Simplify contract of Ada.Strings.Fixed.Trim for proof
gcc/ada/

	* libgnat/a-strfix.ads (Trim): Simplify contracts.
	* libgnat/a-strfix.adb (Trim): Remove white space.
2021-09-22 15:01:51 +00:00
Piotr Trojanek
dfe93fd5f5 [Ada] Reuse routines for detecting attributes Old and Result
gcc/ada/

	* exp_ch4.adb (Expand_N_Op_Eq): Reuse Is_Attribute_Result.
	* exp_prag.adb (Expand_Attributes): Reuse Is_Attribute_Old.
2021-09-22 15:01:50 +00:00
Yannick Moy
03b6cc3b3e [Ada] Spurious error on deferred constant with predicate
gcc/ada/

	* sem_ch3.adb (Analyze_Object_Declaration): Do not insert a
	predicate check after a deferred constant declaration.
2021-09-22 15:01:50 +00:00
Bob Duff
c0471c61e1 [Ada] Fix conformance errors and erroneous code
gcc/ada/

	* contracts.adb, einfo-utils.adb, einfo-utils.ads, exp_ch7.adb,
	exp_ch9.adb, exp_disp.adb, exp_prag.adb, exp_smem.adb,
	exp_util.adb, freeze.adb, sem_aggr.adb, sem_attr.adb,
	sem_ch8.adb, sem_prag.ads, sem_util.adb, sem_util.ads: Fix
	conformance errors.
	* errout.adb, erroutc.adb: Remove pragmas Suppress.
	* err_vars.ads: Initialize variables that were previously being
	read uninitialized.
2021-09-22 15:01:50 +00:00
Yannick Moy
490a987e05 [Ada] Clarify parts of Ada.Strings.Unbounded in SPARK or not
gcc/ada/

	* libgnat/a-strunb.ads: Mark package in SPARK with private part
	not in SPARK.
	(Free): Mark not in SPARK.
2021-09-22 15:01:49 +00:00
Arnaud Charlet
9560e8430d [Ada] Update status of some attributes
gcc/ada/

	* snames.ads-tmpl: Update status of some attributes.
2021-09-22 15:01:49 +00:00
Doug Rupp
ab621f4ada [Ada] VxWorks inconsistent use of return type (STATUS)
gcc/ada/

	* libgnarl/s-interr__vxworks.adb (Interfaces.C): Remove as
	unused.
	(System.VxWorks.Ext): Import.
	(System.VxWorks.Ext.STATUS): use type.
	(STATUS): New subtype.
	(OK): New constant.
	(Interrupt_Connector): Return STATUS type vice int.
	(Interrupt_Connect, Notify_Interrupt, Unbind_Handler,
	Interrupt_Server_Task): Rename Status to Result. Assert Result =
	OK.
	* libgnarl/s-osinte__vxworks.adb (To_Clock_Ticks): Define constant
	IERR, and return it vice ERROR.
	(Binary_Semaphore_Delete): Return STATUS type vice int.
	(Binary_Semaphore_Obtain): Likewise.
	(Binary_Semaphore_Release): Likewise.
	(Binary_Semaphore_Flush): Likewise.
	* libgnarl/s-osinte__vxworks.ads (SVE): Renaming of
	System.VxWorks.Ext.
	(STATUS): Use SVE in declaration of subtype.
	(BOOL): Likewise.
	(vx_freq_t): Likewise.
	(t_id): Likewise.
	(gitpid): Use SVE in renaming of subprogram
	(Task_Stop): Likewise.
	(Task_Cont): Likewise.
	(Int_Lock): Likewise.
	(Int_Unlock): Likewise.
	(Set_Time_Slice): Likewise.
	(semDelete): Likewise.
	(taskCpuAffinitySet): Likewise.
	(taskMaskAffinitySet): Likewise.
	(sigset_t): Use SVE in declaration of type.
	(OK): Remove as unused.
	(ERROR): Likewise.
	(taskOptionsGet): return STATUS vice int.
	(taskSuspend): Likewise.
	(taskResume): Likewise.
	(taskDelay): Likewise.
	(taskVarAdd): Likewise.
	(taskVarDelete): Likewise.
	(taskVarSet): Likewise.
	(tlkKeyCreate): Likewise.
	(taskPrioritySet): Likewise.
	(semGive): Likewise.
	(semTake): Likewise.
	(Binary_Semaphore_Delete): Likewise.
	(Binary_Semaphore_Obtain): Likewise.
	(Binary_Semaphore_Release): Likewise.
	(Binary_Semaphore_Flush): Likewise.
	(Interrupt_Connect): Likewise.
	* libgnarl/s-taprop__vxworks.adb
	(System.VxWorks.Ext.STATUS): use type.
	(int): Syntactically align subtype.
	(STATUS): New subtype.
	(OK): New constant.
	(Finalize_Lock): Check STATUS vice int. Assert OK.
	(Finalize_Lock): Likewise.
	(Write_Lock): Likewise.
	(Write_Lock): Likewise.
	(Write_Lock): Likewise.
	(Unlock): Likewise.
	(Unlock): Likewise.
	(Unlock): Likewise.
	(Unlock): Likewise.
	(Sleep): Likewise.
	(Sleep): Likewise.
	(Sleep): Likewise.
	(Timed_Sleep): Likewise and test Result.
	(Timed_Delay): Likewise and test Result.
	(Wakeup): Likewise.
	(Yield): Likewise.
	(Finalize_TCB): Likewise.
	(Suspend_Until_True): Check OK.
	(Stop_All_Tasks): Declare Dummy STATUS vice in.  Check OK.
	(Is_Task_Context): Use OSI renaming.
	(Initialize): Use STATUS vice int.
	* libgnarl/s-vxwext.adb
	(IERR): Renamed from ERROR.
	(taskCpuAffinitySet): Return IERR (int).
	(taskMaskAffinitySet): Likewise.
	* libgnarl/s-vxwext.ads
	(STATUS): New subtype.
	(OK): New STATUS constant.
	(ERROR): Likewise.
	* libgnarl/s-vxwext__kernel-smp.adb
	(IERR): Renamed from ERROR.
	(Int_Lock): Return IERR.
	(semDelete): Return STATUS.
	(Task_Cont): Likewise.
	(Task_Stop): Likewise.
	* libgnarl/s-vxwext__kernel.adb
	(IERR): Renamed from ERROR.
	(semDelete): Return STATUS.
	(Task_Cont): Likewise.
	(Task_Stop): Likewise.
	(taskCpuAffinitySet): Return IERR (int)
	(taskMaskAffinitySet): Likewise.
	* libgnarl/s-vxwext__kernel.ads
	(STATUS): New subtype.
	(OK): New STATUS constant.
	(ERROR): Likewise.
	(Interrupt_Connect): Return STATUS
	(semDelete): Likewise.
	(Task_Cont): Likewise.
	(Task_Stop): Likewise.
	(Set_Time_Slice): Likewise.
	* libgnarl/s-vxwext__rtp-smp.adb
	(IERR): Renamed from ERROR.
	(Int_Lock): return IERR constant vice ERROR.
	(Interrupt_Connect): Return STATUS.
	(semDelete): Likewise.
	(Set_Time_Slice): Likewise.
	* libgnarl/s-vxwext__rtp.adb
	(IERR): Renamed from ERROR.
	(Int_Lock): return IERR constant vice ERROR.
	(Int_Unlock): Return STATUS.
	(semDelete): Likewise.
	(Set_Time_Slice): Likewise.
	(taskCpuAffinitySet): Return IERR (int)
	(taskMaskAffinitySet): Likewise.
	* libgnarl/s-vxwext__rtp.ads
	(STATUS): New subtype.
	(OK): New STATUS constant.
	(ERROR): Likewise.
	(Interrupt_Connect): Return STATUS
	(semDelete): Likewise.
	(Task_Cont): Likewise.
	(Task_Stop): Likewise.
	(Set_Time_Slice): Likewise.
2021-09-22 15:01:48 +00:00
Arnaud Charlet
3d2226f173 [Ada] More flexibility in preprocessor
gcc/ada/

	* prep.adb (Preprocess): Allow for more flexibility when
	Relaxed_RM_Semantics is set.
2021-09-22 15:01:48 +00:00
Pierre-Alexandre Bazin
1647bc2a78 [Ada] Contracts written for the Ada.Strings.Bounded library
gcc/ada/

	* libgnat/a-strbou.adb: Turn SPARK_Mode on.
	* libgnat/a-strbou.ads: Write contracts.
	* libgnat/a-strfix.ads (Index): Fix grammar error in a comment.
	* libgnat/a-strsea.ads (Index): Likewise.
	* libgnat/a-strsup.adb: Rewrite the body to take into account
	the new definition of Super_String using Relaxed_Initialization
	and a predicate.
	(Super_Replicate, Super_Translate, Times): Added loop
	invariants, and ghost lemmas for Super_Replicate and Times.
	(Super_Trim): Rewrite the body using search functions to
	determine the cutting points.
	(Super_Element, Super_Length, Super_Slice, Super_To_String):
	Remove (now written as expression functions in a-strsup.ads).
	* libgnat/a-strsup.ads: Added contracts.
	(Super_Element, Super_Length, Super_Slice, Super_To_String):
	Rewrite as expression functions.
2021-09-22 15:01:48 +00:00
Yannick Moy
5f325f5e6f [Ada] Add adequate guard before calling First_Rep_Item
gcc/ada/

	* sem_ch13.adb (Build_Predicate_Functions): Add guard.
2021-09-22 15:01:47 +00:00
Doug Rupp
27534649ab [Ada] VxWorks inconsistent use of return type (BOOL)
gcc/ada/

	* libgnarl/s-vxwext.ads (BOOL): New int type.
	(Interrupt_Context): Change return type to BOOL.
	* 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-osinte__vxworks.adb (Interrupt_Context): Change
	return type to BOOL.
	* libgnarl/s-osinte__vxworks.ads (BOOL) New subtype.
	(taskIsSuspended): Change return type to BOOL.
	(Interrupt_Context): Change return type to BOOL. Adjust comments
	accordingly.
	* libgnarl/s-taprop__vxworks.adb (System.VxWorks.Ext.BOOL):
	use type.
	(Is_Task_Context): Test Interrupt_Context against 0.
	* libgnat/i-vxwork.ads (BOOL): New int.
	(intContext): Change return type to BOOL. Adjust comments.
	* libgnat/i-vxwork__x86.ads: Likewise.
2021-09-22 15:01:47 +00:00
Piotr Trojanek
920e43ee21 [Ada] Add Package_Body helper routine to be used in GNATprove
gcc/ada/

	* sem_aux.adb, sem_aux.ads (Package_Body): Moved from GNATprove.
	* sem_elab.adb (Spec_And_Body_From_Entity): Refine type of parameter.
2021-09-22 15:01:47 +00:00
Arnaud Charlet
f4f6c18d9f [Ada] Minor doc improvement
gcc/ada/

	* doc/gnat_ugn/platform_specific_information.rst: Improve doc
	on permission and containers.
	* gnat_ugn.texi: Regenerate.
2021-09-22 15:01:46 +00:00
Yannick Moy
8c61547d80 [Ada] Fix infinite loop in compilation of illegal code
gcc/ada/

	* atree.adb (Rewrite): Fix parent node of shared aspects.
	* atree.ads (Rewrite): Add ??? comment on incorrect
	documentation.
	* einfo-utils.adb (Known_Esize): Fix logic.
	* sem_ch13.adb (Alignment_Check_For_Size_Change,
	Analyze_Attribute_Definition_Clause): Protect against unset
	Size.
2021-09-22 15:01:46 +00:00
Yannick Moy
0b7ddfb9f1 [Ada] More precise analysis of function renamings in GNATprove
gcc/ada/

	* freeze.adb (Build_Renamed_Body): Special case for GNATprove.
	* sem_ch6.adb (Analyze_Expression_Function): Remove useless test
	for a node to come from source, which becomes harmful otherwise.
2021-09-22 15:01:46 +00:00
Justin Squirek
4b54d9393e [Ada] Removal of technical debt
gcc/ada/

	* ali.adb, ali.ads (Scan_ALI): Remove use of deprecated
	parameter Ignore_ED, and all specification for Lower in call to
	Get_File_Name.
	* ali-util.adb (Read_Withed_ALIs): Modify call to Scan_ALI.
	* clean.adb (Clean_Executables): Likewise.
	* gnatbind.adb (Add_Artificial_ALI_File, Executable section):
	Likewise.
	* gnatlink.adb (Executable section): Likewise.
	* gnatls.adb (Executable section): Likewise.
	* make.adb (Check, Wait_For_Available_Slot): Likewise.
	* aspects.ads: Add Aspect_No_Controlled_Parts to
	Nonoverridable_Aspect_Id
	* opt.ads: Remove function pointers used as a workaround for
	ASIS.
	* osint-c.adb (Executable section): Remove setting of function
	pointer workarounds needed for ASIS.
	* osint.adb (Read_Default_Search_Dirs): Correct behavior to
	detect EOL characters.
	* par_sco.adb (Output_Header): Remove comment regarding use of
	First_Sloc.
	(Traverse_Sync_Definition): Renamed to
	Traverse_Protected_Or_Task_Definition.
	* pprint.adb (Interal_List_Name): Add description about purpose,
	and refactor conditional statement.
	(Prepend): Removed.
	* repinfo.adb (List_Rep_Info, Write_Info_Line): Remove use of
	subprogram pointer.
	* scng.adb (Scan): Remove CODEFIX question, and minor comment
	change.
	* sem_attr.adb (Analyze_Image_Attribute): Remove special
	processing for 'Img.
	* sem_ch6.adb (Check_Untagged_Equality): Add RM reference.
	(FCE): Add comment describing behavior.
	(Is_Non_Overriding_Operation): Minor comment formatting change.
	* sem_type.adb (Is_Actual_Subprogram): Add comment about
	Comes_From_Source test.
	(Matching_Types): Describe non-matching cases.
	* sem_util.adb (Is_Confirming): Add stub case for
	No_Controlled_Parts.
2021-09-22 15:01:45 +00:00
Yannick Moy
cbf1ffe125 [Ada] Fix access to predicated parent in Itype
gcc/ada/

	* sem_ch13.adb (Build_Predicate_Functions): Access
	Predicated_Parent only on subtypes.
2021-09-22 15:01:45 +00:00
Arnaud Charlet
326b74705c [Ada] Allow more cases of import with Relaxed_RM_Semantics
gcc/ada/

	* sem_prag.adb (Process_Import_Or_Interface): Relax error when
	Relaxed_RM_Semantics.
2021-09-22 15:01:44 +00:00
Steve Baird
e41e989b42 [Ada] Improve performance for case-insensitive regular expressions
gcc/ada/

	* libgnat/s-regpat.adb (Match): Handle the case where Self.First
	is not NUL (so we know the first character we are looking for),
	but case-insensitive matching has
	been specified.
	(Optimize): In the case of an EXACTF Op, set Self.First as is
	done in the EXACT case, except with the addition of a call to
	Lower_Case.
2021-09-22 15:01:44 +00:00
Eric Botcazou
7e7c4aeb6e [Ada] Remove System.Img_Enum_New unit
gcc/ada/

	* libgnat/s-imenne.ads, libgnat/s-imenne.adb: Delete.
	* gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Remove s-imenne.o.
	(GNATBIND_OBJS): Likewise.
2021-09-22 15:01:44 +00:00
Yannick Moy
81a0f4a391 [Ada] Fix obsolete comments/name referring to girder discriminants
gcc/ada/

	* einfo.ads: Fix comments.
	* exp_aggr.adb: Fix variable name.
	* exp_util.adb: Fix comments.
	* sem_ch13.adb: Fix comments.
	* sem_ch3.adb: Fix comments and variable name.
2021-09-22 15:01:43 +00:00
Doug Rupp
064056d7b5 [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.
2021-09-22 15:01:43 +00:00
Doug Rupp
2df3e43eb9 [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.
2021-09-22 15:01:43 +00:00
Ghjuvan Lacambre
4a3cb9e319 [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.
2021-09-22 15:01:42 +00:00
Eric Botcazou
26ece6eca7 [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.
2021-09-22 15:01:42 +00:00
Steve Baird
ec813d06f7 [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.
2021-09-22 15:01:42 +00:00