[COMMITTED 9/9] ada: Update Assertion_Policy handling in GNATProve mode

2025-08-04 Thread Marc Poulhiès
From: Viljar Indus Previously in GNATProve_Mode the frontend would overwrite all of the assertion policies to check in order to force the generation of all of the assertions. This however prevents GNATProve from performing policy related checks in the tool. Since they are all artificially change

[COMMITTED 4/9] ada: Keep Ghost_Mode related variables in a record

2025-08-04 Thread Marc Poulhiès
From: Viljar Indus Simplify the storing process for ghost mode related variables and make the process more extendable if new ghost mode related features are added. gcc/ada/ChangeLog: * atree.adb: update references to Ghost_Mode. * exp_ch3.adb: use a structure type to store all o

[COMMITTED 6/9] ada: Refactor Validate_Compile_Time_Warning_Or_Error

2025-08-04 Thread Marc Poulhiès
From: Viljar Indus Simplify the creation of the control characters in Validate_Compile_Time_Warning_Or_Error. gcc/ada/ChangeLog: * sem_prag.adb (Validate_Compile_Time_Warning_Or_Error): simplify the implementation. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/a

[COMMITTED 1/9] ada: Misc parser cleanup

2025-08-04 Thread Marc Poulhiès
From: Bob Duff ...which might make it easier to deal with incorrectly shared subtrees created during parsing. There were several Idents arrays, with duplicated code and commentary. And the related code had somewhat diverged -- different comments, different index subtypes (Pos vs. Int), etc. DRY

[COMMITTED 8/9] ada: Make pp and friends more robust

2025-08-04 Thread Marc Poulhiès
From: Bob Duff Print_Node_Ref, which is called by pp, sometimes calls Compile_Time_Known_Value, which blows up if Entity (N) is empty. Rearrange the tests here, and test for Present (Entity (N)) before calling Compile_Time_Known_Value. Remove test "Nkind (N) in N_Subexpr", which is redundant with

[COMMITTED 7/9] ada: Check Compile_Time_Errors removed in Ghost code

2025-08-04 Thread Marc Poulhiès
From: Viljar Indus gcc/ada/ChangeLog: * sem_prag.adb (Validate_Compile_Time_Warning_Errors): Check if the original compile time pragma was replaced and validate the original node instead. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 8

[COMMITTED 5/9] ada: Implement accessibility legality check for discriminated function result.

