[COMMITTED 09/30] ada: Fix static 'Img for enumeration type with Discard_Names

2024-05-20 Thread Marc Poulhiès
From: Piotr Trojanek Fix a short-circuit folding of 'Img for enumeration type, which wrongly ignored Discard_Names and exposed enumeration literals. gcc/ada/ * sem_attr.adb (Eval_Attribute): Handle enumeration type with Discard_Names. Tested on x86_64-pc-linux-gnu, committed

[COMMITTED 01/30] ada: Rework and augment documentation on strict aliasing

2024-05-20 Thread Marc Poulhiès
From: Eric Botcazou The documentation was originally centered around pragma No_Strict_Aliasing and pragma Universal_Aliasing was mentioned only as an afterthought. It also contained a warning about the usage of overlays implemented by means of address clauses that has been obsolete for long.

[COMMITTED 16/30] ada: Use discrete choice list in declaration of universal type attributes

2024-05-20 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup. gcc/ada/ * sem_attr.ads (Universal_Type_Attribute): Simplify using array aggregate syntax with discrete choice list. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_attr.ads | 62

[COMMITTED 15/30] ada: Fix style in list of implementation-defined attributes

2024-05-20 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup. gcc/ada/ * sem_attr.ads (Attribute_Impl_Def): Fix style in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_attr.ads | 8 1 file changed, 8 insertions(+) diff --git a/gcc/ada/sem_attr.ads b/gcc/ada/sem_attr.ads

[COMMITTED 08/30] ada: Fix for attribute Width on enumeration types with Discard_Name

2024-05-20 Thread Marc Poulhiès
From: Piotr Trojanek Fix computation of attribute 'Width for enumeration types with Discard_Name aspect enabled. gcc/ada/ * exp_imgv.adb (Expand_Width_Attribute): Fix for 'Width that is computed at run time. * sem_attr.adb (Eval_Attribute): Fix for 'Width that is

[COMMITTED 05/30] ada: One more adjustment coming from aliasing considerations

2024-05-20 Thread Marc Poulhiès
From: Eric Botcazou It is needed on PowerPC platforms because of specific calling conventions. gcc/ada/ * libgnat/g-sothco.ads (In_Addr): Add aspect Universal_Aliasing. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/g-sothco.ads | 7 +-- 1 file changed,

[COMMITTED 07/30] ada: Use System.Address for address computation in System.Pool_Global

2024-05-20 Thread Marc Poulhiès
From: Sebastian Poeplau Some architectures don't let us convert System.Storage_Elements.Integer_Address back to a valid System.Address. Using the arithmetic operations on System.Address from System.Storage_Elements prevents the problem while leaving semantics unchanged. gcc/ada/ *

[COMMITTED 06/30] ada: Reject too-strict alignment specifications.

2024-05-20 Thread Marc Poulhiès
From: Steve Baird For a discrete (or fixed-point) type T, GNAT requires that T'Object_Size shall be a multiple of T'Alignment * 8 . GNAT also requires that T'Object_Size shall be no larger than Standard'Max_Integer_Size. For a sufficiently-large alignment specification, these requirements can

[COMMITTED 04/30] ada: Detect only conflict with synomyms of max queue length

2024-05-20 Thread Marc Poulhiès
From: Jose Ruiz Use of duplicated representation aspect is detected elsewhere so we do not try to detect them here to avoid repetition of messages. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Exclude detection of duplicates because they are detected elsewhere. Tested on

[COMMITTED 02/30] ada: Small cleanup in System.Finalization_Primitives unit

2024-05-20 Thread Marc Poulhiès
From: Eric Botcazou It has been made possible by recent changes. gcc/ada/ * libgnat/s-finpri.ads (Collection_Node): Move to private part. (Collection_Node_Ptr): Likewise. (Header_Alignment): Change to declaration and move completion to private part.

[COMMITTED 03/30] ada: Implement representation aspect Max_Entry_Queue_Length

2024-05-20 Thread Marc Poulhiès
From: Jose Ruiz Enforce Max_Entry_Queue_Length (and its synonym Max_Entry_Queue_Depth) when applied to individual protected entries. gcc/ada/ * exp_ch9.adb (Expand_N_Protected_Type_Declaration): Clarify comments. * sem_prag.adb (Analyze_Pragma): Check for duplicates

[COMMITTED 32/35] ada: Improve test for unprocessed preprocessor directives

