Commit Graph

188585 Commits

Author SHA1 Message Date
Eric Botcazou
eae33329ea [Ada] Do not unconditionally inline expression functions with -gnatd.8
gcc/ada/

	* gcc-interface/trans.c (Subprogram_Body_to_gnu): Do not set the
	DECL_DISREGARD_INLINE_LIMITS flag if -gnatd.8 is specified.
2021-10-05 08:20:08 +00:00
Bob Duff
650ad524d8 [Ada] Fix latent bug in set_end_locus_from_node
gcc/ada/

	* gcc-interface/trans.c (set_end_locus_from_node): Check that
	Handled_Statement_Sequence is not Empty before calling
	End_Label, because the Empty node has no End_Label, and
	depending on the exact node layout chosen by gen_il, calling
	End_Label might crash, or might work OK by accident.
2021-10-05 08:20:08 +00:00
Eric Botcazou
07ad659daf [Ada] Minor include directives placement adjustment
gcc/ada/

	* gcc-interface/cuintp.c: Adjust placement of include directive.
	* gcc-interface/targtyps.c: Likewise.
2021-10-05 08:20:07 +00:00
Alexandre Oliva
a23e02091e [Ada] introduce stack scrub (strub) feature
gcc/ada/

	* doc/gnat_rm.rst: Add...
	* doc/gnat_rm/security_hardening_features.rst: New.
	* doc/gnat_rm/about_this_guide.rst: Link to new chapter.
	* gnat_rm.texi: Regenerate.
	* gcc-interface/utils.c (handle_strub_attribute): New.
	(gnat_internal_attribute_table): Add strub.
	* libgnat/a-except.adb: Make Rcheck_CE_* strub-callable.
	* libgnat/a-except.ads (Raise_Exception): Likewise.
	(Raise_Exception_Always): Likewise.
	* libgnat/s-arit128.ads (Multiply_With_Ovflo_Check128):
	Likewise.
	* libgnat/s-arit64.ads (Multiply_With_Ovflo_Check64):
	Likewise.
	* libgnat/s-secsta.ads (SS_Allocate, SS_Mark, SS_Release):
	Likewise.
2021-10-05 08:20:07 +00:00
Eric Botcazou
b1657ff3a0 [Ada] Mark private component renaming as coming from source
gcc/ada/

	* exp_ch9.adb (Install_Private_Data_Declarations): Copy the Sloc of
	components for the local renamings as well as the Comes_From_Source
	flag, and also set Warnings_Off on them.  Use Nam local variable.
2021-10-05 08:20:07 +00:00
Arnaud Charlet
3a0302e07c [Ada] Add comments in Ada.Task_Initialization
gcc/ada/

	* libgnarl/a-tasini.ads (Set_Initialization_Handler): Update
	comments.
2021-10-05 08:20:06 +00:00
Corentin Gay
8ae054eaae [Ada] Include errno.h in QNX specific part of the signal handling
gcc/ada/

	* init.c (QNX): Add #include errno.h.
2021-10-05 08:20:06 +00:00
Eric Botcazou
c46dffc657 [Ada] Remove left-overs of Unaligned_Valid attribute
gcc/ada/

	* exp_attr.adb (Expand_Fpt_Attribute): Likewise.
	* snames.ads-tmpl (Name_Unaligned_Valid): Delete.
2021-10-05 08:20:06 +00:00
Etienne Servais
2f22e8d396 [Ada] Forbids use of Compile_Time_(Error|Warning) as configuration pragma
gcc/ada/

	* sem_prag.adb (Analyze_Pragma): Forbid use of
	Compile_Time_(Error|Warning) as configuration pragma.
	* doc/gnat_ugn/the_gnat_compilation_model.rst:
	Compile_Time_(Error|Warning) and Compiler_Unit(_Warning) are not
	configuration pragmas and shall not be listed as such.  The
	following pragmas are either obsolete or undocumented:
	No_Run_Time, Propagate_Exceptions, Rational, Ravenscar,
	Restricted_Run_Time, Short_Descriptors, Universal_Data.  Fix
	some typos (notably on Restriction_Warnings).
	* doc/gnat_rm/implementation_defined_pragmas.rst: Move
	Rename_Pragma documentation to alphabetical order.
	* gnat_rm.texi, gnat_ugn.texi: Regenerate.
