Commit Graph

188143 Commits

Author SHA1 Message Date
Bob Duff
b23cdc0158 [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.
2021-09-21 15:24:57 +00:00
Steve Baird
e906896787 [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.
2021-09-21 15:24:56 +00:00
Steve Baird
3598c8db40 [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.
2021-09-21 15:24:56 +00:00
Piotr Trojanek
2528d0c7ce [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.
2021-09-21 15:24:55 +00:00
Piotr Trojanek
255279b91e [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.
2021-09-21 15:24:55 +00:00
Yannick Moy
ea3789f6a2 [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.
2021-09-21 15:24:55 +00:00
Ed Schonberg
c36332031c [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.
2021-09-21 15:24:55 +00:00
Bob Duff
4d027eea55 [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.
2021-09-21 15:24:54 +00:00
Thomas Schwinge
e87789f197 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'.
2021-09-21 12:38:44 +02:00
Richard Earnshaw
4e7a92c0ff 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.
2021-09-21 11:20:37 +01:00
Richard Biener
55b989de76 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.
2021-09-21 10:39:33 +02:00
Eric Botcazou
6e6bf4cd21 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.
2021-09-21 09:29:39 +02:00
Tobias Burnus
417ea5c02c 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.
2021-09-21 08:28:30 +02:00
Kewen Lin
63c6446f77 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.
2021-09-20 21:00:04 -05:00
wangpc
56c24f18cc 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.
2021-09-20 20:52:46 -04:00
GCC Administrator
624980241e Daily bump. 2021-09-21 00:16:31 +00:00
Andrew MacLeod
73cf73af23 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.
2021-09-20 16:32:35 -04:00
Andrew MacLeod
5d110fe90a 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.
2021-09-20 16:32:35 -04:00
Harald Anlauf
b333c3acb8 MAINTAINERS: add myself as Fortran reviewer
ChangeLog:

	* MAINTAINERS (Reviewers): Add myself as Fortran reviewer.
2021-09-20 22:16:18 +02:00
Matthias Kretz
1949d7540a 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__.
2021-09-20 15:13:11 +02:00
Piotr Trojanek
71a4bdada5 [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.
2021-09-20 12:31:38 +00:00
Piotr Trojanek
3613473ab1 [Ada] Fix shadowing in conditions for inlining
gcc/ada/

	* inline.adb (Has_Excluded_Declaration): Rename and reduce scope
	of a local variable.
2021-09-20 12:31:37 +00:00
Bob Duff
2175b50b74 [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".
2021-09-20 12:31:37 +00:00
Claire Dross
9613900aef [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.
2021-09-20 12:31:36 +00:00
Doug Rupp
c5049dfec7 [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.
2021-09-20 12:31:36 +00:00
Piotr Trojanek
a06c060b15 [Ada] Accept volatile expressions as non-scalar actual parameters
gcc/ada/

	* sem_res.adb (Resolve_Actual): Remove
2021-09-20 12:31:36 +00:00
Bob Duff
8e5a883263 [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.
2021-09-20 12:31:35 +00:00
Piotr Trojanek
e97dd2ae76 [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.
2021-09-20 12:31:35 +00:00
Piotr Trojanek
cf0813a9cf [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.
2021-09-20 12:31:34 +00:00
Pierre-Alexandre Bazin
6c5ca4cf42 [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.
2021-09-20 12:31:34 +00:00
Piotr Trojanek
8582e5d07e [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.
2021-09-20 12:31:34 +00:00
Eric Botcazou
4375ee57b1 [Ada] Adjust latest change for ELF platforms
gcc/ada/

	* libgnat/s-objrea.adb (Get_Load_Address): Return 0 for ELF.
2021-09-20 12:31:33 +00:00
Eric Botcazou
aaddaf82ed [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.
2021-09-20 12:31:33 +00:00
Piotr Trojanek
7a8e133af2 [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.
2021-09-20 12:31:33 +00:00
Ed Schonberg
325443d24b [Ada] Spurious link error with child unit and different Assertion modes.
gcc/ada/

	* exp_util.ads (Force_Evaluation): Add formal parameter
	Discr_Number, to indicate discriminant expression for which an
	external name must be created.
	(Remove_Side_Effects): Ditto.
	* exp_util.adb (Force_Evaluation): Call Remove_Side_Effects with
	added parameter.
	(Remove_Side_Effects, Build_Temporary): If Discr_Number is
	positive, create an external name with suffix DISCR and the
	given discriminant number, analogous to what is done for
	temporaries for array type bounds.
	* sem_ch3.adb (Process_Discriminant_Expressions): If the
	constraint is for an object or component declaration and the
	corresponding entity may be visible in another unit, invoke
	Force_Evaluation with the new parameter.
2021-09-20 12:31:32 +00:00
Arnaud Charlet
535a706f7e [Ada] Clean up Uint fields (continued)
gcc/ada/

	* gen_il-internals.ads (Invalid_Val): Remove, unused and
	generates warnings.
2021-09-20 12:31:32 +00:00
Piotr Trojanek
0c5c46a957 [Ada] Refine types of local constants that store Etype results
gcc/ada/

	* exp_aggr.adb, exp_ch4.adb, exp_ch5.adb, sprint.adb: Refine
	types of local constants.
2021-09-20 12:31:32 +00:00
Gary Dismukes
3450ded1ed [Ada] Implementation of Preelaborable_Initialization attribute for AI12-0409
gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference): Fold
	Preelaborable_Initialization attribute in cases where it hasn't
	been folded by the analyzer.
	* exp_disp.adb (Original_View_In_Visible_Part): This function is
	removed and moved to sem_util.adb.
	* sem_attr.adb (Attribute_22): Add
	Attribute_Preelaborable_Initialization as an Ada 2022 attribute.
	(Analyze_Attribute, Attribute_Preelaborable_Initialization):
	Check that the prefix of the attribute is either a formal
	private or derived type, or a composite type declared within the
	visible part of a package or generic package.
	(Eval_Attribute): Perform folding of
	Preelaborable_Initialization attribute based on
	Has_Preelaborable_Initialization applied to the prefix type.
	* sem_ch3.adb (Resolve_Aspects): Add specialized code for
	Preelaborable_Initialization used at the end of a package
	visible part for setting Known_To_Have_Preelab_Init on types
	that are specified with True or that have a conjunction of one
	or more P_I attributes applied to formal types.
	* sem_ch7.adb (Analyze_Package_Specification): On call to
	Has_Preelaborable_Initialization, pass True for new formal
	Formal_Types_Have_Preelab_Init, so that error checking treats
	subcomponents that are declared within types in generics as
	having preelaborable initialization when the subcomponents are
	of formal types.
	* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Add test for
	P_I to prevent calling Make_Pragma_From_Boolean_Aspect, since
	this aspect is handled specially and the
	Known_To_Have_Preelab_Init flag will get set on types that have
	the aspect by other means.
	(Analyze_Aspect_Specifications.Analyze_One_Aspect): Add test for
	Aspect_Preelaborable_Initialization for allowing the aspect to
	be specified on formal type declarations.
	(Is_Operational_Item): Treat Attribute_Put_Image as an
	operational attribute.  The need for this was encountered while
	working on these changes.
	* sem_util.ads (Has_Preelaborable_Initialization): Add
	Formal_Types_Have_Preelab_Init as a new formal parameter that
	defaults to False.
	(Is_Conjunction_Of_Formal_Preelab_Init_Attributes): New
	function.
	(Original_View_In_Visible_Part): Moved here from exp_disp.adb,
	so it can be called by Analyze_Attribute.
	* sem_util.adb (Has_Preelaborable_Initialization): Return True
	for formal private and derived types when new formal
	Formal_Types_Have_Preelab_Init is True, and pass along the
	Formal_Types_Have_Preelab_Init flag in the array component case.
	(Check_Components): Pass along Formal_Types_Have_Preelab_Init
	flag on call to Has_Preelaborable_Initialization.
	(Is_Conjunction_Of_Formal_Preelab_Init_Attributes): New function
	that returns True when passed an expression that includes one or
	more attributes for Preelaborable_Initialization applied to
	prefixes that denote formal types.
	(Is_Formal_Preelab_Init_Attribute): New utility function nested
	within Is_Conjunction_Of_Formal_Preelab_Init_Attributes that
	determines whether a node is a P_I attribute applied to a
	generic formal type.
	(Original_View_In_Visible_Part): Moved here from exp_util.adb,
	so it can be called by Analyze_Attribute.
	* snames.ads-tmpl: Add note near the start of spec giving
	details about what needs to be done when adding a name that
	corresponds to both an attribute and a pragma.  Delete existing
	occurrence of Name_Preelaborable_Initialization, and add a note
	comment in the list of Name_* constants at that place,
	indicating that it's included in type Pragma_Id, etc., echoing
	other such comments for names that are both an attribute and a
	pragma.  Insert Name_Preelaborable_Initialization in the
	alphabetized set of Name_* constants corresponding to
	attributes (between First_Attribute_Name and
	Last_Attribute_Name).
	(type Attribute_Id): Add new literal
	Attribute_Preelaborable_Initialization.
	(type Pragma_Id): Move Pragma_Preelaborable_Initialization from
	its current position to the end of the type, in the special set
	of pragma literals that have corresponding atttributes. Add to
	accompanying comment, indicating that functions Get_Pragma_Id
	and Is_Pragma_Name need to be updated when adding a pragma
	literal to the special set.
	* snames.adb-tmpl (Get_Pragma_Id): Add case alternative for
	Pragma_Preelaborable_Initialization.
	(Is_Pragma_Name): Add test for
	Name_Preelaborable_Initialization.
2021-09-20 12:31:31 +00:00
Ghjuvan Lacambre
c83448aaf9 [Ada] Fix condition in op interpretation resolution
gcc/ada/

	* sem_ch4.adb (Finc_Non_Universal_Interpretations): Fix check.
2021-09-20 12:31:31 +00:00
Piotr Trojanek
2743363047 [Ada] Don't examine all discriminants when looking for the first one
gcc/ada/

	* sem_ch3.adb (Build_Discriminant_Constraints): Exit once a
	first discriminant is found and the Discrim_Present flag is set.
2021-09-20 12:31:30 +00:00
Bob Duff
b8d31ebcfa [Ada] Fix assertion in GNATprove_Mode
gcc/ada/

	* gnat1drv.adb (Gnat1drv): Avoid calling List_Rep_Info in
	Generate_SCIL and GNATprove_Mode.
	* repinfo.adb (List_Common_Type_Info): Fix comment.
2021-09-20 12:31:30 +00:00
Eric Botcazou
dae0df6cd9 [Ada] Small cleanup in System.Dwarf_Line
gcc/ada/

	* libgnat/s-dwalin.ads: Remove clause for Ada.Exceptions.Traceback,
	add clause for System.Traceback_Entries and alphabetize.
	(AET): Delete.
	(STE): New package renaming.
	(Symbolic_Traceback): Adjust.
	* libgnat/s-dwalin.adb: Remove clauses for Ada.Exceptions.Traceback
	and System.Traceback_Entries.
	(Symbolic_Traceback): Adjust.
2021-09-20 12:31:30 +00:00
Ghjuvan Lacambre
0f5356c4bf [Ada] Only assign type to op if compatible
gcc/ada/

	* sem_ch4.adb (Find_Non_Universal_Interpretations): Check if
	types are compatible before adding interpretation.
2021-09-20 12:31:30 +00:00
Justin Squirek
518cededb0 [Ada] Spurious accessibility error on allocator in generic instance
gcc/ada/

	* exp_ch4.adb (Expand_N_Type_Conversion): Add guard to protect
	against calculating accessibility levels against internal
	compiler-generated types.
2021-09-20 12:31:29 +00:00
Ghjuvan Lacambre
66fa923768 [Ada] Capitalize comment
gcc/ada/

	* sem_dim.adb (Dimensions_Msg_Of): Capitalize comment.
2021-09-20 12:31:29 +00:00
Ghjuvan Lacambre
8967ee52ea [Ada] Refactor scan_backend_switch to share logic across backends
gcc/ada/

	* adabkend.adb (Scan_Back_End_Switches): Replace switch-scanning
	logic with call to Backend_Utils.Scan_Common_Back_End_Switches.
	* back_end.adb (Scan_Back_End_Switches): Replace switch-scanning
	logic with call to Backend_Utils.Scan_Common_Back_End_Switches.
	* backend_utils.adb: New file.
	* backend_utils.ads: New file.
	* gcc-interface/Make-lang.in: Add ada/backend_utils.o.
2021-09-20 12:31:29 +00:00
Ghjuvan Lacambre
3afd5368f5 [Ada] Work around CodePeer bug by declaring variable
gcc/ada/

	* atree.adb (Get_32_Bit_Field): Declare result before returning.
2021-09-20 12:31:28 +00:00
Ghjuvan Lacambre
2c5ed0df53 [Ada] Move Build_And_Insert_Cuda_Initialization to Expand_CUDA_Package
gcc/ada/

	* exp_ch7.adb (Expand_N_Package_Body): Replace
	Build_And_Insert_Cuda_Initialization with Expand_CUDA_Package.
	* gnat_cuda.adb (Expand_CUDA_Package): New procedure.
	(Build_And_Insert_Cuda_Initialization): Make internal.
	* gnat_cuda.ads (Expand_CUDA_Package): New procedure.
	(Build_And_Insert_Cuda_Initialization): Remove from spec.
2021-09-20 12:31:28 +00:00
Ghjuvan Lacambre
5e86334302 [Ada] usage.adb: make -gnatw.c description clearer
gcc/ada/

	* usage.adb (Usage): Update -gnatw.c messages.
2021-09-20 12:31:28 +00:00
Eric Botcazou
d41be878c9 [Ada] Remove inappropriate test from Is_By_Reference_Type
gcc/ada/

	* sem_aux.adb (Is_By_Reference_Type): Do not test Error_Posted.
2021-09-20 12:31:27 +00:00