2024-05-17 Thread Marc Poulhiès
From: Steve Baird Preprocessor directives are case insensitive and may have spaces or tabs between the '#' and the keyword. When checking for the error case of unprocessed preprocessor directives, take these rules into account. gcc/ada/ * scng.adb (scan): When checking for an

[COMMITTED 24/35] ada: Do not query the modification time of a special file.

2024-05-17 Thread Marc Poulhiès
From: Steve Baird In Ada.Directories, the function Modification_Time raises Name_Error if it is called for a special file. So don't do that in Start_Search_Internal. gcc/ada/ * libgnat/a-direct.adb (Start_Search_Internal): Do not call Modification_Time for a special file;

[COMMITTED 33/35] ada: Start the initialization of the tasking runtime earlier

2024-05-17 Thread Marc Poulhiès
From: Eric Botcazou This installs the tasking versions of the RTS_Lock manipulation routines very early, before the elaboration of all the Ada units of the program, including those of the runtime, because this elaboration may require the initialization of RTS_Lock objects. gcc/ada/ *

[COMMITTED 26/35] ada: Factor out duplicated code in bodies of System.Task_Primitives.Operations

2024-05-17 Thread Marc Poulhiès
From: Eric Botcazou The duplication is present in some POSIX-like implementations (POSIX and RTEMS) while it has already been eliminated in others (Linux, QNX). The latter implementations are also slightly modified for consistency's sake. No functional changes. gcc/ada/ *

[COMMITTED 31/35] ada: Restore dependency on System.OS_Interface in System.Task_Primitives

2024-05-17 Thread Marc Poulhiès
From: Eric Botcazou The dependency is relied upon by the binder to drag the tasking runtime. gcc/ada/ * libgnarl/s-taspri__mingw.ads: Add clause for System.OS_Interface. (Private_Data): Change type of Thread component. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED 30/35] ada: Further adjustments coming from aliasing considerations

2024-05-17 Thread Marc Poulhiès
From: Eric Botcazou They are needed on 32-bit platforms because of different calling conventions and again in the units implementing AltiVec and Streams support. gcc/ada/ * libgnat/g-alvevi.ads: Add pragma Universal_Aliasing for all the view types. *

[COMMITTED 21/35] ada: Fix others error message location

2024-05-17 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, the compiler pointed at the wrong component association when reporting an illegal occurrence of "others" in an aggregate. This patch fixes this by keeping track of which choice contains the occurrence of "others" when resolving array aggregates.

[COMMITTED 35/35] ada: Improve deriving initial sizes for container aggregates

2024-05-17 Thread Marc Poulhiès
From: Viljar Indus Deriving the initial size of container aggregates is necessary for deriving the correct capacity for bounded containers. Add support for deriving the correct initial size when the container aggregate is iterating over an array object. gcc/ada/ * exp_aggr.adb

[COMMITTED 25/35] ada: Fix for validity checking and conditional evaluation of 'Old

2024-05-17 Thread Marc Poulhiès
From: Piotr Trojanek Detection of expression that are "known on entry" (as defined in Ada 2022 RM 6.1.1(20/5)) was confused by validity checks when used from within expansion of attribute 'Old. gcc/ada/ * sem_util.adb (Is_Known_On_Entry): Handle constants introduced by validity

[COMMITTED 22/35] ada: Clarify code for aggregate warnings

2024-05-17 Thread Marc Poulhiès
From: Ronan Desplanques This patch improves comments in code that emits warnings about particular situations involving aggregates. It also removes a conjunct in a condition that's useless because always true in the context of the test. gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate):

[COMMITTED 23/35] ada: Disable Equivalent_Array_Aggregate optimization if predicates involved

2024-05-17 Thread Marc Poulhiès
From: Steve Baird In most paths, the function Build_Equivalent_Record_Aggregate was already testing Has_Predicates for a given component type and conditionally returning an Empty result. This is also needed in the case of a scalar component type. Without it, we can build corrupt trees that fail

[COMMITTED 20/35] ada: Expose utility routine for processing of Depends contracts in SPARK

2024-05-17 Thread Marc Poulhiès
From: Piotr Trojanek Routine Is_Unconstrained_Or_Tagged_Item is now used both in the GNAT frontend (for checking legality of Depends clauses) and in the GNATprove backend (for representing implicit inputs in flow graphs). gcc/ada/ * sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Move

[COMMITTED 14/35] ada: gnatbind-related cleanups