2021-10-05 08:20:05 +00:00
Corentin Gay
e3915b90ea [Ada] Add sys/time.h #include for QNX
gcc/ada/

	* adaint.c (QNX): Add #include for sys/time.h.
2021-10-05 08:20:05 +00:00
Pascal Obry
f7d1d2c250 [Ada] Issue a proper error message when no format specifier found
gcc/ada/

	* libgnat/g-forstr.adb (Next_Format): When there is no more
	format specifier found issue a proper error message instead of
	raising a contraint error.
2021-10-05 08:20:05 +00:00
Pascal Obry
657d0d8faf [Ada] Fix negative numbers formatted with leading zero
gcc/ada/

	* libgnat/g-forstr.adb (Get_Formatted): Fix computation of the
	number of zero to use in the formatted string. This was a wrong
	copy/paste.
2021-10-05 08:20:04 +00:00
Pascal Obry
b2b2fe2d67 [Ada] Minor code clean-up
gcc/ada/

	* libgnat/g-forstr.adb (Get_Formatted): Minor code clean-up.
2021-10-05 08:20:04 +00:00
Etienne Servais
8c77e8b09e [Ada] Add missing functions to Wide_Wide_Characters Handling
gcc/ada/

	* libgnat/a-zchhan.ads, libgnat/a-zchhan.adb
	(Character_Set_Version, Is_Basic, To_Basic): New.
	* libgnat/a-zchuni.ads, libgnat/a-zchuni.adb (Is_Basic,
	To_Basic): New.
2021-10-05 08:20:04 +00:00
Yannick Moy
4f3a016f51 [Ada] Improve error message on array aggregates
gcc/ada/

	* sem_aggr.adb (Resolve_Array_Aggregate): Improve error message.
2021-10-05 08:20:03 +00:00
Gary Dismukes
b479c0f7d7 [Ada] Front-end support for Storage_Model feature
gcc/ada/

	* aspects.ads (type Aspect_Id): Add
	Aspect_Designated_Storage_Model and Aspect_Storage_Model_Type.
	(Aspect_Argument): Add associations for the above new aspects.
	(Is_Representation_Aspect): Likewise.
	(Aspect_Names, Aspect_Delay): Likewise.
	* exp_ch4.adb (Expand_N_Allocator): Call Find_Storage_Op rather
	than Find_Prim_Op.
	* exp_intr.adb (Expand_Unc_Deallocation): Likewise.
	* exp_util.ads (Find_Storage_Op): New function that locates
	either a primitive operation of a storage pool or an operation
	of a storage-model type specified in its Storage_Model_Type
	aspect.
	* exp_util.adb (Find_Storage_Op): New function that calls either
	Find_Prim_Op or Get_Storage_Model_Type_Entity to locate a
	storage-related operation that is associated with a type.
	* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Analyzes,
	resolves, and validates the arguments of aspect
	Designated_Storage_Model_Type.
	(Analyze_Aspect_Specifications): Sets delay-related flags on
	storage-model aspects when Delay_Required. Checks that aspect
	Designated_Storage_Model is only specified for an access type
	and that aspect Storage_Model_Type is only specified on an
	immutably limited type. Also records such aspects for their
	associated types.
	(Check_Aspect_At_Freeze_Point): Resolve each of the argument
	associations given for a Storage_Model_Type aspect.
	(Resolve_Storage_Model_Type_Argument): New procedure that
	resolves an argument given in the association for a given entity
	name associated with a type with aspect Storage_Model_Type,
	ensuring that it has the proper kind or profile.
	(Validate_Storage_Model_Type_Aspect): New procedure that checks
	the legality and completeness of the entity associations given
	in a Storage_Model_Type aspect.
	* sem_util.ads (package Storage_Model_Support): New nested
	package that encapsulates a set of convenient utility functions
	for retrieving entities, etc. associated with
	storage-model-related types and objects.
	(Get_Storage_Model_Type_Entity): New function to return a
	specified entity associated with a type that has aspect
	Storage_Model_Type.
	(Has_Designated_Storage_Model_Aspect): New function that returns
	whether a type has aspect Designated_Storage_Model.
	(Has_Storage_Model_Type_Aspect): New function that returns
	whether a type has aspect Storage_Model_Type.
	(Storage_Model_Object): New function that returns the object
	Entity_Id associated with a type's Designated_Storage_Model
	aspect.
	(Storage_Model_Type): New function that returns the type
	associated with a storage-model object (when the object's type
	specifies Storage_Model_Type).
	(Storage_Model_Address_Type): New function that returns the
	Address_Type associated with a type that has aspect
	Storage_Model_Type.
	(Storage_Model_Null_Address): New function that returns the
	Null_Address constant associated with a type that has aspect
	Storage_Model_Type.
	(Storage_Model_Allocate): New function that returns the Allocate
	procedure associated with a type that has aspect
	Storage_Model_Type.
	(Storage_Model_Deallocate): New function that returns the
	Deallocate procedure associated with a type that has aspect
	Storage_Model_Type.
	(Storage_Model_Copy_From): New function that returns the
	Copy_From procedure associated with a type that has aspect
	Storage_Model_Type.
	(Storage_Model_Copy_To): New function that returns the Copy_To
	procedure associated with a type that has aspect
	Storage_Model_Type.
	(Storage_Model_Storage_Size): New function that returns the
	Storage_Size function associated with a type that has aspect
	Storage_Model_Type.
	* sem_util.adb (package Storage_Model_Support): Body of new
	nested package that contains the implementations the utility
	functions declared in the spec of this package.
	* snames.ads-tmpl: Add new names Name_Designated_Storage_Pool,
	Name_Storage_Model, Name_Storage_Model_Type, Name_Address_Type,
	Name_Copy_From, Name_Copy_To, and Name_Null_Address for the new
	aspects and associated aspect arguments.