2025-08-04 Thread Marc Poulhiès
From: Steve Baird If a function result type has an access discriminant, then we already generate a run-time accessibility check for a return statement. But if we know statically that the check (if executed) is going to fail, then that should be rejected at compile-time as a violation of RM 6.5(5.

[COMMITTED 3/9] ada: Avoid generating incorrect warning

2025-08-04 Thread Marc Poulhiès
From: Steve Baird Do not generate a warning stating that the size of a formal parameter is 8 bits unless the size of the formal parameter is 8 bits. gcc/ada/ChangeLog: * freeze.adb (Freeze_Profile): Do not emit a warning stating that a formal parameter's size is 8 if the paramet

[COMMITTED 2/9] ada: Fix code quality issue in table.adb

2025-08-04 Thread Marc Poulhiès
From: Viljar Indus gcc/ada/ChangeLog: * table.adb (Max): Move variable to the body and initialize it with the same value as in the Init function. * table.ads (Max): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/table.adb | 3 +++ gcc/ada/tab

[COMMITTED] ada: Minor typo fix in comment

2025-07-28 Thread Marc Poulhiès
gcc/ada/ChangeLog: * gcc-interface/trans.cc (gnat_to_gnu): Fix typo in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/trans.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interfa

[COMMITTED 6/7] ada: ppc-vx6: pthread clocks and headers for decls

2025-07-25 Thread Marc Poulhiès
From: Alexandre Oliva VxWorks 6 lacks pthread_condattr_setclock, so define CLOCK_RT_Ada to CLOCK_REALTIME to use the dummy definition of __gnat_pthread_condattr_setup in libgnarl/thread.c. socket.c and sysdep.c use FD_ZERO, that relies on bzero on VxWorks 6. We need to include strings.h to get a

[COMMITTED 3/7] ada: Update comments

2025-07-25 Thread Marc Poulhiès
From: Ronan Desplanques A previous patch changed the mechanism of early usage detection for discriminants but failed to update a couple of surrounding comments accordingly. This patch fixes this omission. gcc/ada/ChangeLog: * sem_ch3.adb (Process_Discriminants): Update comments Tested

[COMMITTED 7/7] ada: Minor cleanup

2025-07-25 Thread Marc Poulhiès
Renamed local variables to make it easier to read. gcc/ada/ChangeLog: * gcc-interface/utils.cc (update_pointer_to): Renamed ptr/old_ptr, ref/old_ref. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/utils.cc | 31 --- 1 file cha

[COMMITTED 4/7] ada: Bug in Indefinite_Holders instance passed to formal package

2025-07-25 Thread Marc Poulhiès
From: Bob Duff Fix bug when an instance of Indefinite_Holders with a class-wide type is passed as a generic formal package; Program_Error was raised when dealing with the implicit "=" function. The fix is to disable legality checks in formal packages when the entity is an E_Subprogram_Body, beca

[COMMITTED 1/7] ada: Fix inconsistencies in conversion functions from Duration

2025-07-25 Thread Marc Poulhiès
From: Eric Botcazou The 3 units Ada.Calendar, GNAT.Calendar and GNAT.Sockets contain conversion functions from the Duration fixed-point type that implement the same idiom but with some inconsistencies: * GNAT.Sockets only handles Timeval_Duration, i.e. positive Duration, and is satisfactor

[COMMITTED 5/7] ada: Follow up fixes.

2025-07-25 Thread Marc Poulhiès
From: Steve Baird Two follow-up fixes for the previous change for this issue. gcc/ada/ChangeLog: * exp_ch6.adb (Apply_Access_Discrims_Accessibility_Check): Do nothing and simply return if either Ada_Version <= Ada_95 or if the function being returned from lacks the extra

[COMMITTED 2/7] ada: Fix regression of finalization primitive selection

2025-07-25 Thread Marc Poulhiès
From: Ronan Desplanques A recent patch introduced a new flag to mark the types for which looking up finalization primitives needs special handling. But there was one place in Build_Derived_Record_Type where the flag was not set when it should, which introduced a regression in some cases. This pa

[COMMITTED 3/3] ada: Use-before-definition of a component of discriminated aggregate's itype.

2025-07-24 Thread Marc Poulhiès
From: Steve Baird In some cases involving assigning an aggregate to a formal parameter of an unconstrained discriminated subtype that has a Dynamic_Predicate, and where the discriminated type also has a component of an unconstrained discriminated subtype, the front end generates a malformed tree

[COMMITTED 2/3] ada: Function return accessibility checking for result access discrims.

2025-07-24 Thread Marc Poulhiès
From: Steve Baird RM 6.5 defines static and dynamic checks to ensure that a function result with one or more access discriminants will not outlive the entity designated by a non-null access discriminant value (see paragraphs 5.9 and 21). Implement these checks. Also fix a bug in passing along an

[COMMITTED 1/3] ada: Minor adjustment to the doc of Last_Chance_Handler

2025-07-24 Thread Marc Poulhiès
From: Tonu Naks gcc/ada/ChangeLog: * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst: clarify parameter description. * gnat_rm.texi: Regenerate. Tested on x86_64-pc-linux-gnu, committed on master. --- .../standard_and_implementation_defined_restriction

[COMMITTED 22/22] ada: Nested use_type_clause with "all" cancels use_type_clause with wider scope

2025-07-22 Thread Marc Poulhiès
From: Gary Dismukes The compiler mishandles nested use_type_clauses in the case where the outer one is a normal use_type_clause and the inner one has "all". Upon leaving the scope of the inner use_type_clause, the outer one is effectively disabled, because it's not considered redundant (and in fa

[COMMITTED 21/22] ada: Only fold array attributes in SPARK when prefix is safe to evaluate

2025-07-22 Thread Marc Poulhiès
From: Piotr Trojanek Fix missing checks for prefixes of array attributes in GNATprove mode. gcc/ada/ChangeLog: * sem_attr.adb (Eval_Attribute): Only fold array attributes when prefix is static or at least safe to evaluate Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED 20/22] ada: Fix minor issues in comments

2025-07-22 Thread Marc Poulhiès
From: Ronan Desplanques gcc/ada/ChangeLog: * einfo.ads (Is_Controlled_Active): Fix pasto in comment. * sem_util.ads (Propagate_Controlled_Flags): Update comment for Destructor aspect. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/einfo.ads| 2 +-

[COMMITTED 17/22] ada: Fix generation of Initialize and Adjust calls

2025-07-22 Thread Marc Poulhiès
From: Ronan Desplanques Before this patch, Make_Init_Call and Make_Adjust_Call made the assumption that if the type they were called with was untagged and a derived type, it was the untagged private view of a tagged type. That assumption made it possible to inspect the root type's primitives to h

[COMMITTED 18/22] ada: Fix crash when creating extra formals for aliased types

2025-07-22 Thread Marc Poulhiès
From: Denis Mazzucato This patch makes sure that we return the same decision for all aliased types when checking if the BIP task extra actuals are needed. gcc/ada/ChangeLog: * sem_ch6.adb (Might_Need_BIP_Task_Actuals): Before retrieving the original corresponding operation we r