2024-05-17 Thread Marc Poulhiès
From: Bob Duff This patch cleans up some things noticed while working on gnatbind. No change in behavior yet. gcc/ada/ * ali-util.adb (Read_Withed_ALIs): Minor reformatting. * bindo-units.adb (Corresponding_Body): Add assert. (Corresponding_Spec): Likewise. *

[COMMITTED 18/35] ada: gnatbind: subprogram spec no longer exists

2024-05-17 Thread Marc Poulhiès
From: Bob Duff If a subprogram spec S is present while compiling something that says "with S;", but the spec is absent while compiling the body of S, then gnatbind fails to detect the mismatch. The spec and body of S might have different parameter and result types. This patch fixes gnatbind to

[COMMITTED 12/35] ada: Fix crash caused by missing New_Copy_tree

2024-05-17 Thread Marc Poulhiès
Since a recent refactor ("Factor common processing in expansion of aggregates") where Initialize_Array_Component and Initialize_Record_Component are merged, the behavior has slightly changed. In the case of the expansion of an aggregate initialization where the number of 'others' components is <=

[COMMITTED 15/35] ada: correction to gnatbind-related cleanups

2024-05-17 Thread Marc Poulhiès
From: Bob Duff Correction to previous change; Asserts had been moved to before Buf was initialized. gcc/ada/ * uname.adb (Get_Unit_Name_String): Move Asserts after Buf is initialized. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/uname.adb | 5 ++--- 1 file

[COMMITTED 29/35] ada: Replace spinlocks with fully-fledged locks in finalization collections

2024-05-17 Thread Marc Poulhiès
From: Eric Botcazou This replaces spinlocks with fully-fledged locks in finalization collections because the former are deemed problematic with tasks that can be preempted. Because of the requirement to avoid dragging the tasking runtime when it is not necessary, the implementation goes through

[COMMITTED 17/35] ada: Update docs for Resolve_Null_Array_Aggregate

2024-05-17 Thread Marc Poulhiès
From: Ronan Desplanques The documentation comments for Sem_Aggr.Resolve_Null_Array_Aggregate suggested that this subprogram created a subtype, which it didn't. This patch replaces those comments with ones that better match the behavior. gcc/ada/ * sem_aggr.adb

[COMMITTED 13/35] ada: Make raise-gcc.c compatible with Clang

2024-05-17 Thread Marc Poulhiès
From: Sebastian Poeplau The Morello variant of Clang doesn't have __builtin_code_address_from_pointer; work around it where necessary. gcc/ada/ * raise-gcc.c: Work around __builtin_code_address_from_pointer if it is unavailable. Tested on x86_64-pc-linux-gnu, committed on

[COMMITTED 09/35] ada: Simplify code for private types with unknown discriminants

2024-05-17 Thread Marc Poulhiès
From: Piotr Trojanek Private type entities have Is_Constrained set when they have no discriminants and no unknown discriminants; it is now set slightly later, but simpler (this change could only affect Process_Discriminants, but this flag should not be needed there). Also, we now reuse this

[COMMITTED 34/35] ada: Remove outdated workaround in aggregate expansion

2024-05-17 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, the compiler refrained from rewriting aggregates into purely positional form in some cases of one-component aggregates. As explained in comments, this was because the back end could not handle positional aggregates in those situations. As the back end

[COMMITTED 19/35] ada: Couple of adjustments coming from aliasing considerations

2024-05-17 Thread Marc Poulhiès
From: Eric Botcazou The first adjustment is to the expansion of implementation types for array types with peculiar index types, for which the aliased property set on the component of the original type must be copied; the implicit base type also needs to be properly marked if the implementation

[COMMITTED 10/35] ada: Only record types with discriminants can be unconstrained

2024-05-17 Thread Marc Poulhiès
From: Piotr Trojanek Remove redundant condition for detecting unconstrained record types. Code cleanup; behavior is unaffected. gcc/ada/ * sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Remove call to Has_Discriminants; combine ELSIF branches. Tested on x86_64-pc-linux-gnu,

[COMMITTED 16/35] ada: Fix containers' Reference_Preserving_Key functions' memory leaks

2024-05-17 Thread Marc Poulhiès
From: Steve Baird Fix memory leaks in containers' Reference_Preserving_Key functions Make the same change in each of 3 Ada.Containers child units: Ordered_Sets, Indefinite_Ordered_Sets, and Bounded_Ordered_Sets. The function Reference_Preserving_Key evaluates an allocator of type Key_Access

[COMMITTED 02/35] ada: Small cleanup in aggregate expansion code