2021-10-05 08:20:03 +00:00
Richard Kenner
e035b4f592 [Ada] Note that -gnatd_t is used in CCG
gcc/ada/

	* debug.adb: Add documentation for -gnatd_t.
2021-10-05 08:20:02 +00:00
Corentin Gay
50524b0aa6 [Ada] Add case to consider ENODEV a "file not found error"
gcc/ada/

	* sysdep.c (__gnat_is_file_not_found_error): Add else if case.
2021-10-05 08:20:02 +00:00
Piotr Trojanek
bdabd8b6ec [Ada] Rewrite operator entity in derived class-wide expressions
gcc/ada/

	* exp_util.adb (Build_Class_Wide_Expression): Replace entities
	of both identifiers and operator symbols.
2021-10-05 08:20:02 +00:00
Piotr Trojanek
cc1fcd3879 [Ada] Propagate Ghost status from parent to derived subprograms
gcc/ada/

	* sem_ch3.adb (Derive_Subprogram): Copy ghost status from parent
	to derived subprogram.
2021-10-05 08:20:02 +00:00
Joffrey Huguet
04175813f9 [Ada] Add Default_Initial_Condition to type Unbounded_String
gcc/ada/

	* libgnat/a-strunb.ads, libgnat/a-strunb__shared.ads: Add
	Default_Initial_Condition to Unbounded_String.
2021-10-05 08:20:01 +00:00
Claire Dross
640bda34f0 [Ada] Disable contract cases on formal containers
gcc/ada/

	* libgnat/a-cfdlli.ads: Use pragma Assertion_Policy to disable
	contract cases at execution.
	* libgnat/a-cfinve.ads: Idem.
	* libgnat/a-cofove.ads: Idem.
	* libgnat/a-cfhase.ads: Idem.
	* libgnat/a-cfhama.ads: Idem.
	* libgnat/a-cforse.ads: Idem.
	* libgnat/a-cforma.ads: Idem.
2021-10-05 08:20:01 +00:00
Bob Duff
439dae60eb [Ada] Improve message on missing all/for in pre-Ada-2022 modes
gcc/ada/

	* par-ch4.adb (P_Iterated_Component_Association): Parse these
	features the same way in all language versions.  Move the call
	to Error_Msg_Ada_2022_Feature into semantic analysis.
	* sem_aggr.adb (Resolve_Iterated_Component_Association,
	Resolve_Iterated_Association): Move the call to
	Error_Msg_Ada_2022_Feature here from par-ch4.adb.
