[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

[COMMITTED] ada: Rtsfind should not trash state used in analyzing instantiations.

2024-05-14 Thread Marc Poulhiès
From: Steve Baird During analysis of an instantiation, Sem_Ch12 manages formal/actual binding information in package state (see Sem_Ch12.Generic_Renamings_HTable). A call to rtsfind can cause another unit to be loaded and compiled. If this occurs during the analysis of an instantiation, and if

[COMMITTED] ada: Compiler crash or errors on if_expression in container aggregate

2024-05-14 Thread Marc Poulhiès
From: Gary Dismukes The compiler may either crash or incorrectly report errors when a component association in a container aggregate is an if_expression with an elsif part whose dependent expression is a call to a function returning a result that requires finalization. The compiler complains

[COMMITTED] ada: Error in determining accumulator subtype for a reduction expression

2024-05-14 Thread Marc Poulhiès
From: Steve Baird There was an earlier bug in determining the accumulator subtype for a reduction expression in the case where the reducer subprogram is overloaded. The fix for that bug introduced a recently-discovered regression. Redo accumulator subtype computation in order to address this

[COMMITTED] ada: Missing support for consistent assertion policy

2024-05-14 Thread Marc Poulhiès
From: Javier Miranda Add missing support for RM 10.2/5: the region for a pragma Assertion_Policy given as a configuration pragma is the declarative region for the entire compilation unit (or units) to which it applies. gcc/ada/ * sem_ch10.adb (Install_Inherited_Policy_Pragmas): New

[COMMITTED] ada: Fix small inaccuracy in previous change

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou The call to Build_Allocate_Deallocate_Proc must occur before the special accessibility check for class-wide allocation is generated, because this check comes with cleanup code. gcc/ada/ * exp_ch4.adb (Expand_Allocator_Expression): Move the first call to

[COMMITTED] ada: Fix ghost policy in use for generic instantiation

2024-05-14 Thread Marc Poulhiès
From: Yannick Moy The Ghost assertion policy relevant for analyzing a generic instantiation is the Ghost policy at the point of instantiation, not the one applicable for the generic itself. gcc/ada/ * ghost.adb (Mark_And_Set_Ghost_Instantiation): Fix the current Ghost policy

[COMMITTED] ada: Spurious unreferenced warning on selected component

2024-05-14 Thread Marc Poulhiès
From: Justin Squirek This patch fixes an error in the compiler whereby a selected component on the left hand side of an assignment statement may not get marked as referenced - leading to spurious unreferenced warnings on such objects. gcc/ada/ * sem_util.adb (Set_Referenced_Modified):

[COMMITTED] ada: Follow-up adjustment to earlier fix in Build_Allocate_Deallocate_Proc

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou The profile of the procedure built for an allocation on the secondary stack now includes the alignment parameter, so the parameter can just be forwarded in the call to Allocate_Any_Controlled. gcc/ada/ * exp_util.adb (Build_Allocate_Deallocate_Proc): Pass the

[COMMITTED] ada: Correct System.Win32.LocalFileTimeToFileTime wrapper typo

2024-05-14 Thread Marc Poulhiès
From: Philippe Gil The parameters should be swapped to fit Fileapi.h documentation. BOOL LocalFileTimeToFileTime( [in] const FILETIME *lpLocalFileTime, [out] LPFILETIME lpFileTime ); gcc/ada/ * libgnat/s-win32.ads (LocalFileTimeToFileTime): Swap parameters. Tested

[COMMITTED] ada: Update of SPARK RM legality rules on ghost code

2024-05-14 Thread Marc Poulhiès
From: Yannick Moy Update checking of ghost code after a small change in SPARK RM rules 6.9(15) and 6.9(20), so that the Ghost assertion policy that matters when checking the validity of a reference to a ghost entity in an assertion expression is the Ghost assertion policy at the point of

[COMMITTED] ada: Factor out implementation of default initialization for objects

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou As written down in a comment, "There is a *huge* amount of code duplication" in the implementation of default initializaion for objects in the front-end, between the (static) declaration case and the dynamic allocation case. This change factors out the implementation of the

[COMMITTED] ada: Fix double finalization for dependent expression of case expression

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou The recent fix to Default_Initialize_Object, which has ensured that the No_Initialization flag set on an object declaration, for example for the temporary created by Expand_N_Case_Expression, is honored in all cases, has also uncovered a latent issue in the machinery

[COMMITTED] ada: Small fix to Default_Initialize_Object

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou Unlike what is assumed in other parts of the front-end, some objects created with No_Initialization set on their declaration may end up being initialized with a default value. gcc/ada/ * exp_ch3.adb (Default_Initialize_Object): Return immediately when either

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

2024-05-14 Thread Marc Poulhiès
From: Ronan Desplanques The crash this patch fixes happened because calling the Errout.Error_Msg procedures that don't have an N parameter is not allowed when not parsing and -gnatdJ is on. And -gnatyB style checks are not emitted during parsing but during semantic analysis. This commit moves

[COMMITTED] ada: Small fix to printing of raise statements

2024-05-14 Thread Marc Poulhiès
From: Eric Botcazou The Name is optional on these nodes and a superflous space is printed if it is not present on them. gcc/ada/ * sprint.adb (Sprint_Node_Actual) : Be prepared for an empty Name. : Likewise. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: Attributes Put_Image and Object_Size are defined by Ada 2022

2024-05-13 Thread Marc Poulhiès
From: Piotr Trojanek Recognize references to attributes Put_Image and Object_Size as language-defined in Ada 2022 and implementation-defined in earlier versions of Ada. Other attributes listed in Ada 2022 RM, K.2 and currently implemented in GNAT are correctly categorized. This change only

[COMMITTED] ada: Fix crash on Compile_Time_Warning in dead code

2024-05-13 Thread Marc Poulhiès
From: Bob Duff If a pragma Compile_Time_Warning triggers, and the pragma is later removed because it is dead code, then the compiler can return a bad exit code. This causes gprbuild to report "*** compilation phase failed". This is because Total_Errors_Detected, which is declared as Nat, goes

[COMMITTED] ada: Refine type of a local variable

2024-05-13 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * sem_util.adb (Has_No_Output): Iteration with First_Formal/Next_Formal involves Entity_Ids. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 2 +- 1 file changed, 1

[COMMITTED] ada: Remove code that expected pre/post being split into conjuncts

2024-05-13 Thread Marc Poulhiès
From: Piotr Trojanek The removed code is no longer needed (and causes assertion failures). Most likely it should have been using the Split_PPC flag. gcc/ada/ * sem_util.adb (Is_Potentially_Unevaluated): Remove code for recovering the original structure of expressions with AND

[COMMITTED] ada: Revert recent change for Put_Image and Object_Size attributes

2024-05-13 Thread Marc Poulhiès
From: Piotr Trojanek Recent change for attribute Object_Size caused spurious errors when restriction No_Implementation_Attributes is active and attribute Object_Size is introduced by expansion of dispatching operations. Temporarily revert that change for a further investigation. gcc/ada/

[COMMITTED] ada: Refactor repeated code for querying Boolean-valued aspects

2024-05-13 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup following a fix for aspect Exclusive_Functions; semantics is unaffected. gcc/ada/ * exp_ch9.adb (Build_Protected_Subprogram_Body, Build_Protected_Subprogram_Call_Cleanup): Reuse refactored routine. * sem_util.adb

[COMMITTED] ada: Remove dynamic frame in System.Image_D and document it in System.Image_F

2024-05-13 Thread Marc Poulhiès
From: Eric Botcazou The former can easily be removed while the latter cannot. gcc/ada/ * libgnat/s-imaged.ads (System.Image_D): Add Uns formal parameter. * libgnat/s-imaged.adb: Add with clauses for System.Image_I, System.Value_I_Spec and System.Value_U_Spec.

[COMMITTED] ada: Remove guards against traversal of empty list of aspects

2024-05-13 Thread Marc Poulhiès
From: Piotr Trojanek When iterating over Aspect_Specifications, we can use First/Next directly even if the Aspect_Specifications returns a No_List or the list has no items. Code cleanup. gcc/ada/ * aspects.adb (Copy_Aspects): Style fix. * contracts.adb (Analyze_Contracts):

[COMMITTED] ada: Deconstruct unused flag Is_Expanded_Contract

2024-05-13 Thread Marc Poulhiès
From: Piotr Trojanek Flag Is_Expanded_Contract was introduced together with N_Contract field (when implementing freezing of contracts), but was never actually used. gcc/ada/ * gen_il-fields.ads (Opt_Field_Enum): Remove Is_Expanded_Contract from the list of flags. *

[COMMITTED] ada: Move Init_Proc_Level_Formal from Exp_Ch3 to Exp_Util

2024-05-13 Thread Marc Poulhiès
From: Eric Botcazou This makes it possible to remove clauses from the Accessibility package. gcc/ada/ * accessibility.adb: Remove clauses for Exp_Ch3. * exp_ch3.ads (Init_Proc_Level_Formal): Move declaration to... * exp_ch3.adb (Init_Proc_Level_Formal): Move body to...

[COMMITTED] ada: Move splitting of pre/post aspect expressions to expansion

2024-05-13 Thread Marc Poulhiès
From: Piotr Trojanek We split expressions of pre/post aspects into individual conjuncts and emit messages with their precise location when they fail at runtime. This was done when processing the aspects and caused inefficiency when the original expression had to be recovered to detects uses of

[COMMITTED] ada: Complete implementation of Ada 2022 aspect Exclusive_Functions

2024-05-13 Thread Marc Poulhiès
From: Piotr Trojanek Extend implementation of RM 9.5.1(7/4), which now applies also to protected function if the protected type has aspect Exclusive_Functions. gcc/ada/ * exp_ch9.adb (Build_Protected_Subprogram_Call_Cleanup): If aspect Exclusive_Functions is present then the

[COMMITTED] ada: Deconstruct flag Split_PPC since splitting now is done in expansion

2024-05-13 Thread Marc Poulhiès
From: Piotr Trojanek Remove flag Split_PPC and all its uses. gcc/ada/ * contracts.adb (Append_Enabled_Item): Remove use of Split_PPC; simplify. * gen_il-fields.ads (Opt_Field_Enum): Remove flag definition. * gen_il-gen-gen_nodes.adb (N_Aspect_Specification,

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