2024-05-17 Thread Marc Poulhiès
From: Ronan Desplanques This patch moves a statement outside of a loop because it didn't need to be inside that loop. The behavior of the program is not affected. gcc/ada/ * exp_aggr.adb (Flatten): Small cleanup. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED 28/35] ada: Document secondary usage of Materialize_Entity flag

2024-05-17 Thread Marc Poulhiès
From: Eric Botcazou The flag is also used by the semantic analyzer. gcc/ada/ * einfo.ads (Materialize_Entity): Document secondary usage. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/einfo.ads | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git

[COMMITTED 08/35] ada: Allow private items with unknown discriminants as Depends inputs

2024-05-17 Thread Marc Poulhiès
From: Piotr Trojanek Objects of private types with unknown discriminants are now allowed as inputs in the Depends contracts. gcc/ada/ * sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Allow objects of private types with unknown discriminants. Tested on x86_64-pc-linux-gnu,

[COMMITTED 11/35] ada: Fix Constraint_Error on mutable assignment

2024-05-17 Thread Marc Poulhiès
From: Bob Duff For an assignment statement "X := Y;", where X is a formal parameter of a "late overriding" subprogram (i.e. it has no spec, and the body is overriding), and the subtype of X is an unconstrained record with defaulted discriminants, if the actual parameter passed to X is

[COMMITTED 03/35] ada: Remove superfluous Relocate_Node calls

2024-05-17 Thread Marc Poulhiès
From: Ronan Desplanques This patch removes two calls to Relocate_Node that were not needed. This does not affect the behavior of the compiler. gcc/ada/ * exp_ch4.adb (Expand_N_Case_Expression): Remove call to Relocate_Node. * sem_attr.adb (Analyze_Attribute): Likewise.

[COMMITTED 06/35] ada: Fix probable copy/paste error

2024-05-17 Thread Marc Poulhiès
gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst: Fix copy/paste. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst | 7 +++

[COMMITTED 27/35] ada: Bug in computing local restrictions inherited from enclosing scopes.

2024-05-17 Thread Marc Poulhiès
From: Steve Baird In the function Local_Restrict.Active_Restriction, we traverse enclosing scopes looking for a relevant Local_Restrictions aspect specification. Fix a bug in this traversal. gcc/ada/ * local_restrict.adb (Active_Restriction): When traversing scopes, do not skip

[COMMITTED 07/35] ada: Tune detection of unconstrained and tagged items in Depends contract

2024-05-17 Thread Marc Poulhiès
From: Piotr Trojanek The Tagged/Array/Record/Private types are mutually exclusive, so they can be examined like with a case statement (except for records with private extensions, but their handling is not affected by this change). gcc/ada/ * sem_prag.adb

[COMMITTED 05/35] ada: Check subtype to avoid a precondition failure

2024-05-17 Thread Marc Poulhiès
From: Viljar Indus gcc/ada/ * sem_ch3.adb (Analyze_Component_Declaration): Apply range checks only for Scalar_Types to ensure that they have the Scalar_Range attribute. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch3.adb | 5 +++-- 1 file

[COMMITTED 04/35] ada: Fix checking range constraints within composite types

2024-05-17 Thread Marc Poulhiès
From: Viljar Indus Subtype indications were never analyzed if they were within composite types. Analyze them explicitly within Analyze_Component_Declaration. gcc/ada/ * sem_ch3.adb (Analyze_Component_Declaration): Add Range_Checks for Subtype_Indications Tested on

[COMMITTED 01/35] ada: Add support for 'Object_Size to pragma Compile_Time_{Warning, Error}

2024-05-17 Thread Marc Poulhiès
From: Eric Botcazou With the same level as for 'Size, that is to say, full evaluation of the boolean expressions it may be contained in and handling of private types. gcc/ada/ * sem_attr.adb (Analyze_Attribute) : Remove special processing for pragma

[COMMITTED 35/35] ada: Remove obsolete reference in comment

2024-05-16 Thread Marc Poulhiès
From: Eric Botcazou gcc/ada/ * exp_ch7.adb (Attach_Object_To_Master_Node): Remove reference to a transient object in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch7.adb | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git

[COMMITTED 34/35] ada: Reset scope of top level object declaration during unnesting

2024-05-16 Thread Marc Poulhiès
When unnesting, the compiler gathers elaboration code and wraps it with a new dedicated procedure. While doing so, it resets the scopes of entities that are wrapped to point to this new procedure. This change also resets the scopes of N_Object_Declaration and N_Object_Renaming_Declaration nodes

[COMMITTED 33/35] ada: Redundant validity checks

