[COMMITTED 25/30] ada: Factorize some duplicate code

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques Process_Subtype can be passed either a subtype indication or a subtype mark. Before this patch, it branched directly depending on the kind of the argument, but there actually was processing common to the two branches like resolving the subtype mark. This patch factorizes t

[COMMITTED 20/30] ada: Fix fallout of latest change

2025-06-10 Thread Marc Poulhiès
From: Eric Botcazou Freeze_Static_Object needs to deal with the objects that have been created by Insert_Conditional_Object_Declaration. gcc/ada/ChangeLog: * freeze.adb (Freeze_Static_Object): Do not issue any error message for compiler-generated entities. Tested on x86_64-pc-l

[COMMITTED 30/30] ada: Generic formal objects have no entry components

2025-06-10 Thread Marc Poulhiès
From: Piotr Trojanek AST field Entry_Component doesn't make sense for generic formal objects and was never used there. Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * gen_il-gen-gen_entities.adb (Formal_Object_Kind): Remove Entry_Component field. Tested on x86_64-pc-

[COMMITTED 29/30] ada: Remove redundant guard against attribute with no expressions

2025-06-10 Thread Marc Poulhiès
From: Piotr Trojanek We intentionally allow First to work on No_List, so there is no need to guard against a No_List. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_attr.adb (Resolve_Attribute): Remove redundant guard. Tested on x86_64-pc-linux-gnu, committed on master

[COMMITTED 23/30] ada: Error on subtype with static predicate used in case_expression

2025-06-10 Thread Marc Poulhiès
From: Gary Dismukes The compiler improperly flags an error on the use of a subtype with a static predicate as a choice in a case expression alternative, complaining that the subtype has a nonstatic predicate. The fix for this is to add a test for the subtype not having a static predicate. gcc/ad

[COMMITTED 26/30] ada: Do not install the support files of 128-bit types on 32-bit targets

2025-06-10 Thread Marc Poulhiès
From: Eric Botcazou The files are not compiled into libgnat.a but are nevertheless installed in the adainclude directory, which is unwanted. gcc/ada/ChangeLog: * Makefile.rtl (ADA_EXCLUDE_SRCS): Add the 128-bit support files. Tested on x86_64-pc-linux-gnu, committed on master. --- gc

[COMMITTED 28/30] ada: Minor comment tweak