[COMMITTED 15/22] ada: Wrong dispatch on result in presence of dependent expression

2025-07-22 Thread Marc Poulhiès
From: Javier Miranda The compiler generates wrong code in a dispatching call on result when the call is performed under dependent conditional expressions or case-expressions. gcc/ada/ChangeLog: * sinfo.ads (Is_Expanded_Dispatching_Call): New flag. (Tag_Propagated): New flag.

[COMMITTED 14/22] ada: Additional condition for Capacity discriminant on bounded container aggregates

2025-07-22 Thread Marc Poulhiès
From: Gary Dismukes This change test an additional condition as part of the criteria used for deciding whether to generate a call to a container type's Length function (for passing to the Empty function) when determining the size of the object to allocate for a bounded container aggregate with a

[COMMITTED 08/22] ada: Tune check for restriction No_Relative_Delay and call to Set_Handler

2025-07-22 Thread Marc Poulhiès
From: Piotr Trojanek When checking restriction No_Relative_Delay and detecting calls to Ada.Real_Time.Timing_Events.Set_Handler with a Time_Span parameter, we looked at the exact type of the actual parameter, while we should look at its base type. This patch looks at the type of actual parameter

[COMMITTED 01/22] ada: Improved support for mutably tagged types

2025-07-22 Thread Marc Poulhiès
From: Steve Baird Fix bugs related to mutably tagged types in streaming operations, Put_Image attributes, aggregates, composite equality comparisons with mutably-tagged components, and other issues. gcc/ada/ChangeLog: * exp_aggr.adb (Build_Record_Aggr_Code.Gen_Assign): In the case of

[COMMITTED 19/22] ada: Add destructors extension

2025-07-22 Thread Marc Poulhiès
From: Ronan Desplanques This patch adds a GNAT-specific extension which enables "destructors". Destructors are an optional replacement for Ada.Finalization where some aspects of the interaction with type derivation are different. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions

[COMMITTED 06/22] ada: Replace "not Present" test with "No" test

2025-07-22 Thread Marc Poulhiès
From: Gary Dismukes Minor change to satisfy GNAT SAS checker. gcc/ada/ChangeLog: * exp_aggr.adb (Build_Size_Expr): Change test of "not Present (...)" to "No (...)". Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_aggr.adb | 3 +-- 1 file changed, 1 inserti

[COMMITTED 13/22] ada: Fix assertion failure on aggregate with controlled component

2025-07-22 Thread Marc Poulhiès
From: Eric Botcazou The assertion is: pragma Assert (Side_Effect_Free (L)); in Make_Tag_Ctrl_Assignment and demonstrates that the sequence: Remove_Side_Effects (L); pragma Assert (Side_Effect_Free (L)); does not hold in this case. What happens is that Remove_Side_Effects uses a ren

[COMMITTED 16/22] ada: Remove obsolete code from Safe_Unchecked_Type_Conversion

2025-07-22 Thread Marc Poulhiès
From: Eric Botcazou That's a kludge added to work around the limitations of the stack checking mechanism used in the early days. gcc/ada/ChangeLog: * exp_util.ads (May_Generate_Large_Temp): Delete. * exp_util.adb (May_Generate_Large_Temp): Likewise. (Safe_Unchecked_Type_

[COMMITTED 09/22] ada: Expand continue procedure calls for GNATprove

2025-07-22 Thread Marc Poulhiès
From: Martin Clochard Continue being a non-reserved keyword, occurrences of continue may be resolved as procedure calls. Get that special case out of the way for GNATprove, in anticipation of support for continue keyword. gcc/ada/ChangeLog: * exp_spark.adb (Expand_SPARK): Add expansion

[COMMITTED 03/22] ada: Add Unique_Component_Name function for use by CCG.

2025-07-22 Thread Marc Poulhiès
From: Steve Baird Define a new function which, initially, is never called. It is intended to be called from CCG. If an Ada tagged record type has a component named Foo, then the generated corresponding C struct might have a component with the same name. This approach almost works, but breaks down

[COMMITTED 11/22] ada: Adding support to defer the addition of extra formals

2025-07-22 Thread Marc Poulhiès
From: Javier Miranda Add support to create the extra formals when the underlying type of some formal type or return type of a subprogram, subprogram type or entry is not available when the entity is frozen. For example, when a function that returns a private type is frozen before the full-view of

[COMMITTED 10/22] ada: Tune recent change for bit-packed arrays to help GNATprove backend

2025-07-22 Thread Marc Poulhiès
From: Piotr Trojanek When GNAT is operating in GNATprove_Mode the Expander_Active flag is disabled, but we still must do things that ordinary backends expect. gcc/ada/ChangeLog: * sem_util.adb (Get_Actual_Subtype): Do the same for GCC and GNATprove backends. Tested on x86_64-pc