2024-05-16 Thread Marc Poulhiès
From: Steve Baird In some cases with validity checking enabled via the -gnatVa option, the compiler generates validity checks that can (obviously) never fail. These include validity checks for (some) static expressions, and consecutive identical checks generated for a single read of an object.

[COMMITTED 32/35] ada: Exception on Indefinite_Vector aggregate with loop_parameter_specification

2024-05-16 Thread Marc Poulhiès
From: Gary Dismukes Constraint_Error is raised on evaluation of a container aggregate with a loop_parameter_specification for the type Indefinite_Vector. This happens due to the Aggregate aspect for type Indefinite_Vector specifying the Empty_Vector constant for the type's Empty operation rather

[COMMITTED 29/35] ada: Fix missing length checks with case expressions

2024-05-16 Thread Marc Poulhiès
From: Ronan Desplanques This fixes an issue where length checks were not generated when the right-hand side of an assigment involved a case expression. gcc/ada/ * sem_res.adb (Resolve_Case_Expression): Add length check insertion. * exp_ch4.adb

[COMMITTED 30/35] ada: Fix reference to RM clause in comment

2024-05-16 Thread Marc Poulhiès
From: Ronan Desplanques gcc/ada/ * sem_util.ads (Check_Function_Writable_Actuals): Fix comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.ads | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads

[COMMITTED 22/35] ada: No need to follow New_Occurrence_Of with Set_Etype

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Routine New_Occurrence_Of itself sets the Etype of its result; there is no need to set it explicitly afterwards. Code cleanup related to fix for attribute 'Old; semantics is unaffected. gcc/ada/ * exp_ch13.adb (Expand_N_Free_Statement): After analysis, the

[COMMITTED 28/35] ada: Fix standalone Windows builds of adaint.c

2024-05-16 Thread Marc Poulhiès
From: Sebastian Poeplau Define PATH_SEPARATOR and HOST_EXECUTABLE_SUFFIX in standalone MinGW builds; the definitions normally come from GCC, and the defaults don't work for native Windows. gcc/ada/ * adaint.c: New defines for STANDALONE mode. Tested on x86_64-pc-linux-gnu, committed

[COMMITTED 24/35] ada: Propagate Program_Error from failed finalization of collection

2024-05-16 Thread Marc Poulhiès
From: Eric Botcazou This aligns finalization collections with finalization masters when it comes to propagating an exception raised by the finalization of a specific object, by always propagating Program_Error instead of the aforementioned exception. gcc/ada/ * libgnat/s-finpri.adb

[COMMITTED 18/35] ada: Fixup one more pattern of broken scope information

2024-05-16 Thread Marc Poulhiès
When an array's initialization contains a `others =>` clause with an expression that involves finalization, the resulting scope information is incorrect and can cause crashes with backend (i.e. gnat-llvm) that also use unnesting. The observable symptom is a nested object declaration (created by

[COMMITTED 27/35] ada: Avoid checking parameters of protected procedures

2024-05-16 Thread Marc Poulhiès
From: Viljar Indus The compiler triggers warnings on generated protected procedures if the procedure does not have an explicit spec. Instead check if the body was created for a protected procedure if the spec is not present. gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Body_Helper):

[COMMITTED 26/35] ada: Ignore ghost nodes in call graph information for dispatching calls

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek When emitting call graph information, we already skipped calls to ignored ghost entities, but this code was causing crashes (in production builds) and assertion failures (in development builds), because the ignored ghost entities are not fully decorated, e.g. when they come

[COMMITTED 19/35] ada: Minor performance improvement for dynamically-allocated controlled objects

2024-05-16 Thread Marc Poulhiès
From: Eric Botcazou The values returned by Header_Alignment and Header_Size are known at compile time and powers of two on almost all platforms, so inlining them by means of an expression function improves the object code generated for alignment and size calculations involving them. gcc/ada/

[COMMITTED 25/35] ada: Fix reason code for length check

2024-05-16 Thread Marc Poulhiès
From: Ronan Desplanques This patch fixes the reason code used by Apply_Selected_Length_Checks, which was wrong in some cases when the check could be determined to always fail at compile time. gcc/ada/ * checks.adb (Apply_Selected_Length_Checks): Fix reason code. Tested on

[COMMITTED 11/35] ada: Follow up fixes for Put_Image/streaming regressions