2025-06-10 Thread Marc Poulhiès
From: Eric Botcazou This replaces a couple of occurrences of "function" by "subprogram". gcc/ada/ChangeLog: * inline.adb (Analyze_Inlined_Bodies): Minor comment tweak. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/inline.adb | 6 +++--- 1 file changed, 3 insertions(

[COMMITTED 27/30] ada: Small cleanup in instantiation of generic bodies

2025-06-10 Thread Marc Poulhiès
From: Eric Botcazou This removes the code dealing with generic main units from the body of the instantiation routine, namely Instantiate_Bodies, and replaces it by tests done earlier in the processing. The test added to Need_Subprogram_Instance_Body is already present in the twin predicate Needs

[COMMITTED 21/30] ada: Move Check_Discriminant_Conformance to Sem_Ch3

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques Check_Discriminant_Conformance is really only about concepts defined in chapter 3 of the Ada reference manual, so it fits better in Sem_Ch3 than in Sem_Ch6. gcc/ada/ChangeLog: * sem_ch6.adb, sem_ch6.ads (Check_Discriminant_Conformance): Move to … * sem_ch

[COMMITTED 12/30] ada: Simplify Constrain_Array

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, Constrain_Array had a feature where it could be passed Empty for the first actual and would then create an Itype itself. There was only one use of this feature and it was unnecessary, so this patch removes it. gcc/ada/ChangeLog: * sem_ch3.adb (

[COMMITTED 09/30] ada: Fix the detection of configuration pragmas

2025-06-10 Thread Marc Poulhiès
From: Viljar Indus Some pragma nodes like the ones for Assertion_Policy are replaced by a Null_Statement. This is not taken into account when analyzing if the pragma is a configuration pragma. gcc/ada/ChangeLog: * sem_prag.adb (Is_Configuration_Pragma): Check that nodes precedin

[COMMITTED 18/30] ada: Fix wrong initialization of library-level object by conditional expression

2025-06-10 Thread Marc Poulhiès
From: Eric Botcazou The previous fix was not robust enough in the presence of transient scopes. gcc/ada/ChangeLog: * exp_ch4.adb (Insert_Conditional_Object_Declaration): Deal with a transient scope being created around the declaration. * freeze.adb (Freeze_Entity): Do no

[COMMITTED 14/30] ada: Fix omission in comment

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques gcc/ada/ChangeLog: * sem_ch3.adb (Find_Type_Of_Object): Fix comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch3.adb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb inde

[COMMITTED 24/30] ada: VAST found bug: Itypes with Parent

2025-06-10 Thread Marc Poulhiès
From: Bob Duff Fix the comment about Itypes, so the Parent field is no longer required. Change VAST to no longer require it. Remove Check_Itype_Parents from Check_Enum; it can no longer fail, so there's no point in making it switchable. gcc/ada/ChangeLog: * einfo.ads (Associated_Node_F

[COMMITTED 22/30] ada: Special case for inconsistent pointer in Scan_Raw_Unsigned

2025-06-10 Thread Marc Poulhiès
From: Tonu Naks gcc/ada/ChangeLog: * libgnat/s-valueu.adb: add explict raise * libgnat/s-valueu.ads: update annotation Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/s-valueu.adb | 9 + gcc/ada/libgnat/s-valueu.ads | 8 +++- 2 files changed

[COMMITTED 19/30] ada: VAST: treewalker improvements

2025-06-10 Thread Marc Poulhiès
From: Bob Duff Implement two basic checks: Check that N_Error nodes cannot appear in the tree (because VAST is not called when the source is illegal). Check that every node has a parent, except for certain nodes where we check the opposite. (We do not yet check that the parent pointers actually p

[COMMITTED 16/30] ada: VAST: create treewalker

2025-06-10 Thread Marc Poulhiès
From: Bob Duff Walks all trees (not just the main unit), deals with switches and flags. Doesn't check much of anything yet (asserts that "unused" nodes are not present). Move decisions (what tree(s) to check, what switches enable checking) from the caller to the body of VAST. gcc/ada/ChangeLog:

[COMMITTED 07/30] ada: Add Incomplete_Type_OK formal to Process_Subtype

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, Process_Subtype looked at the parent of its argument to determine whether it was called in a context where it was OK for the subtype mark to refer to the incomplete view of a type. This patch adds a new formal so that it becomes the responsibility of the

[COMMITTED 17/30] ada: Fix inconsistent comment for fixed-point Value attribute implementation

2025-06-10 Thread Marc Poulhiès
From: Eric Botcazou The comment incorrectly mentions decimal fixed point. gcc/ada/ChangeLog: * libgnat/s-vafi32.ads: Fix head description. * libgnat/s-vafi64.ads: Likewise. * libgnat/s-vafi128.ads: Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/

[COMMITTED 11/30] ada: Fix infinite loop with aggregate in generic unit

2025-06-10 Thread Marc Poulhiès
From: Eric Botcazou Root_Type does not return the same type for the private and the full view of a derived private tagged type when both derive from an interface type. gcc/ada/ChangeLog: * sem_ch12.adb (Copy_Generic_Node): Do not call Root_Type to find the root type of an aggreg

[COMMITTED 08/30] ada: Fix Value_Decimal to raise Constraint_Error on boundary values

2025-06-10 Thread Marc Poulhiès
From: Eric Botcazou Even though the issue is not user-visible, it's a (minor) departure from the specification of the procedure. gcc/ada/ChangeLog: * libgnat/s-valued.adb (Integer_to_Decimal): Add Extra parameter and use its value to call Bad_Value on boundary values. (S

[COMMITTED 13/30] ada: Rename constant in Analyze_Component_Declaration

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques "Typ" is typically used to name constants that are entity IDs for types. Before this patch, a constant local to Analyze_Component_Declaration designating a syntactic subtype indication had that name. This patch renames it to "Ind". Code cleanup; behavior is unaffected. g

[COMMITTED 10/30] ada: Fix use-after-free in Compute_All_Tasks

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques This patch fixes a bug in System.Stack_Usage.Tasking.Compute_All_Tasks where it would attempt to read the stack of threads that had already completed. gcc/ada/ChangeLog: * libgnarl/s-stusta.adb (Compute_All_Tasks): Skip terminated tasks. Tested on x86_64-pc-linu

[COMMITTED 15/30] ada: Storage_Error on Ordered_Maps container aggregate with enumeration Key_Type

2025-06-10 Thread Marc Poulhiès
From: Gary Dismukes The compiler fails with a Storage_Error when compiling a container aggregate for a Map type coming from an instantiation of Ada.Containers.Ordered_Maps that specifies an enumeration type for the Key_Type formal. gcc/ada/ChangeLog: * exp_aggr.adb (Build_Container_Aggr

[COMMITTED 02/30] ada: Add assertion on expanded code in particular case

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques This patch adds an assertion that checks that expanded code does not contain erroneous access subtype definitions. gcc/ada/ChangeLog: * sem_ch3.adb (Process_Subtype): Add assertion. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch3.adb |

[COMMITTED 03/30] ada: Tweak formatting in Process_Subtype

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques This patch removes parentheses and vertical alignment that misleadingly suggested the presence of function calls where there weren't any. gcc/ada/ChangeLog: * sem_ch3.adb (Process_Subtype): Tweak formatting. Tested on x86_64-pc-linux-gnu, committed on master. -

[COMMITTED 04/30] ada: Remove outdated comment about reused entity fields

2025-06-10 Thread Marc Poulhiès
From: Piotr Trojanek With the current representation of GNAT AST the entity fields are not reused. gcc/ada/ChangeLog: * einfo.ads (Overridden_Operation, Static_Initialization): Remove comments about a reused entity field. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED 01/30] ada: Factorize initialization of local variable

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques gcc/ada/ChangeLog: * sem_ch3.adb (Process_Subtype): Factorize initialization of variable. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch3.adb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/ada/sem_ch3.adb b/gc

[COMMITTED 06/30] ada: Fix recursive call in Process_Subtype

2025-06-10 Thread Marc Poulhiès
From: Ronan Desplanques Process_Subtype calls itself in some error situations. This recursive call was not updated together with the recent addition of the Excludes_Null formal. This does not matter in practice because there can never be both a null exclusion and another constraint at the same ti

[COMMITTED 05/30] ada: Rename a couple of local variables

2025-06-10 Thread Marc Poulhiès
From: Eric Botcazou Block_Node is the name of an entity field, so the change renames local variables with this name for the sake of clarity. gcc/ada/ChangeLog: * par-ch5.adb (P_Declare_Statement): Rename local variable. (P_Begin_Statement): Likewise. Tested on x86_64-pc-linux-g

[COMMITTED 40/40] ada: Support fixed-lower-bound array types as generic actual parameters

2025-06-09 Thread Marc Poulhiès
From: Gary Dismukes Attempting to use a fixed-lower-bound array type (or subtype) as an actual parameter for a formal unconstrained array type was being rejected by the compiler (complaining about the index type of the actual not matching the index type of the formal type). The compiler was impr

[COMMITTED 39/40] ada: Reject component-related aspects on formal non-array types

2025-06-09 Thread Marc Poulhiès
From: Piotr Trojanek In Ada 2022 aspects Atomic_Components and Volatile_Components can be specified for a formal array type, but they were wrongly accepted on any formal type. Also, we don't need to check if the corresponding pragmas appear in Ada 2022 mode, because generic formal parameters can

[COMMITTED 37/40] ada: Clarify code in Process_Subtype

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques This patch factorizes two if statements together in the body of Process_Subtype, to improve readability. gcc/ada/ChangeLog: * sem_ch3.adb (Process_Subtype): Clarify code. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch3.adb | 90

[COMMITTED 38/40] ada: Fix glitch in handling of Atomic_Components on generic formal type

2025-06-09 Thread Marc Poulhiès
From: Piotr Trojanek In Ada 2022 aspects Atomic_Components and Volatile_Components can be specified for a formal array type, but then they need to be set on the base type entity. Otherwise we get an assertion failure in debug build and wrong legality errors in production builds. gcc/ada/ChangeLo

[COMMITTED 31/40] ada: Fix comment

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques gcc/ada/ChangeLog: * sem.adb (Analyze): Fix comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index 06df00ec871..f5ce9f2300e 100

[COMMITTED 36/40] ada: Add null exclusion formal to Process_Subtype

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, Process_Subtype looked at the parent of its argument to determine whether it was called in a context that excluded null. This patch replaces this lookup with a new formal parameter to Process_Subtype, and updates the calls to it accordingly. gcc/ada/Cha

[COMMITTED 34/40] ada: Missing discriminant check on assignment of Bounded_Vector aggregate

2025-06-09 Thread Marc Poulhiès
From: Gary Dismukes When a container aggregate for a Bounded_Vector type involves an iterated association that is assigned to a vector object whose capacity (as defined by the Capacity discriminant) is less than the number of elements of the aggregate, Constraint_Error should be raised due to fai

[COMMITTED 20/40] ada: Pragma Ada_XX not propagated from library level spec to body

2025-06-09 Thread Marc Poulhiès
From: Javier Miranda Add documentation to pragmas Ada_83, Ada_95, Ada_05, Ada_12, and Ada_2022: when placed before a library level package specification they are not propagated to the corresponding package body; they must be added explicitly to the package body. gcc/ada/ChangeLog: * doc

[COMMITTED 19/40] ada: Remove redundant error checking

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques This patch removes a test for a condition that can never be false. gcc/ada/ChangeLog: * sem_attr.adb (Analyze_Attribute): Remove test. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_attr.adb | 18 +++--- 1 file changed, 7 inser

[COMMITTED 33/40] ada: Remove duplicated code in parser for Chapter 4 (continued)

2025-06-09 Thread Marc Poulhiès
From: Eric Botcazou P_Qualified_Simple_Name and P_Function_Name contain essentially the same code, except that P_Function_Name does not error out on an operator symbol that is followed by something else than a dot. This deletes P_Function_Name and changes P_Qualified_Simple_Name[_Resync] to not

[COMMITTED 30/40] ada: Remove duplicated code in parser for Chapter 4

2025-06-09 Thread Marc Poulhiès
From: Eric Botcazou P_Qualified_Simple_Name and P_Qualified_Simple_Name_Resync contain exactly the same code, so this change makes the former call the latter. gcc/ada/ChangeLog: * par-ch4.adb (P_Name): Remove obsolete references in comments. (P_Qualified_Simple_Name): Call P_Qua

[COMMITTED 08/40] ada: Remove incorrect comment

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques This patchs removes a comment that was incorrect, as noted by a ??? comment that was right after and that this patch also removes. gcc/ada/ChangeLog: * atree.ads (Rewrite): Remove comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/atree.a

[COMMITTED 14/40] ada: Check validity using signedness from the type and not its base type

2025-06-09 Thread Marc Poulhiès
From: Piotr Trojanek When attribute Valid is applied to a private type, we used the signedness of its implementation base type which wrongly included negative values. gcc/ada/ChangeLog: * exp_attr.adb (Expand_N_Attribute_Reference): When expanding attribute Valid, use signedness

[COMMITTED 15/40] ada: Remove incorrect bits in Copy_Node documentation

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques This patch removes a leftover reference to the concept of node extension and a note about aspect specification that's been incorrect since at least the latest rework of aspect specification representation. gcc/ada/ChangeLog: * atree.ads (Copy_Node): Fix comment.

[COMMITTED 28/40] ada: Simplify handling of selected components as name references

2025-06-09 Thread Marc Poulhiès
From: Piotr Trojanek The selector_name of a selected_component always points to an identifier than is an object name, i.e. specifically, name of a component or discriminant. There is no need to examine this. Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_util.adb (Is_Na

[COMMITTED 27/40] ada: Restrict Overlays_Constant flag to selected entities

2025-06-09 Thread Marc Poulhiès
From: Eric Botcazou Namely E_Constant and E_Variable entities. gcc/ada/ChangeLog: * einfo.ads (Overlays_Constant): Define in constants and variables. * gen_il-gen-gen_entities.adb (Entity_Kind): Move Overlays_Constant semantic flag to... (Constant_Or_Variable_Kin

[COMMITTED 32/40] ada: Set Ekind of components earlier

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, the calls to set the proper Ekind of component entities were delayed in order to catch "premature usage" type of errors. This patch moves those calls to the natural place, at the beginning of Analyze_Component_Declaration, and makes premature usage error

[COMMITTED 11/40] ada: Remove outdated comment

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques This patch removes a comment that was made incorrect by the introduction of Is_Self_Hidden. gcc/ada/ChangeLog: * sem_ch3.adb (Analyze_Object_Declaration): Remove comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch3.adb | 4 +--- 1 f

[COMMITTED 23/40] ada: Specialize syntax error on malformed Abstract_State contract

2025-06-09 Thread Marc Poulhiès
From: Piotr Trojanek Syntax for the Abstract_State contract is the same as for extended aggregates, but conceptually they are completely different. This patch specializes error messages emitted on syntax errors for these constructs. gcc/ada/ChangeLog: * par-ch13.adb (Get_Aspect_Specific

[COMMITTED 21/40] ada: Tune recent change for warning about unsupported overlays

2025-06-09 Thread Marc Poulhiès
From: Piotr Trojanek Fix crash occurring when overlay applies to protected component and expansion is disabled, e.g. because of semantic checking mode (switch -gnatc) or because the compiler is running in GNATprove mode. Also, simply pick the type of overlaid object from the attribute prefix its

[COMMITTED 22/40] ada: Do not build dispatch tables for generics

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, Build_Static_Dispatch_Tables was called on generic package bodies. While this has not been proved to cause any actual bug, it was clearly inappropriate and also useless, so this patch removes those calls. gcc/ada/ChangeLog: * sem_ch10.adb (Anal

[COMMITTED 16/40] ada: Constraint check on tagged build-in-place object decls

2025-06-09 Thread Marc Poulhiès
From: Bob Duff In the case of "X : T := F (...);", where T is a constrained discriminated tagged subtype, perform a constraint check after F returns. The result of F is allocated by the callee on the secondary stack in this case. Note that there are still missing checks for some build-in-place ca

[COMMITTED 29/40] ada: Fix SPARK test failures caused by new handling of inherited class-wide pre/post

2025-06-09 Thread Marc Poulhiès
From: Gary Dismukes The revised handling of inherited class-wide pre/postconditions (for properly implementing the rules of RM 6.1.1(7/5)) broke two SPARK tests (N709-001__contracts and V516-041__private_ownership). This change fixes that, by refining the test for detecting formal parameters used

[COMMITTED 35/40] ada: Call Mutate_Ekind earlier for formal entities

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques This patch migrates the handling of "premature usage" type of error to the Is_Self_Hidden mechanism. gcc/ada/ChangeLog: * sem_ch6.adb (Set_Formal_Mode): Extend profile. Move parts of the body… (Process_Formals): … here. Move call to Set_Formal_Mod

[COMMITTED 09/40] ada: Clarify warning in Atree.Rewrite documentation

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques The documentation of Atree.Rewrite warns about a potential misuse of that subprogram. This patch makes the text of that warning more specific. The documentation of Atree.Replace had the same note but this patch replaces it with a mention of the one in Rewrite's documentati

[COMMITTED 18/40] ada: Remove unnecessary special handling

2025-06-09 Thread Marc Poulhiès
From: Ronan Desplanques This patch removes a special exemption in Enter_Name. That exemption was preceded by a comment which described what situations it was supposed to be required for, but it was unnecessary even in those situations. gcc/ada/ChangeLog: * sem_util.adb (Enter_Name): Rem

[COMMITTED 07/40] ada: Improve readability in Atree.Rewrite body

2025-06-08 Thread Marc Poulhiès
From: Ronan Desplanques This patch visually packs together the statements that implement the exceptions in Rewrite that a few fields are not actually overwritten, in order to improve the readability of the code. gcc/ada/ChangeLog: * atree.adb (Rewrite): Improve readability. Tested on x

[COMMITTED 25/40] ada: Set Ekind early in object declarations

2025-06-08 Thread Marc Poulhiès
From: Ronan Desplanques Setting the proper Ekind on object entities was once needed to catch cases of premature usages. The introduction of Is_Self_Hidden changed that, so this patch replaces the Mutate_Ekind calls in the natural place. gcc/ada/ChangeLog: * sem_ch3.adb (Analyze_Object_D

[COMMITTED 26/40] ada: Back out removal of renaming tranformation

2025-06-08 Thread Marc Poulhiès
From: Bob Duff A previous change (commit 33eebd96d27fa2b29cec79f55167a11aaf7f4802) removed code in Analyze_Object_Renaming that tranformed renamings into object declarations. This reinstates that code. Removing the code causes failures in gnatbugs-large/2023/gnat-435_deep_blue_capital. Ideally,

[COMMITTED 17/40] ada: Remove misleading comment

2025-06-08 Thread Marc Poulhiès
From: Ronan Desplanques This patch removes a comment that misleadingly presented a condition as being met only in rare situations, while it's in fact satisfied in very basic cases such as simple object declarations. gcc/ada/ChangeLog: * sem_util.adb (Enter_Name): Remove comment. Tested

[COMMITTED 10/40] ada: Add example in Current_Entity_In_Scope comment

2025-06-08 Thread Marc Poulhiès
From: Ronan Desplanques gcc/ada/ChangeLog: * sem_util.ads (Current_Entity_In_Scope): Add example in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.ads | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ut

[COMMITTED 24/40] ada: Tweak error recovery path

2025-06-08 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, the constant mark of object declarations was stripped in some error situations. This behavior is currently not useful so this patch removes it. gcc/ada/ChangeLog: * sem_ch3.adb (Analyze_Object_Declaration): Tweak error handling. Tested on x86_

[COMMITTED 06/40] ada: Tweak Kill_Current_Values

2025-06-08 Thread Marc Poulhiès
From: Ronan Desplanques Is_Object returns True for "record field" entities, which might make sense in some contexts but not when Kill_Current_Values is called in a default expression of a record component. This patch refines the choice of considered entities in Kill_Current_Values accordingly. g

[COMMITTED 02/40] ada: Fix bindings for CHERI Set_Bounds and Set_Exact_Bounds intrinsics.

2025-06-08 Thread Marc Poulhiès
From: Daniel King gcc/ada/ChangeLog: * libgnat/i-cheri.ads (Set_Bounds, Set_Exact_Bounds): Remove wrong intrinsic binding. * libgnat/i-cheri.adb (Set_Bounds, Set_Exact_Bounds): New subprogram bodies. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/a

[COMMITTED 12/40] ada: Incorrect creation of corresponding expression of class-wide contracts

2025-06-08 Thread Marc Poulhiès
From: Gary Dismukes GNAT was incorrectly implementing the Ada rules for resolving calls to primitive functions within inherited class-wide pre- and postconditions, as specified in RM22 6.1.1 (relating to AI12-0113). Only function calls that involve formals of the associated primitive subprogram

[COMMITTED 05/40] ada: Fix spurious error on anonymous array initialized by conditional expression

2025-06-08 Thread Marc Poulhiès
From: Eric Botcazou Even though the actual subtype of the anonymous array is not yet set on the object itself by the time Insert_Conditional_Object_Declaration is called, it is set on its initialization expression, so it can simply be forwarded to Insert_Conditional_Object_Declaration from there,

[COMMITTED 13/40] ada: Emit more warnings on unsupported overlay

2025-06-08 Thread Marc Poulhiès
In the case where the overlaid object is nested in a record or is an array element as in: for Foo'Address use Item.Nested_Item'Address; or for Foo'Address use Item (Bar)'Address; the compiler was not emitting a warning in case of differing Scalar_Storage_Order values. gcc/ada/ChangeLog:

[COMMITTED 03/40] ada: Rename Is_Infinity to Is_Infinity_Or_NaN in System.Double_Real

2025-06-08 Thread Marc Poulhiès
From: Eric Botcazou The predicate is used to detect corner cases in multiplicative operations and also returns True for NaNs. gcc/ada/ChangeLog: * libgnat/s-dourea.adb (Is_Infinity): Rename to... (Is_Infinity_Or_NaN): ...this. ("*"): Adjust accordingly. ("/"): Li

[COMMITTED 04/40] ada: Fix assertion failure on error path

2025-06-08 Thread Marc Poulhiès
From: Ronan Desplanques gcc/ada/ChangeLog: * sem_ch8.adb (Find_Selected_Component): Fix error path. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch8.adb | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 4cd6b7d93

[COMMITTED 01/40] ada: Add Ada RM clause mention

2025-06-08 Thread Marc Poulhiès
From: Ronan Desplanques This patch adds a mention of the relevant Ada RM clause to a comment about a part of Find_Selected_Component, to make it easier to find. gcc/ada/ChangeLog: * sem_ch8.adb (Find_Selected_Component): Add mention. Tested on x86_64-pc-linux-gnu, committed on master.

[COMMITTED 18/40] ada: Fix wrong initialization of library-level object by conditional expression

2025-06-06 Thread Marc Poulhiès
From: Eric Botcazou At library level the object must be allocated statically and with its bounds when its nominal subtype is an unconstrained array type. gcc/ada/ChangeLog: * exp_ch4.adb (Insert_Conditional_Object_Declaration): Make sure the object is allocated properly by the c

[COMMITTED 36/40] ada: Add null exclusion to registration of floating-point types

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek Null exclusion both clarifies the intention of the code and allows GNAT to eliminate runtime checks where possible (or make them fail where violated), at least in developer builds. Code cleanup. gcc/ada/ChangeLog: * get_targ.ads (Register_Proc_Type): Add null exclus

[COMMITTED 35/40] ada: Refine subtypes in routines for building floating-point numbers

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek Propagate strict subtypes from callees to the caller; code cleanup. gcc/ada/ChangeLog: * cstand.adb (Build_Float_Type, Register_Float_Type): Refine parameter subtypes. * set_targ.ads (FPT_Mode_Entry): Refine component subtype. Tested on x86_64-pc-li

[COMMITTED 29/40] ada: Child unit subprograms are not primitive subprograms

2025-06-06 Thread Marc Poulhiès
From: Steve Baird If a package declares a type and a child unit of that package is a subprogram with a parameter (or function result) of that type, then that subprogram is not a primitive subprogram of that type. Previously this was handled incorrectly in some cases, leading to incorrect analysis

[COMMITTED 24/40] ada: Adjust the Android RTS config to match linux

2025-06-06 Thread Marc Poulhiès
From: Olivier Hainque Android has many traits of Linux, reflected by the gcc port triplets composition (-android-linux). The Android Ada RTS was so far configured as a mostly "posix" port, which happens to be very little tested, if at all. This change reworks the Android Ada RTS to map a lot mo

[COMMITTED 32/40] ada: Support aspect Program_Exit with no expression

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek New aspect Program_Exit for SPARK was originally designed to require an expression, but now we want this expression to be optional. gcc/ada/ChangeLog: * aspects.ads (Aspect_Argument): Argument for Program_Exit is now optional. * doc/gnat_rm/implement

[COMMITTED 33/40] ada: Add case for Program_Exit in Exit_Cases

2025-06-06 Thread Marc Poulhiès
From: Claire Dross Extend the syntax for Exit_Cases to support exiting the program. gcc/ada/ChangeLog: * doc/gnat_rm/implementation_defined_pragmas.rst (Pragma Exit_Cases): Update the documentation for Exit_Cases. * sem_prag.adb (Anlayze_Pragma): Accept Program_E

[COMMITTED 26/40] ada: Set Ekind early for entities created in expansion

2025-06-06 Thread Marc Poulhiès
From: Ronan Desplanques This patch adds early Ekind assignments to entities created for the expansion of a few constructs. The only effect is to enable more dynamic checks for the uses of those entities that used to happen before the Ekind had been set. gcc/ada/ChangeLog: * contracts.ad

[COMMITTED 40/40] ada: Avoid repeated range checks when negating a rational number

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek Use local constant to avoid repeated range checks (at least in the debug builds), but also to make the code easier to read and consistent in style with similar routines in the same package. gcc/ada/ChangeLog: * urealp.adb (UR_Negate): Capture array element in a loca

[COMMITTED 28/40] ada: Constant_Indexing used when context requires a variable

2025-06-06 Thread Marc Poulhiès
From: Javier Miranda In the case of an assignment where the type of its left hand side is an indexable container that has indexable container components (for example a container vector of container vectors), and both indexable containers have Constant_Indexing and Variable_Indexing aspects, the l

[COMMITTED 37/40] ada: Tune style in code for floating-point numbers

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek Cleanup whitespace and comments. gcc/ada/ChangeLog: * ada_get_targ.adb, cstand.ads, cstand.adb, sem_eval.adb, sem_eval.ads, urealp.adb, urealp.ads: Tune style. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/ada_get_targ.adb | 9 +--

[COMMITTED 23/40] ada: Document representation clauses previously required by ASIS

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek A record type used for name identifiers had representation clause to make sure that table with identifiers is written to an ASIS file without holes. Now ASIS mode has been deconstructed, but we still want this representation clause to ensure efficient implementation. Comment

[COMMITTED 38/40] ada: Simplify tests for positive rational numbers

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek Checking a rational number for being positive takes a shorter code path than a general comparison with zero. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Tune code for attribute Small.

[COMMITTED 09/40] ada: Remove dead code

2025-06-06 Thread Marc Poulhiès
From: Ronan Desplanques The code this patch removes is never executed on any of the available test suites. The patch that introduced it mentions that it fixes a test in particular, but that test passes anyway today. gcc/ada/ChangeLog: * sem_ch8.adb (Premature_Usage): Remove dead code.

[COMMITTED 39/40] ada: Remove repeated call in exponentiation of rational numbers

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup. gcc/ada/ChangeLog: * urealp.adb (UR_Exponentiate): Use local variable. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/urealp.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/urealp.adb b/gcc/ada/urealp

[COMMITTED 19/40] ada: Tweak condition for name resolution failure

2025-06-06 Thread Marc Poulhiès
From: Ronan Desplanques It is sometimes used as a convention across GNAT's code to set the Etype field of a node to Any_Type to signal a name resolution error. This has the potential to be confusing, which is why this patch replaces one such use of the convention by a less convoluted check. This

[COMMITTED 22/40] ada: Deconstruct representation clauses required by ASIS

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek When GNAT was operating in ASIS mode, it was writing internal tables to files, so we annotated record types for elements stored in these tables with representation clauses to avoid holes with potentially uninitialized data. Since ASIS mode has been now deconstructed and we n

[COMMITTED 07/40] ada: Allow IN OUT parameters for first parameter of traversal functions

2025-06-06 Thread Marc Poulhiès
From: Claire Dross In general, functions in SPARK cannot have parameters of mode IN OUT unless they are annotated with the Side_Effects aspect. Borrowing traversal functions are special functions which can return a part of their first parameter as an access-to-variable type. This might not be all

[COMMITTED 25/40] ada: Rework Android struct sigaction bindings

2025-06-06 Thread Marc Poulhiès
From: Olivier Hainque A previous change arranged for the common definition of struct_sigaction in s-osinte__android.ads to work both for ARM and aarch64 by way of representation clauses with field offsets taken from specialized versions of s-linux (one for ARM, one for aarch64). The aarch64 vari

[COMMITTED 16/40] ada: Move Incomplete_View from node to entity field

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek The Incomplete_View property of a type was attached to its full type declaration as a semantic field, but retrieving it from there required low-level tree navigation and caused code duplication. In one case we relied on internal class-wide type being attached to the correspon

[COMMITTED 34/40] ada: Check references to subprogram outputs with Program_Exit expression

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek Add check for references to subprogram outputs occurring within the Program_Exit expression. This check is necessarily partial, as it misses objects referenced by subprograms called from the Program_Exit expression, but this is consistent with other checks. gcc/ada/ChangeLog

[COMMITTED 15/40] ada: Initial prototype of constructors

2025-06-06 Thread Marc Poulhiès
From: squirek The patch implements the experimental constructors RFC. Currently a WIP. gcc/ada/ChangeLog: * aspects.ads: Add support for constructors. * exp_aggr.adb: Likewise. * exp_attr.adb: Likewise. * exp_ch3.adb: Likewise. * exp_ch4.adb: Likewise.

[COMMITTED 04/40] ada: Move standard subtype declarations generation

2025-06-06 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, the subtype declarations for Standard.Natural and Standard.Positive were created before the entity for Standard.Integer was complete. In preparation of a future change that will make it impossible to call Etype on an incomplete node, this patch delays th

[COMMITTED 21/40] ada: Fix typo in documentation about convention and representation

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek Currently there are only three exceptions to the general rule; the fourth exception applied to OpenVMS, whose support has been deconstructed. gcc/ada/ChangeLog: * doc/gnat_rm/representation_clauses_and_pragmas.rst (Effect of Convention on Representation): Fi

[COMMITTED 20/40] ada: Fix libgpr2 build failure with compiler built with assertions

2025-06-06 Thread Marc Poulhiès
From: Eric Botcazou The problem is that the Entity field is accessed for a node without one. gcc/ada/ChangeLog: * sem_ch10.adb (Install_Siblings.In_Context): Add missing guard. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch10.adb | 2 ++ 1 file changed, 2 inse

[COMMITTED 30/40] ada: Deconstruct C header for the SCOs unit

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek The C version of SCOs unit provided a gigi interface to source code obligations that at some point were generated by the frontend. This functionality has been deconstructed long ago. gcc/ada/ChangeLog: * libgnat/g-dyntab.ads (Instance): Update and extend comment.

[COMMITTED 17/40] ada: Convert floating-point zero to machine representation

2025-06-06 Thread Marc Poulhiès
From: Piotr Trojanek When statically evaluating floating-point expressions we convert the final result to machine number. However, we skipped this conversion if the result was zero. This inconsistency was introduced when adding a warning for compile-time evaluation that gives different result fr

[COMMITTED 12/40] ada: Restore Original_Access_Type field in E_Access_Subprogram_Type entities

2025-06-06 Thread Marc Poulhiès
From: Eric Botcazou It is used by CodePeer to recognize the special access pattern. gcc/ada/ChangeLog: * einfo.ads (Original_Access_Type): Restore. * gen_il-fields.ads (Opt_Field_Enum): Restore Original_Access_Type. * gen_il-gen-gen_entities.adb: Adjust accordingly.

[COMMITTED 08/40] ada: Remove Size_Check_Code field from entities

2025-06-06 Thread Marc Poulhiès
From: Eric Botcazou It has been unused for a very long time. gcc/ada/ChangeLog: * einfo.ads (Size_Check_Code): Delete. * gen_il-fields.ads (Opt_Field_Enum): Remove Size_Check_Code. * gen_il-gen-gen_entities.adb (Constant_Or_Variable_Kind): Likewise. * sem_ch13.ad

[COMMITTED 02/40] ada: Fix internal error on allocator involving interface type

2025-06-06 Thread Marc Poulhiès
From: Eric Botcazou The problem is that an itype duplicated through Duplicate_Subexpr_No_Checks ends up in a different scope than its source. It is fixed by adding a new formal parameter New_Scope to the function and forwarding it in the call to the New_Copy_Tree function. gcc/ada/ChangeLog:

  1   2   3   4   5   6   7   8   9   10   >