[COMMITTED 12/22] ada: Fix unnecessary extra RE_Activation_Chain_Access with No_Task_Parts

2025-07-22 Thread Marc Poulhiès
From: Denis Mazzucato This patch checks the presence of No_Task_Parts on any ancestor or inherited interface, not only its root type, since No_Task_Parts prohibits tasking for any of its descendant. In case the current subprogram is overridden/inherited, we need to return the same value we would

[COMMITTED 05/22] ada: Capacity determination for container aggregate with container iterator

2025-07-22 Thread Marc Poulhiès
From: Gary Dismukes In the case of a container aggregate that has a container_element_association given by an iterator_specification that iterates over a container object (for example, "[for E of V => E]"), the compiler will now determine the number of elements in the object and can use that in d

[COMMITTED 02/22] ada: Ensure Expression_Copy has a parent before analysis

2025-07-22 Thread Marc Poulhiès
From: Viljar Indus Some analysis requires going up the parent chain to get the relevant context. Ensure that is done for the Expression_Copy node which is not a syntactic node. gcc/ada/ChangeLog: * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Ensure the Expression_Copy al

[COMMITTED 04/22] ada: exp_util.adb: prevent infinite loop in case of broken code

2025-07-22 Thread Marc Poulhiès
From: Ghjuvan Lacambre A recent commit modified exp_util.adb in order to fix the selection of Finalize subprograms in the case of untagged objects. This introduced regressions for GNATSAS in fixedbugs by causing GNAT2SCIL to loop over the same type over and over in case of broken code. We fix thi

[COMMITTED 07/22] ada: Fix wrong indirect access to bit-packed array in iterated loop

2025-07-22 Thread Marc Poulhiès
From: Eric Botcazou This comes from a missing expansion of the bit-packed array reference in the loop, because the actual subtype created for the dereference lacks a Packed_Array_Impl_Type as it is ultimately created by the Preanalyze_Range call present in Analyze_Loop_Statement. gcc/ada/ChangeL

Re: [PATCH] genpreds.cc: Do not use rawmemchr for insn_constraint_len

2025-07-21 Thread Marc Poulhiès
On Mon Jul 21, 2025 at 6:27 PM CEST, Stefan Schulze Frielinghaus wrote: > Bootstrapped successfully on s390x and tests dg.exp=asm-hard-reg-\*.c > and s390.exp=asm-hard-reg-\*.c are successful, too. Ok for mainline? FYI, I've created https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121201, you may wan

[COMMITTED 3/6] ada: Incorrect resolution of prefixed calls with overriding private subprogram

2025-07-18 Thread Marc Poulhiès
From: Gary Dismukes The compiler incorrectly treats an overriding private subprogram that should not be visible outside a package (because it only overrides in the private part) as a possible interpretation for a call using prefixed notation outside of the package. This can result in an ambiguity

[COMMITTED 1/6] ada: Array aggregates of mutably tagged objects (part 2)

2025-07-18 Thread Marc Poulhiès
From: Javier Miranda gcc/ada/ChangeLog: * exp_aggr.adb (Gen_Assign): Code cleanup. (Initialize_Component): Do not adjust the tag when the type of the aggregate components is a mutably tagged type. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_aggr

[COMMITTED 6/6] ada: Spurious actual/formal matching check failure for formal derived type.

2025-07-18 Thread Marc Poulhiès
From: Steve Baird In some cases involving a generic with two formal parameters, a formal package and a formal derived type that is derived from an interface type declared in the formal package, a legal instantiation of that generic is rejected with a message incorrectly stating that the second ac

[COMMITTED 5/6] ada: Back out change to Tbuild.Unchecked_Convert_To

2025-07-18 Thread Marc Poulhiès
From: Bob Duff ...because it breaks one test that uses --RTS=light. "Is_Composite_Type" is needed; "not Is_Scalar_Type" was wrong. gcc/ada/ChangeLog: * tbuild.adb (Unchecked_Convert_To): Back out change. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/tbuild.a

[COMMITTED 4/6] ada: Do not inline function returning on the secondary stack

2025-07-18 Thread Marc Poulhiès
When inlining function calls that return on the secondary stack used as function actual or in a return statement, the compiler creates an invalid GNAT Tree with a variable of an unconstrained type without an initializer. Also add an extra assertion to catch problematic cases directly in Expand_Inl

[COMMITTED 2/6] ada: Elaboration entity must not be ghost in ghost generic instances

2025-07-18 Thread Marc Poulhiès
From: Piotr Trojanek For non-instance units GNAT builds elaboration entities before the ghost mode is inherited from those units. However, for generic instances GNAT was building elaboration entities with ghost mode inherited from those instances, which effectively caused elaboration entities to

[COMMITTED 10/14] ada: Improve code generated for return of Out parameter with access type