2024-05-16 Thread Marc Poulhiès
From: Steve Baird A recent change to reduce duplication of compiler-generated Put_Image and streaming subprograms introduced some regressions. The fix for one of them was incomplete. gcc/ada/ * exp_attr.adb (Build_And_Insert_Type_Attr_Subp): Further tweaking of the point where

[COMMITTED 14/35] ada: Fix bogus error on function returning noncontrolling result in private part

2024-05-16 Thread Marc Poulhiès
From: Eric Botcazou This occurs in the additional case of RM 3.9.3(10) in Ada 2012, that is to say the access controlling result, because the implementation does not use the same (correct) conditions as in the original case. This factors out these conditions and uses them in both cases, as well

[COMMITTED 16/35] ada: Fix latent alignment issue for dynamically-allocated controlled objects

2024-05-16 Thread Marc Poulhiès
From: Eric Botcazou Dynamically-allocated controlled objects are attached to a finalization collection by means of a hidden header placed right before the object, which means that the size effectively allocated must naturally account for the size of this header. But the allocation must also

[COMMITTED 21/35] ada: Fix detection of if_expressions that are known on entry

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Fix a small glitch in routine Is_Known_On_Entry, which returned False for all if_expressions, regardless whether their conditions or dependent expressions are known on entry. gcc/ada/ * sem_util.adb (Is_Known_On_Entry): Check whether condition and dependent

[COMMITTED 07/35] ada: Remove Aspect_Specifications field from N_Procedure_Specification

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Sync Has_Aspect_Specifications_Flag with the actual flags in the AST. Code cleanup; behavior is unaffected. gcc/ada/ * gen_il-gen-gen_nodes.adb (N_Procedure_Specification): Remove Aspect_Specifications field. Tested on x86_64-pc-linux-gnu, committed on

[COMMITTED 12/35] ada: Fix crash with -gnatdJ and -gnatw_q

2024-05-16 Thread Marc Poulhiès
From: Ronan Desplanques This commit makes the emission of -gnatw_q warnings pass node information so as to handle the enclosing subprogram display of -gnatdJ instead of crashing. gcc/ada/ * exp_ch4.adb (Expand_Composite_Equality): Call Error_Msg_N instead of Error_Msg. Tested

[COMMITTED 20/35] ada: Fix comments about Get_Ranged_Checks

2024-05-16 Thread Marc Poulhiès
From: Ronan Desplanques Checks.Get_Ranged_Checks was onced named Range_Check, and a few comments referred to it by that name before this commit. To avoid confusion with Types.Range_Check, this commits fixes those comments. gcc/ada/ * checks.ads: Fix comments. * checks.adb:

[COMMITTED 23/35] ada: Improve recovery from illegal occurrence of 'Old in if_expression

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Fix assertion failure in developer builds which happened when the THEN expression contains an illegal occurrence of 'Old and the type of the THEN expression is left as Any_Type, but there is no ELSE expression. gcc/ada/ * sem_ch4.adb (Analyze_If_Expression): Add

[COMMITTED 15/35] ada: Fix resolving tagged operations in array aggregates

2024-05-16 Thread Marc Poulhiès
From: Viljar Indus In the Two_Pass_Aggregate_Expansion we were removing all of the entity links in the Iterator_Specification to avoid reusing the same Iterator_Definition in both loops. However this approach was also breaking the links to calls with dot notation that had been transformed to

[COMMITTED 06/35] ada: Reuse existing expression when rewriting aspects to pragmas

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Specification): Consistently reuse existing constant where possible. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch13.adb | 10 +- 1 file

[COMMITTED 09/35] ada: Formal_Derived_Type'Size is not static

2024-05-16 Thread Marc Poulhiès
From: Steve Baird In deciding whether a Size attribute reference is static, the compiler could get confused about whether an implicitly-declared subtype of a generic formal type is itself a generic formal type, possibly resulting in an assertion failure and then a bugbox. gcc/ada/ *

[COMMITTED 13/35] ada: Fix casing of CUDA in error messages

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Error messages now capitalize CUDA. gcc/ada/ * erroutc.adb (Set_Msg_Insertion_Reserved_Word): Fix casing for CUDA appearing in error message strings. (Set_Msg_Str): Likewise for CUDA being a part of a Name_Id. Tested on x86_64-pc-linux-gnu,

[COMMITTED 17/35] ada: Fix typo in CUDA error message

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Fix typo in error message; semantics is unaffected. gcc/ada/ * gnat_cuda.adb (Remove_CUDA_Device_Entities): Fix typo. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gnat_cuda.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[COMMITTED 10/35] ada: Implement per-finalization-collection spinlocks