2021-10-05 08:20:01 +00:00
Yannick Moy
f88db1839a [Ada] Improve error message on missing all/for in quantified expression
gcc/ada/

	* sem_res.adb (Resolve): Recognize specially that case.
2021-10-05 08:20:00 +00:00
Yannick Moy
f46939f9d4 [Ada] Proof of Ada.Strings.Maps
gcc/ada/

	* libgnat/a-strmap.adb: Add ghost code for proof.
	(To_Range): This is the most involved proof, as it requires
	creating the result of the call to To_Domain as a ghost
	variable, and show the unicity of this result in order to prove
	the postcondition.
	* libgnat/a-strmap.ads: (SPARK_Proof_Sorted_Character_Sequence):
	New ghost function.
	(To_Domain): Add postcondition regarding sorting of result.
	(To_Range): Fix postcondition that should compare Length instead
	of Last for the results of To_Domain and To_Range, as the value
	of Last for an empty result is not specified in the Ada RM.
2021-10-05 08:20:00 +00:00
Yannick Moy
ec8ccc712c [Ada] Proof of Ada.Characters.Handling
gcc/ada/

	* libgnat/a-chahan.adb: Add loop invariants as needed to prove
	subprograms.  Also use extended return statements where
	appropriate and not done already.  Mark data with
	Relaxed_Initialization where needed for initialization by parts.
	Convert regular functions to expression functions where needed
	for proof.
	* libgnat/a-chahan.ads: Add postconditions.
	* libgnat/a-strmap.ads (Model): New ghost function to create a
	publicly visible model of the private data Character_Mapping,
	needed in order to prove subprograms in Ada.Characters.Handling.
2021-10-05 08:20:00 +00:00
Richard Biener
1581aa38eb Adjust gfortran.dg/predict-2.f90
After teaching VN to handle internal functions we now optimize
the redundant inner loop preheader check of the testcase making
the dump scanning fail because there's nothing to predict left.
The following restores the inner preheader check by making it
not redundant.

2021-10-05  Richard Biener  <rguenther@suse.de>

	* gfortran.dg/predict-2.f90: Adjust to avoid redundant
	inner loop preheader checking code.
2021-10-05 08:37:34 +02:00
GCC Administrator
da9c5f7856 Daily bump. 2021-10-05 00:16:29 +00:00
Marek Polacek
2dda00b734 c-family: Implement -Warray-compare [PR97573]
This patch addresses one of my leftovers from GCC 11.  C++20 introduced
[depr.array.comp]: "Equality and relational comparisons between two operands
of array type are deprecated." so this patch adds -Warray-compare.  Since the
code in question is dubious (the comparison doesn't actually compare the array
elements), I've added this warning for C too, and enabled it in all C++ modes.

	PR c++/97573

gcc/c-family/ChangeLog:

	* c-common.h (do_warn_array_compare): Declare.
	* c-warn.c (do_warn_array_compare): New.
	* c.opt (Warray-compare): New option.

gcc/c/ChangeLog:

	* c-typeck.c (parser_build_binary_op): Call do_warn_array_compare.

gcc/cp/ChangeLog:

	* typeck.c (cp_build_binary_op): Call do_warn_array_compare.

gcc/ChangeLog:

	* doc/invoke.texi: Document -Warray-compare.

gcc/testsuite/ChangeLog:

	* c-c++-common/Warray-compare-1.c: New test.
	* c-c++-common/Warray-compare-2.c: New test.
2021-10-04 12:33:57 -04:00
Richard Biener
d362b91fa6 avoid hardreg autoinit
This avoids initializating "uninitialized" hardregs like SP.

2021-10-04  Richard Biener  <rguenther@suse.de>

	* gimplify.c (is_var_need_auto_init): DECL_HARD_REGISTER
	variables are not to be initialized.

	* gcc.dg/auto-init-hardreg-1.c: New testcase.