2025-07-04 Thread Marc Poulhiès
From: Eric Botcazou The second problem occurs on 64-bit platforms where there is a second Out parameter that is smaller than the access parameter, creating a hole in the return structure. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_subprog_type): In the case of a sub

[COMMITTED 12/14] ada: Disable previous change for enumeration types

2025-07-04 Thread Marc Poulhiès
From: Eric Botcazou The debugger cannot correctly interpret the return value in this case. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_subprog_type): Only apply the transformation to integer types. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gc

[COMMITTED 09/14] ada: Do not generate incorrect warning about redundant type conversion

2025-07-04 Thread Marc Poulhiès
From: Steve Baird If -gnatwr is enabled, then in some cases a type conversion between two different Boolean types incorrectly results in a warning that the conversion is redundant. gcc/ada/ChangeLog: * sem_res.adb (Resolve_Type_Conversion): Replace code for detecting a similar c

[COMMITTED 13/14] ada: Remove strange elaboration code generated for Cluster type in System.Pack_NN

2025-07-04 Thread Marc Poulhiès
From: Eric Botcazou Initialization procedures are turned into functions under the hood and, even when they are null (empty), the compiler may generate a convoluted sequence of instructions that return uninitialized data and, therefore, is useless. gcc/ada/ChangeLog: * gcc-interface/tran

[COMMITTED 14/14] ada: Fix alignment violation for chain of aligned and misaligned composite types

2025-07-04 Thread Marc Poulhiès
From: Eric Botcazou This happens when aggressive optimizations are enabled (i.e. -O2 and above) because the ivopts pass fails to properly mark the new memory accesses it is creating as misaligned by means of the build_aligned_type function. gcc/ada/ChangeLog: * gcc-interface/utils.cc (m

[COMMITTED 11/14] ada: Add missing guards to previous change

2025-07-04 Thread Marc Poulhiès
From: Eric Botcazou We need to make sure that an integer type exists for the given size. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_subprog_type): Add guards. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/decl.cc | 4 1 file changed,

[COMMITTED 08/14] ada: Pragma Short_Circuit_And_Or

2025-07-04 Thread Marc Poulhiès
From: Bob Duff Improve documentation of pragma Short_Circuit_And_Or. Also disallow renamings, because the semantics as currently implemented is confusing. gcc/ada/ChangeLog: * doc/gnat_rm/implementation_defined_pragmas.rst (Short_Circuit_And_Or): Add more documentation.

[COMMITTED 06/14] ada: Fix inefficient Unchecked_Conversion to large array type

2025-07-04 Thread Marc Poulhiès
From: Eric Botcazou We fail to use the implementation permission given by RM 13.9(12) because the array type does not have the Size_Known_At_Compile_Time flag set. gcc/ada/ChangeLog: * freeze.adb (Check_Compile_Time_Size): Try harder to see whether the bounds of array types are

[COMMITTED 03/14] ada: Improved error message when size of descendant type exceeds Size'Class limit

2025-07-04 Thread Marc Poulhiès
From: Steve Baird Improve the error message that is generated when the size of tagged type exceeds a Size'Class limit specified for an ancestor type. gcc/ada/ChangeLog: * mutably_tagged.adb (Make_CW_Size_Compile_Check): Include the value of the Size'Class limit in the message ge

[COMMITTED 07/14] ada: Fix selection of Finalize subprogram in untagged case

2025-07-04 Thread Marc Poulhiès
From: Ronan Desplanques The newly introduced Finalizable aspect makes it possible to derive from a type that is not tagged but has a Finalize primitive. This patch fixes problems where overridings of the Finalize primitive were ignored. gcc/ada/ChangeLog: * exp_ch7.adb (Make_Final_Call)

[COMMITTED 05/14] ada: Fix style in comment

2025-07-04 Thread Marc Poulhiès
From: Piotr Trojanek Cleanup; technical commit meant to trigger a GNAT continuous builder. gcc/ada/ChangeLog: * sem_aux.ads (First_Discriminant): Remove space before period. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_aux.ads | 2 +- 1 file changed, 1 insertio

[COMMITTED 04/14] ada: Missing component clause warning for discriminant of Unchecked_Union type

2025-07-04 Thread Marc Poulhiès
From: Steve Baird Even when -gnatw.c is enabled, no warning about a missing component clause should be generated if the placement of a discriminant of an Unchecked_Union type is left unspecified in a record representation clause (such a discriminant occupies no storage). In determining whether to

[COMMITTED 01/14] ada: Fix error on Designated_Storage_Model with extensions disabled

2025-07-04 Thread Marc Poulhiès
From: Ronan Desplanques The format string used for the error in that case requires setting the Error_Msg_Name_1 global variable. This was not done so this patch adds the missing assignment. gcc/ada/ChangeLog: * sem_ch13.adb (Analyze_Aspect_Specifications): Fix error emission. Tested on