2024-05-16 Thread Marc Poulhiès
From: Eric Botcazou This changes the implementation of finalization collections from using the global task lock to using per-collection spinlocks. Spinlocks are a good fit in this context because they are very cheap and therefore can be taken with a fine granularity only around the portions of

[COMMITTED 03/35] ada: Fix ordering of code for pragma Preelaborable_Initialization

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Move case alternative to match to alphabetic order. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 160 +-- 1 file changed, 80

[COMMITTED 08/35] ada: Fix bug in maintaining dimension info

2024-05-16 Thread Marc Poulhiès
From: Steve Baird Copying a node does not automatically propagate its associated dimension information (if any). This must be done explicitly. gcc/ada/ * sem_util.adb (Copy_Node_With_Replacement): Add call to Copy_Dimensions so that any dimension information associated with

[COMMITTED 04/35] ada: Fix alphabetic ordering of aspect identifiers

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup. gcc/ada/ * aspects.ads (Aspect_Id): Fix ordering. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/aspects.ads | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads index

[COMMITTED 05/35] ada: Cleanup reporting locations for Ada 2022 and GNAT extension aspects

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Specification): Consistently reuse existing constant where possible. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch13.adb | 10 +- 1 file

[COMMITTED 01/35] ada: Fix docs and comments about pragmas for Boolean-valued aspects

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Fix various inconsistencies in documentation and comments of Boolean-valued aspects. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Fix documentation. * sem_prag.adb: Fix comments. * gnat_rm.texi: Regenerate. Tested on

[COMMITTED 02/35] ada: Fix casing in error messages

2024-05-16 Thread Marc Poulhiès
From: Piotr Trojanek Error messages should not start with a capital letter. gcc/ada/ * gnat_cuda.adb (Remove_CUDA_Device_Entities): Fix casing (this primarily fixes a style, because the capitalization will not be preserved by the error-reporting machinery anyway).

[COMMITTED] ada: Fix classification of SPARK Boolean aspects

2024-05-14 Thread Marc Poulhiès
From: Piotr Trojanek The implementation of User_Aspect_Definition uses subtype Boolean_Aspects to decide which existing aspects can be used to define old aspects. This subtype didn't include many of the SPARK aspects, notably the Always_Terminates. gcc/ada/ * aspects.ads (Aspect_Id,

[COMMITTED] ada: Document more details of the implementation of finalization chains

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou gcc/ada/ * exp_ch7.adb (Finalization Management): Add a short description of the implementation of finalization chains. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch7.adb | 29 + 1 file changed, 29

[COMMITTED] ada: Follow up fixes for Put_Image/streaming regressions

2024-05-14 Thread Marc Poulhiès
From: Steve Baird A recent change to reduce duplication of compiler-generated Put_Image and streaming subprograms introduced two regressions. One is yet another of the many cases where generating these routines "on demand" (as opposed at the point of the associated type declaration) requires

[COMMITTED] ada: Fix crash with -gnatdJ and -gnatw.w

2024-05-14 Thread Marc Poulhiès
From: Ronan Desplanques This patch fixes a crash when -gnatdJ is enabled and a warning must be emitted about an ineffective pragma Warnings clause. Some modifications are made to the specific warnings machinery so that warnings carry the ID of the pragma node they're about, so the -gnatdJ

[COMMITTED] ada: Decouple attachment from dynamic allocation for controlled objects

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou This decouples the attachment to the appropriate finalization collection of dynamically allocated objects that need finalization from their allocation. The current implementation immediately attaches them after allocating them, which means that they will be finalized even if

[COMMITTED] ada: Fix pragma Warnings and -gnatD interaction

2024-05-14 Thread Marc Poulhiès
From: Ronan Desplanques A recent change broke pragma Warnings when -gnatD is enabled in some cases. This patch fixes this by caching more slocs at times when it's known that they haven't been modified by -gnatD. gcc/ada/ * errout.adb (Validate_Specific_Warnings): Adapt to record

[COMMITTED] ada: Fix typo in diagnostic message

2024-05-14 Thread Marc Poulhiès
From: Ronan Desplanques A previous change introduced an error in the diagnostic message about overlapping actuals. This commit fixes this. gcc/ada/ * sem_warn.adb (Warn_On_Overlapping_Actuals): Fix typo. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_warn.adb |

[COMMITTED] ada: Fix crash with -gnatdJ and -gnatyz