2021-10-04 18:02:57 +02:00
Iain Buclaw
c86a16b07b d: gdc driver ignores -static-libstdc++ when automatically linking libstdc++ library
Adds handling of `-static-libstc++' in the gdc driver, so that libstdc++
is appropriately linked if libstdc++ is either needed or seen on the
command-line.

	PR d/102574

gcc/d/ChangeLog:

	* d-spec.cc (lang_specific_driver): Link libstdc++ statically if
	-static-libstdc++ was given on command-line.
2021-10-04 17:07:30 +02:00
Iain Buclaw
c4ee096537 d: Save target node before parsing optimize options in case it changes.
Fixes an ICE seen on PowerPC targets with the attr_optimize*.d tests in
the gdc.dg testsuite.

gcc/d/ChangeLog:

	* d-attribs.cc (d_handle_optimize_attribute): Save target node before
	calling parse_optimize_options in case it changes.
2021-10-04 17:07:29 +02:00
Richard Biener
7e0c050080 middle-end/102285 - refine .DEFERRED_INIT expansion
This refines the way we figure whether we are facing a register
that cannot be initialized by emitting a memset away from inspecting
expanded RTL of the LHS to using the predicates expand_assignment
is using to detect decls or MEM_REFs with non-memory DECL_RTL.

2021-10-04  Richard Biener  <rguenther@suse.de>

	* expr.h (non_mem_decl_p): Declare.
	(mem_ref_refers_to_non_mem_p): Likewise.
	* expr.c (non_mem_decl_p): Export.
	(mem_ref_refers_to_non_mem_p): Likewise.
	* internal-fn.c (expand_DEFERRED_INIT): Do not expand the LHS
	but check the base with mem_ref_refers_to_non_mem_p
	and non_mem_decl_p.

	* c-c++-common/pr102285.c: New testcase.
2021-10-04 16:53:25 +02:00
Richard Biener
55a3be2f52 tree-optimization/102570 - teach VN about internal functions
We're now using internal functions for a lot of stuff but there's
still missing VN support out of laziness.  The following instantiates
support and adds testcases for FRE and PRE (hoisting).

2021-10-04  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/102570
	* tree-ssa-sccvn.h (vn_reference_op_struct): Document
	we are using clique for the internal function code.
	* tree-ssa-sccvn.c (vn_reference_op_eq): Compare the
	internal function code.
	(print_vn_reference_ops): Print the internal function code.
	(vn_reference_op_compute_hash): Hash it.
	(copy_reference_ops_from_call): Record it.
	(visit_stmt): Remove the restriction around internal function
	calls.
	(fully_constant_vn_reference_p): Use fold_const_call and handle
	internal functions.
	(vn_reference_eq): Compare call return types.
	* tree-ssa-pre.c (create_expression_by_pieces): Handle
	generating calls to internal functions.
	(compute_avail): Remove the restriction around internal function
	calls.

	* gcc.dg/tree-ssa/ssa-fre-96.c: New testcase.
	* gcc.dg/tree-ssa/ssa-pre-33.c: Likewise.
2021-10-04 16:52:50 +02:00
Jonathan Wakely
22d34a2a50 libstdc++: Implement P1518R2 for container deduction guides
This implements the C++23 P1518R2 proposal "Stop overconstraining
allocators in container deduction guides" as a fix for C++17 and C++20
too.

The changes allow class template argument deduction to ignore the type
of a constructor argument that initializes an allocator_type parameter
if the type should be deducible only from the other arguments. So for
the constructor vector(const vector&, const allocator_type&) only the
first argument is used for deduction, allowing the second argument to be
anything that is implicitly convertible to argument_type. Previously
deduction would fail or an ill-formed type would be deduced if the
second argument wasn't of type allocator_type.

The unordered containers do not need changes, because their
allocator-extended constructors use the allocator_type alias, which
comes from the dependent base class so is already a non-deduced context.

libstdc++-v3/ChangeLog:

	* include/bits/forward_list.h (forward_list): Use non-deduced
	context for allocator parameter of allocator-extended copy and
	move constructors.
	* include/bits/stl_bvector.h (vector<bool>): Likewise.
	* include/bits/stl_deque.h (deque): Likewise.
	* include/bits/stl_list.h (list): Likewise.
	* include/bits/stl_map.h (map): Likewise.
	* include/bits/stl_multimap.h (multimap): Likewise.
	* include/bits/stl_multiset.h (multiset): Likewise.
	* include/bits/stl_set.h (set): Likewise.
	* include/bits/stl_vector.h (vector): Likewise.
	* include/bits/stl_queue.h (queue, priority_queue): Do not
	constrain Allocator template parameter of deduction guides that
	have a Container parameter.
	* include/bits/stl_stack.h (stack): Likewise.
	* include/debug/deque (__gnu_debug::deque): Use non-deduced
	context for allocator parameter of allocator-extended copy and
	move constructors.
	* include/debug/list (__gnu_debug::list): Likewise.
	* include/debug/map.h (__gnu_debug::map): Likewise.
	* include/debug/multimap.h (__gnu_debug::multimap): Likewise.
	* include/debug/multiset.h (__gnu_debug::multiset): Likewise.
	* include/debug/set.h (__gnu_debug::set): Likewise.
	* include/debug/vector (__gnu_debug::vector): Likewise.
	* testsuite/23_containers/deque/cons/deduction.cc: Test class
	template argument deduction with non-deduced allocator
	arguments.
	* testsuite/23_containers/forward_list/cons/deduction.cc:
	Likewise.
	* testsuite/23_containers/list/cons/deduction.cc: Likewise.
	* testsuite/23_containers/map/cons/deduction.cc: Likewise.
	* testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
	* testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
	* testsuite/23_containers/priority_queue/deduction.cc: Likewise.
	* testsuite/23_containers/queue/deduction.cc: Likewise.
	* testsuite/23_containers/set/cons/deduction.cc: Likewise.
	* testsuite/23_containers/stack/deduction.cc: Likewise.
	* testsuite/23_containers/unordered_map/cons/deduction.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/cons/deduction.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/cons/deduction.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/cons/deduction.cc:
	Likewise.
	* testsuite/23_containers/vector/cons/deduction.cc: Likewise.
2021-10-04 15:23:28 +01:00
Jonathan Wakely
728e639d82 libstdc++: Add missing noexcept to std::variant helper
libstdc++-v3/ChangeLog:

	* include/std/variant (__detail::__variant::__as): Add missing
	noexcept to first overload.
2021-10-04 15:23:28 +01:00
Jonathan Wakely
cf876562c5 libstdc++: Disable std::string{,_view} construction from nullptr (P2166R1)
Implement this C++23 feature. Because construction from a null pointer
is undefined, we can implement it for C++11 and up, turning undefined
behaviour into a compilation error.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h (basic_string(nullptr_t)): Define
	as deleted.
	(operator=(nullptr_t)): Likewise.
	* include/bits/cow_string.h (basic_string(nullptr_t)): Likewise.
	(operator=(nullptr_t)): Likewise.
	* include/std/string_view (basic_string_view(nullptr_t)):
	Likewise.
	* testsuite/21_strings/basic_string/cons/char/nullptr.cc: New test.
	* testsuite/21_strings/basic_string_view/cons/char/nonnull.cc:
	Change dg-warning to dg-error.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/nonnull.cc:
	Likewise.
2021-10-04 15:23:28 +01:00
Aldy Hernandez
fa3ccf8bfe Remove static marker for range in alloca pass.
The m_ranges[] field in int_range<N> are trees, so they live in GC
space.  Since invalid_range is static, it must be marked with GTY
magic.  However, calculating invalid_range is not particularly slow,
or on a critical path, so we can just put it in local scope and
recalculate every time.

Tested on x86-64 Linux.

gcc/ChangeLog:

	PR tree-optimization/102560
	* gimple-ssa-warn-alloca.c (alloca_call_type): Remove static
	marker for invalid_range.

gcc/testsuite/ChangeLog:

	* g++.dg/Walloca2.C: New test.
2021-10-04 13:20:25 +02:00
Richard Biener
ad4a3c047f middle-end/102587 - avoid auto-init for VLA vectors
This avoids ICEing for VLA vector auto-init by not initializing.

2021-10-04  Richard Biener  <rguenther@suse.de>

	PR middle-end/102587
	* internal-fn.c (expand_DEFERRED_INIT): Guard register
	initialization path an avoid initializing VLA registers
	with it.

	* gcc.target/aarch64/sve/pr102587-1.c: New testcase.
	* gcc.target/aarch64/sve/pr102587-2.c: Likewise.
2021-10-04 10:57:23 +02:00
Justin Squirek
5e0367dd64 [Ada] Incremental patch for restriction No_Dynamic_Accessibility_Checks
gcc/ada/

	* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
	Add new entry for No_Dynamic_Accessibility_Checks documenting
	behavior.
	* gnat_rm.texi: Regenerate.
	* exp_ch4.adb (Expand_N_In): Perform special expansion for
	membership tests when No_Dynamic_Accessibility_Checks is active.
	* sem_attr.adb (Resolve_Attribute): Skip static accessibility
	check on actuals for anonymous access type formal parameters,
	and add constants for readability.
	* sem_util.adb (Function_Call_Or_Allocator_Level): Use the
	innermost master for determining the level for function calls
	within the alternative accessibility model.
	(Type_Access_Level): Properly get the level for anonymous access
	function result types.
2021-10-04 08:45:13 +00:00
Piotr Trojanek
29ca68773b [Ada] Document the current behaviour of -gnateA switch
gcc/ada/

	* doc/gnat_ugn/building_executable_programs_with_gnat.rst
	(gnateA): This switch no longer looks at the formal parameter
	type being composite (as originally mandated by SPARK), but in
	the parameter passing mechanism being not specified (as
	currently mandated by Ada).
	* gnat_ugn.texi: Regenerate.
2021-10-04 08:45:12 +00:00
Ed Schonberg
6a53553086 [Ada] Handle properly user_defined literals given by operators.
gcc/ada/

	* sem_ch6.adb (Analyze_Operator_Symbol): Recognize strings as
	operator names when they are the value of one of the Ada2022
	aspects for User_Defined_Literals.
	* sem_ch13.adb (Analyze_One_Aspect): Handle an aspect value
	given by an Operator_Name.
	(Validate_Literal_Aspect): Call Analyze_Operator_Symbol when
	needed.
2021-10-04 08:45:12 +00:00
Piotr Trojanek
861dc87d75 [Ada] Fix indentation in generated AST construction functions
gcc/ada/

	* gen_il-gen.adb (Put_Make_Spec): Don't emit the LF character in
	the middle of a string, because the Put routine won't indent it
	properly.
2021-10-04 08:45:12 +00:00
Ghjuvan Lacambre
aa40952cda [Ada] Implement CUDA_Device
gcc/ada/

	* gnat_cuda.adb (Remove_CUDA_Device_Entities): New function.
	(Expand_CUDA_Package): Call Remove_CUDA_Device_Entities.
	* gnat_cuda.ads (Expand_CUDA_Package): Expand documentation.
	* sem_prag.adb (Analyze_Pragma): Remove warning about
	CUDA_Device not being implemented.
2021-10-04 08:45:11 +00:00
Gary Dismukes
70aec3a1b8 [Ada] Completion of support for AI12-0409 (attribute Preelaborable_Initialization)
gcc/ada/

	* sem_ch7.adb (Analyze_Package_Specification): For types marked
	as Must_Have_Preelab_Init, we now check for the presence of a
	Preelaborable_Initialization aspect on the type, and pass the
	aspect's expression (if any) on the call to
	Has_Preelaborable_Initialization (or pass Empty if the type has
	no such aspect or the aspect has no associated expression).
	* sem_util.ads (Has_Preelaborable_Initialization): Change
	Boolean formal parameter Formal_Types_Have_Preelab_Init to
	instead be a formal of type Node_Id (named Preelab_Init_Expr),
	to allow passing an expression that may be a conjunction of
	Preelaborable_Initialization aspects. Revise spec comment
	accordingly (and remove ??? comment).
	* sem_util.adb (Type_Named_In_Preelab_Init_Expression): New
	nested function with a result indicating whether a given type is
	named as the prefix of a Preelaborable_Initialization attribute
	in the expression of a corresponding P_I aspect.
	(Has_Preelaborable_Initialization): For generic formal derived
	and private types, test whether the type is named in the
	expression Preelab_Init_Expr (by calling
	Type_Named_In_Preelab_Init_Expression), and if so, treat the
	formal type as having preelaborable initialization (returning
	True).
	* libgnat/a-cobove.ads (Vector): Replace pragma
	Preelaborable_Initialization with the aspect, specifying its
	value as Element_Type'Preelaborable_Initialization.
	(Cursor): Replace pragma P_I with the aspect (defaulting to
	True).
	* libgnat/a-cbdlli.ads (List): Replace pragma
	Preelaborable_Initialization with the aspect, specifying its
	value as Element_Type'Preelaborable_Initialization.
	(Cursor): Replace pragma P_I with the aspect (defaulting to
	True).
	* libgnat/a-cbhama.ads (Map): Replace pragma
	Preelaborable_Initialization with the aspect, specifying its
	value as (Element_Type'Preelaborable_Initialization and
	Key_Type'Preelaborable_Initialization).
	(Cursor): Replace pragma P_I with the aspect (defaulting to
	True).
	* libgnat/a-cborma.ads (Map): Replace pragma
	Preelaborable_Initialization with the aspect, specifying its
	value as (Element_Type'Preelaborable_Initialization and
	Key_Type'Preelaborable_Initialization).
	(Cursor): Replace pragma P_I with the aspect (defaulting to
	True).
	* libgnat/a-cbhase.ads (Set): Replace pragma
	Preelaborable_Initialization with the aspect, specifying its
	value as Element_Type'Preelaborable_Initialization.
	(Cursor): Replace pragma P_I with the aspect (defaulting to
	True).
	* libgnat/a-cborse.ads (Set): Replace pragma
	Preelaborable_Initialization with the aspect, specifying its
	value as Element_Type'Preelaborable_Initialization.
	(Cursor): Replace pragma P_I with the aspect (defaulting to
	True).
	* libgnat/a-cbmutr.ads (Tree): Replace pragma
	Preelaborable_Initialization with the aspect, specifying its
	value as Element_Type'Preelaborable_Initialization.
	(Cursor): Replace pragma P_I with the aspect (defaulting to
	True).
	* libgnat/a-coboho.ads (Holder): Replace pragma
	Preelaborable_Initialization with the aspect, specifying its
	value as Element_Type'Preelaborable_Initialization.
	(Cursor): Replace pragma P_I with the aspect (defaulting to
	True).
2021-10-04 08:45:11 +00:00
Yannick Moy
a5740f2b72 [Ada] Mark Ada.Text_IO in SPARK
gcc/ada/

	* libgnat/a-textio.adb: Mark body out of SPARK.
	* libgnat/a-textio.ads: Mark spec in SPARK and private part out
	of SPARK.
	* sem.adb (Semantics.Do_Analyze): Similar to ghost code
	attributes, save and restore value of
	Ignore_SPARK_Mode_Pragmas_In_Instance.
2021-10-04 08:45:10 +00:00
Bob Duff
39d7ff0fd7 [Ada] Minor comment fix in System.Regpat
gcc/ada/

	* libgnat/s-regpat.ads: Change Data_First to Data'First. Change
	"still" to "always".  Similar changes for Data_Last.
2021-10-04 08:45:10 +00:00
Piotr Trojanek
be33050b86 [Ada] Refactor duplicate code for pretty-printing GNAT AST
gcc/ada/

	* sprint.adb (Sprint_Node_Actual): Refactor code for generic
	package and subprogram declarations.
2021-10-04 08:45:10 +00:00
Piotr Trojanek
b680788460 [Ada] Remove repeated calls to Prefix in resolution of array accesses
gcc/ada/

	* sem_res.adb (Resolve_Indexed_Component, Resolve_Slice): Rename
	the local constant Name to Pref; remove repeated calls to
	Prefix.
2021-10-04 08:45:10 +00:00
Matthieu Eyraud
3a6f30ed5d [Ada] Emit specific SCOs for decisions of quantified expressions
gcc/ada/

	* scos.ads: Extend the documentation.
	* par_sco.adb (Process_Decisions): Emit specific SCOs for
	quantified expressions.
2021-10-04 08:45:09 +00:00