[COMMITTED 02/14] ada: Remove leftover from rework of aspect representation

2025-07-04 Thread Marc Poulhiès
From: Ronan Desplanques This patch removes some comments and object definitions that referred to a hacky use of the Entity field that had been removed by the latest rework of the internal representation of aspects. gcc/ada/ChangeLog: * sem_ch13.adb (Check_Aspect_At_Freeze_Point): Remove

[COMMITTED 39/42] ada: Fix wrong finalization of constrained subtype of unconstrained array type

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou This implements the Is_Constr_Array_Subt_With_Bounds flag for allocators. gcc/ada/ChangeLog: * gcc-interface/trans.cc (gnat_to_gnu) : Allocate the bounds alongside the data if the Is_Constr_Array_Subt_With_Bounds flag is set on the designated type.

[COMMITTED 38/42] ada: Fix missing error on too large Component_Size not multiple of storage unit

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou This is a small regression introduced a few years ago. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_component_type): Validate the Component_Size like the size of a type only if the component type is actually packed. Tested on x86_64-pc-lin

[COMMITTED 29/42] ada: Adjust message about statically compatible result subtype

2025-07-03 Thread Marc Poulhiès
From: Piotr Trojanek Ada RM 6.5(5.3/5) is about "result SUBTYPE of the function", while the error message was saying "result TYPE of the function". Now use the exact RM wording in the error message for this rule. gcc/ada/ChangeLog: * sem_ch3.adb (Check_Return_Subtype_Indication): Adjust

[COMMITTED 42/42] ada: Fix poor code generated for return of Out parameter with access type

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou The record type of the return object is unnecessarily given BLKmode. gcc/ada/ChangeLog: * gcc-interface/decl.cc (type_contains_only_integral_data): Do not return false only because the type contains pointer data. Tested on x86_64-pc-linux-gnu, committed on m

[COMMITTED 27/42] ada: Fix strange holes for type with variant part reported by -gnatRh

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou The problem is that the sorting algorithm mixes components of variants. gcc/ada/ChangeLog: * repinfo.adb (First_Comp_Or_Discr.Is_Placed_Before): Return True only if the components are in the same component list. Tested on x86_64-pc-linux-gnu, committed on ma

[COMMITTED 36/42] ada: More Tbuild cleanup

2025-07-03 Thread Marc Poulhiès
From: Bob Duff Remove "Nmake_Assert => ..." on N_Unchecked_Type_Conversion at gen_il-gen-gen_nodes.adb:473 (was disabled). This was left over from commit 82a794419a00ea98b68d69b64363ae6746710de9 "Tbuild cleanup". In addition, the checks for "Is_Composite_Type" in Tbuild.Unchecked_Convert_To are

[COMMITTED 34/42] ada: Make comment more precise

2025-07-03 Thread Marc Poulhiès
From: Ronan Desplanques gcc/ada/ChangeLog: * exp_ch6.adb (Expand_Ctrl_Function_Call): Precisify comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch6.adb | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/ada/exp_ch6.adb b/gcc/a

[COMMITTED 32/42] ada: Port System.Stack_Usage to CHERI

2025-07-03 Thread Marc Poulhiès
From: Daniel King This unit performed integer to address conversions to calculate stack addresses which, on a CHERI target, result in an invalid capability that triggers a capability tag fault when dereferenced during stack filling. This patch updates the unit to preserve addresses (capabilities)

[COMMITTED 33/42] ada: Fix missing finalization with conditional expression in extended return

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou Declarations of return objects are not (yet) distributed into the dependent expressions of conditional expressions. gcc/ada/ChangeLog: * exp_ch6.adb (Expand_Ctrl_Function_Call): Do not bail out for the declarations of return objects. Tested on x86_64-pc-linu

[COMMITTED 30/42] ada: Improve retrieval of nominal unconstrained type in extended return

2025-07-03 Thread Marc Poulhiès
From: Piotr Trojanek When extended return statement declares object using an explicit subtype indication, then it is better to recover the original unconstrained type using the explicit subtype indication. This appears to be necessary for subtypes with predicates. gcc/ada/ChangeLog: * s

[COMMITTED 26/42] ada: Fix node copy with functions as actual parameters in dispatching DIC

2025-07-03 Thread Marc Poulhiès
From: Denis Mazzucato When dispatching in a Default_Initial_Condition, copying the condition node crashes if there is a, possibly nested, parameterless function as actual parameter; there were two issues: 1. Subp_Entity in Check_Dispatching_call was uninitialized, a GNAT SAS finding. 2. The co

[COMMITTED 23/42] ada: Remove redundant nested aggregates from diagnostics code