2024-05-14 Thread Marc Poulhiès
From: Ronan Desplanques This patch makes it so -gnatyz style checks reports specify a node ID. That is required since those checks are sometimes made during semantic analysis of short-circuit operators, where the Current_Node mechanism that -gnatdJ uses is not operational.

[COMMITTED] ada: Fix pragma Compile_Time_Error and -gnatdJ crash

2024-05-14 Thread Marc Poulhiès
From: Ronan Desplanques This patch makes it so the diagnostics coming from occurrences of pragma Compile_Time_Error and Compile_Time_Warning are emitted with a node parameter so they don't cause a crash when -gnatdJ is enabled. gcc/ada/ * errout.ads (Error_Msg): Add node parameter.

[COMMITTED] ada: Fix crash with -gnatdJ and JSON output

2024-05-14 Thread Marc Poulhiès
From: Ronan Desplanques This patch tweaks the calls made to Errout subprograms to report violations of dependence restrictions, in order fix a crash that occurred with -gnatdJ and -fdiagnostics-format=json. gcc/ada/ * restrict.adb (Violation_Of_No_Dependence): Tweak error

[COMMITTED] ada: Replace "not Present" tests with "No".

2024-05-14 Thread Marc Poulhiès
From: Steve Baird Fix constructs that were flagged by CodePeer. gcc/ada/ * exp_attr.adb: Replace 6 "not Present" tests with equivalent calls to "No". Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_attr.adb | 12 ++-- 1 file changed, 6 insertions(+), 6

[COMMITTED] ada: Fix warning indicators in usage string

2024-05-14 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, the default status of -gnatw.i and -gnatw.d are reported incorrectly in the usage string used throughout GNAT tools. This patch fixes this. gcc/ada/ * usage.adb (Usage): Fix enabled-by-default indicators. Tested on x86_64-pc-linux-gnu,

[COMMITTED] ada: Minor typo fix in comment

2024-05-14 Thread Marc Poulhiès
gcc/ada/ * sem_util.adb: Typo fix in comment. * exp_aggr.adb: Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_aggr.adb | 2 +- gcc/ada/sem_util.adb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/ada/exp_aggr.adb

[COMMITTED] ada: Follow-up adjustment after fix to Default_Initialize_Object

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou Now that Default_Initialize_Object honors the No_Initialization flag in all cases, objects of an access type declared without initialization expression can no longer be considered as being automatically initialized to null. gcc/ada/ * exp_ch3.adb

[COMMITTED] ada: Restore default size for dynamic allocations of discriminated type

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou The allocation strategy for objects of a discriminated type with defaulted discriminants is not the same when the allocation is dynamic as when it is static (i.e a declaration): in the former case, the compiler allocates the default size whereas, in the latter case, it

[COMMITTED] ada: Better error message for bad general case statements

2024-05-14 Thread Marc Poulhiès
From: Steve Baird If -gnatX0 is specified, we allow case statements with a selector expression of a record or array type, but not of a private type. If the selector expression is of a private type then we should generate an appropriate error message instead of a bugbox. gcc/ada/ *

[COMMITTED] ada: Small cleanup about allocators and aggregates

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou This eliminates a few oddities present in the expander for allocators and aggregates present in allocators: - Convert_Array_Aggr_In_Allocator takes both a Decl and Alloc parameters, and inserts new code before Alloc for records and after Decl for arrays through

[COMMITTED] ada: Fix overlap warning suppression

2024-05-14 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, some warnings about overlapping actuals were emitted regardless of the Value of Warnsw.Warnings_Package.Warn_On_Overlap. This patch fixes this. gcc/ada/ * sem_warn.adb (Warn_On_Overlapping_Actuals): Stop ignoring warning suppression

[COMMITTED] ada: Reduce generated code duplication for streaming and Put_Image subprograms

2024-05-14 Thread Marc Poulhiès
From: Steve Baird In the case of an untagged composite type, the compiler does not generate streaming-related subprograms or a Put_Image procedure when the type is declared. Instead, these subprograms are declared "on demand" when a corresponding attribute reference is encountered. In this case,

[COMMITTED] ada: Fix crash with -gnatdJ and -gnatf

2024-05-14 Thread Marc Poulhiès
From: Ronan Desplanques This patch fixes a crash when the compiler emits a warning about an unchecked conversion and -gnatdJ is enabled. gcc/ada/ * sem_ch13.adb (Validate_Unchecked_Conversions): Add node parameters to Error_Msg calls. Tested on x86_64-pc-linux-gnu, committed

<    1   2   3   4   5   6   7   8   9   10   >