2025-07-03 Thread Marc Poulhiès
From: Piotr Trojanek A nested aggregate with a single "others => <>" clause is equivalent to a box itself. Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * errid.ads (Diagnostic_Entries): Remove nested aggregate. * errsw.adb (Switches): Likewise. Tested on x86_64-pc-

[COMMITTED 28/42] ada: Fix constraint-related legality checks in extended return statements

2025-07-03 Thread Marc Poulhiès
From: Piotr Trojanek Legality checks in extended return statements were (almost) literally implementing the RM rules, but the when analyzing the return object declaration we replace the nominal subtype of that object with its constrained subtype. (It is a bit odd to have such an expansion activit

[COMMITTED 40/42] ada: Fix alignment violation for mix of aligned and misaligned composite types

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou This happens when the chain of initialization procedures is called on the subcomponents and causes the creation of temporaries along the way out of alignment considerations. Now these temporaries are not necessary in the context and were not created until recently, so this ge

[COMMITTED 20/42] ada: Remove a couple of redundant calls to Set_Etype

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou The OK_Convert_To function already sets the Etype of its result. gcc/ada/ChangeLog: * exp_imgv.adb (Expand_Value_Attribute): Do not call Set_Etype on N after rewriting it by means of OK_Convert_To. Tested on x86_64-pc-linux-gnu, committed on master. --- gc

[COMMITTED 41/42] ada: Enforce alignment constraint for large Object_Size clauses

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou The constraint is that the Object_Size must be a multiple of the alignment in bits. But it's enforced only when the value of the clause is lower than the Value_Size rounded up to the alignment in bits, not for larger values. gcc/ada/ChangeLog: * gcc-interface/decl.c

[COMMITTED 24/42] ada: Turn diagnostic object from variable to constant

2025-07-03 Thread Marc Poulhiès
From: Piotr Trojanek Diagnostic entries are not supposed to be modified while compiling the code. Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * errid.ads (Diagnostic_Entries): Now a constant. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/errid.ads | 2 +

[COMMITTED 35/42] ada: Refine sanity check in Insert_Actions

2025-07-03 Thread Marc Poulhiès
From: Ronan Desplanques Insert_Actions performs a sanity check when it goes through an expression with actions while going up the three. That check was not perfectly right before this patch and spuriously failed when inserting range checks in some situation. This patch makes the check more robust

[COMMITTED 18/42] ada: Fix typo in comment

2025-07-03 Thread Marc Poulhiès
From: Ronan Desplanques gcc/ada/ChangeLog: * exp_ch7.adb (Build_Record_Deep_Procs): Fix typo in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch7.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch

[COMMITTED 22/42] ada: Fix crash with Finalizable in corner case

2025-07-03 Thread Marc Poulhiès
From: Ronan Desplanques The Finalizable aspect introduced controlled types for which not all the finalization primitives exist. This patch makes Make_Deep_Record_Body handle this case correctly. gcc/ada/ChangeLog: * exp_ch7.adb (Make_Deep_Record_Body): Fix case of absent Initialize

[COMMITTED 14/42] ada: Fix spurious Constraint_Error raised by 'Value of fixed-point types

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou This happens for very large Smalls with regard to the size of the mantissa, because the prerequisites of the implementation used in this case are not met, although they are documented in the head comment of Integer_To_Fixed. This change documents them at the beginning of the

[COMMITTED 37/42] ada: Fix check for elaboration order on subprogram body stubs

2025-07-03 Thread Marc Poulhiès
From: Piotr Trojanek Fix an assertion failure occurring when elaboration checks were applied to subprogram with a separate body. gcc/ada/ChangeLog: * sem_elab.adb (Check_Overriding_Primitive): Find early call region of the subprogram body declaration, not of the subprogram body

[COMMITTED 15/42] ada: Cleanup in type support subprograms code

2025-07-03 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_tss.adb (TSS): Refactor IF condition to make code smaller. * lib.adb (Increment_Serial_Number, Synchronize_Serial_Number): Use type of renamed object when creating renaming. * li

[COMMITTED 16/42] ada: Fix comment

2025-07-03 Thread Marc Poulhiès
From: Ronan Desplanques This patch fixes a misnaming of Make_Predefined_Primitive_Specs in a comment. gcc/ada/ChangeLog: * exp_ch3.adb (Predefined_Primitive_Bodies): Fix comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch3.adb | 2 +- 1 file changed, 1 ins

[COMMITTED 19/42] ada: Fix crash with Finalizable in corner case

2025-07-03 Thread Marc Poulhiès
From: Ronan Desplanques Since the introduction of the Finalizable aspect, there can be types for which Is_Controlled returns True but that don't have all three finalization primitives. The Generate_Finalization_Actions raised an exception in that case before this patch, which fixes the problem.

[COMMITTED 31/42] ada: Improve retrieval of nominal unconstrained type in extended return

2025-07-03 Thread Marc Poulhiès
From: Piotr Trojanek To reliably retrieve the nominal unconstrained type of object declared in extended return statement we need to rely on the Original_Node. gcc/ada/ChangeLog: * sem_ch3.adb (Check_Return_Subtype_Indication): Use Original_Node. Tested on x86_64-pc-linux-gnu, committed

[COMMITTED 13/42] ada: Fix comment

2025-07-03 Thread Marc Poulhiès
From: Ronan Desplanques This patch fixes a comment that wrongly stated that no dispatch entry for deep finalize was created for limited tagged types. gcc/ada/ChangeLog: * exp_ch3.adb (Make_Predefined_Primitive_Specs): Fix comment. Tested on x86_64-pc-linux-gnu, committed on master. --

[COMMITTED 09/42] ada: Remove Empty_Or_Error

2025-07-03 Thread Marc Poulhiès
From: Bob Duff Minor stylistic improvement: Remove Empty_Or_Error, and replace comparisons with Empty_Or_Error with "[not] in Empty | Error". (Found while working on VAST.) gcc/ada/ChangeLog: * types.ads (Empty_Or_Error): Remove. * atree.adb: Remove reference to Empty_Or_Error.

[COMMITTED 25/42] ada: Fix minor fallout of latest change

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou This adjusts the header of the renamed files and adds missing blank lines. gcc/ada/ChangeLog: * errid.ads: Adjust header to renaming and fix copyright line. * errid.adb: Adjust header to renaming and add blank line. * erroutc-pretty_emitter.ads: Adjus

[COMMITTED 17/42] ada: Enforce visibility of unit used as a parent instance of a child instance

2025-07-03 Thread Marc Poulhiès
From: Gary Dismukes In cases involving instantiation of a generic child unit, the visibility of the parent unit was mishandled, allowing the parent to be referenced in another compilation unit that has visibility of the child instance but no with_clause for the parent of the instance. gcc/ada/Ch

[COMMITTED 08/42] ada: Call Semantics when analyzing a renamed package

2025-07-03 Thread Marc Poulhiès
From: Viljar Indus Calling Semantics here will additionally update the reference to Current_Sem_Unit the renamed unit so that we will not receive bogus visibility errors when checking for self-referential with-s. gcc/ada/ChangeLog: * sem_ch10.adb(Analyze_With_Clause): Call Semantics ins

[COMMITTED 12/42] ada: Fix assertion failure on finalizable aggregate

2025-07-03 Thread Marc Poulhiès
From: Ronan Desplanques The Finalizable aspect makes it possible that Insert_Actions_In_Scope_Around is entered with an empty list of after actions. This patch fixes a condition that was not quite right in this case. gcc/ada/ChangeLog: * exp_ch7.adb (Insert_Actions_In_Scope_Around): Fix

[COMMITTED 11/42] ada: Remove unnecessary "return;" statements

2025-07-03 Thread Marc Poulhiès
From: Bob Duff A "return;" at the end of a procedure is unnecessary and misleading. This patch removes them. gcc/ada/ChangeLog: * checks.adb: Remove unnecessary "return;" statements. * eval_fat.adb: Likewise. * exp_aggr.adb: Likewise. * exp_attr.adb: Likewise.

[COMMITTED 21/42] ada: Refine subtypes in task-counting code

2025-07-03 Thread Marc Poulhiès
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * exp_ch3.adb (Count_Default_Sized_Task_Stacks): Refine subtypes of parameters; same for callsites. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch3.adb | 14 +++---

[COMMITTED 05/42] ada: Fix index bounds check in Super_Delete functions and procedures

2025-07-03 Thread Marc Poulhiès
From: Aleksandra Pasek gcc/ada/ChangeLog: * libgnat/a-strsup.adb (Super_Delete): Fix index check. * libgnat/a-stwisu.adb (Super_Delete): Likewise. * libgnat/a-stzsup.adb (Super_Delete): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/a

[COMMITTED 07/42] ada: Fix SPARK context discovery from within subunits

2025-07-03 Thread Marc Poulhiès
From: Piotr Trojanek When navigating the AST to find the enclosing subprogram we must traverse from subunits to the corresponding stub. gcc/ada/ChangeLog: * lib-xref-spark_specific.adb (Enclosing_Subprogram_Or_Library_Package): Traverse subunits and body stubs. Tested o

[COMMITTED 04/42] ada: Fix wrong conversion of controlled array with representation change

2025-07-03 Thread Marc Poulhiès
From: Eric Botcazou The problem is that a temporary is created for the conversion because of the representation change, and it is finalized without having been initialized. gcc/ada/ChangeLog: * exp_ch4.adb (Handle_Changed_Representation): Alphabetize local variables. Set the No

  1   2   3   4   5   6   7   8   9   10   >