[COMMITTED] ada: Refactor the proof of the Value and Image runtime units

2023-07-06 Thread Marc Poulhiès via Gcc-patches
From: Claire Dross The aim of this refactoring is to avoid unnecessary dependencies between Image and Value units even though they share the same specification functions. These functions are grouped inside ghost packages which are then withed by Image and Value units. gcc/ada/ *

[COMMITTED] ada: Reuse code in Is_Fully_Initialized_Type

2023-07-06 Thread Marc Poulhiès via Gcc-patches
From: Viljar Indus gcc/ada/ * sem_util.adb (Is_Fully_Initialized_Type): Avoid recalculating the underlying type twice. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[COMMITTED] ada: Refer to non-Ada binding limitations in user guide

2023-07-06 Thread Marc Poulhiès via Gcc-patches
From: Viljar Indus The limitation of resetting the FPU mode for non 80-bit precision was not referenced from "Creating a Stand-alone Library to be used in a non-Ada context". Reference it the same way it is already referenced from "Interfacing to C". gcc/ada/ *

[COMMITTED] ada: Avoid crash in Find_Optional_Prim_Op

2023-07-06 Thread Marc Poulhiès via Gcc-patches
From: Viljar Indus Find_Optional_Prim_Op can crash when the Underlying_Type is Empty. This can happen when you are dealing with a structure type with a private part that does not have its Full_View set yet. gcc/ada/ * exp_util.adb (Find_Optional_Prim_Op): Stop deriving primitive

[COMMITTED] ada: Improve error message on violation of SPARK_Mode rules

2023-07-06 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy SPARK_Mode On can only be used on library-level entities. Improve the error message here. gcc/ada/ * errout.ads: Add explain code. * sem_prag.adb (Check_Library_Level_Entity): Refine error message and add explain code. Tested on x86_64-pc-linux-gnu,

[COMMITTED] ada: Finalization not performed for component of protected type

2023-07-06 Thread Marc Poulhiès via Gcc-patches
From: Steve Baird In some cases involving a discriminated protected type with an array component that is subject to a discriminant-dependent index constraint, where the element type of the array requires finalization and the array type has not yet been frozen at the point of the declaration of

[COMMITTED] ada: Do not unnecessarily use component-wise loop for slice assignment

2023-07-04 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This relaxes the condition under which Expand_Assign_Array leaves the assignment to or from an array slice untouched. The main prerequisite for the code generator is that everything be aligned on byte boundaries and Is_Possibly_Unaligned_Slice is too strong a predicate for

[COMMITTED] ada: Small adjustments to new procedure Expand_Unchecked_Union_Equality

2023-07-04 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The procedure is not stable under repeated invocation. Now it may be called twice on the same node, for example during the expansion of the renaming of the predefined equality operator after the unchecked union type is frozen. gcc/ada/ * exp_ch4.ads

[COMMITTED] ada: Fix list of inherited subprograms in query for GNATprove

2023-07-04 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy The query Inherited_Subprograms was returning a list containing some subprograms whose overridding was also in the list, when interfaces was present. This was an issue for GNATprove. Now propose a mode for this function to filter out overridden primitives. gcc/ada/ *

[COMMITTED] ada: Fix renaming of predefined equality operator for unchecked union types

2023-07-03 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The problem is that the predefined equality operator for unchecked union types is implemented out of line by invoking a function that takes more parameters than the two operands, which means that the renaming is not seen as type conforming with this function and, therefore,

[COMMITTED] ada: Fix discrepancy in expansion of untagged record equality

2023-07-03 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The expansion of the predefined equality operator for untagged record types can be done either in line, i.e. into the component-wise comparison of the operands, or out of line, i.e. into a call to a function implementing this comparison, and the heuristics of the selection

[COMMITTED] ada: Fix small inaccuracy in implementation of B.3.3(20/2)

2023-07-03 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This is the clause about inferable discriminants in unchecked unions. gcc/ada/ * sem_util.adb (Has_Inferable_Discriminants): In the case of a component with a per-object constraint, also return true if the enclosing object is not of an unchecked

[COMMITTED] ada: Fix bad interaction between inlining and thunk generation

2023-06-27 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This may cause the type of the RESULT_DECL of a function which returns by invisible reference to be turned into a reference type twice. gcc/ada/ * gcc-interface/trans.cc (Subprogram_Body_to_gnu): Add guard to the code turning the type of the RESULT_DECL into

[COMMITTED] ada: Make the identification of case expressions more robust

2023-06-27 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou gcc/ada/ * gcc-interface/trans.cc (Case_Statement_to_gnu): Rename boolean constant and use From_Conditional_Expression flag for its value. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/trans.cc | 8 +++- 1 file changed,

[COMMITTED] ada: Fix incorrect handling of iterator specifications in recent change

2023-06-27 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou Unlike for loop parameter specifications where it references an index, the defining identifier references an element in them. gcc/ada/ * sem_ch12.adb (Check_Generic_Actuals): Check the component type of constants and variables of an array type.

[COMMITTED] ada: Fix double finalization of case expression in concatenation

2023-06-27 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This streamlines the expansion of case expressions by not wrapping them in an Expression_With_Actions node when the type is not by copy, which avoids the creation of a temporary and the associated finalization issues. That's the same strategy as the one used for the

[COMMITTED] ada: Fix too late finalization and secondary stack release in iterator loops

2023-06-27 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou Sem_Ch5 contains an entire machinery to deal with finalization actions and secondary stack releases around iterator loops, so this removes a recent fix that was made in a narrower case and instead refines the condition under which this machinery is triggered. As a side

[COMMITTED] ada: Update printing container aggregates for debugging

2023-06-27 Thread Marc Poulhiès via Gcc-patches
From: Viljar Indus All N_Aggregate nodes were printed with parentheses "()". However the new container aggregates (homogeneous N_Aggregate nodes) should be printed with brackets "[]". gcc/ada/ * sprint.adb (Print_Node_Actual): Print homogeneous N_Aggregate nodes with brackets.

[COMMITTED] ada: Correct the contract of Ada.Text_IO.Get_Line

2023-06-27 Thread Marc Poulhiès via Gcc-patches
From: Claire Dross Item might not be entirely initialized after a call to Get_Line. gcc/ada/ * libgnat/a-textio.ads (Get_Line): Use Relaxed_Initialization on the Item parameter of Get_Line. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/a-textio.ads

[COMMITTED] ada: Plug small loophole in the handling of private views in instances

2023-06-27 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This deals with nested instantiations in package bodies. gcc/ada/ * sem_ch12.adb (Scope_Within_Body_Or_Same): New predicate. (Check_Actual_Type): Take into account packages nested in bodies to compute the enclosing scope by means of

[COMMITTED] ada: Plug another loophole in the handling of private views in instances

2023-06-27 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This deals with discriminants of types declared in package bodies. gcc/ada/ * sem_ch12.adb (Check_Private_View): Also check the type of visible discriminants in record and concurrent types. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: Fix expanding container aggregates

2023-06-27 Thread Marc Poulhiès via Gcc-patches
From: Viljar Indus Ensure that that container aggregate expressions are expanded as such and not as records even if the type of the expression is a record. gcc/ada/ * exp_aggr.adb (Expand_N_Aggregate): Ensure that container aggregate expressions do not get expanded as records

Re: [COMMITTED] ada: Add CHERI intrinsic bindings and helper functions.

2023-06-22 Thread Marc Poulhiès via Gcc-patches
Hi Alex, > On 20/06/2023 15:47, Marc Poulhiès wrote: >> Hi, >> >> >> The package Interfaces.CHERI provides intrinsic bindings and >> >> helper functions to allow software to query, create, and >> >> manipulate CHERI capabilities. >> &

Re: [COMMITTED] ada: Add CHERI intrinsic bindings and helper functions.

2023-06-20 Thread Marc Poulhiès via Gcc-patches
Hi, >> The package Interfaces.CHERI provides intrinsic bindings and >> helper functions to allow software to query, create, and >> manipulate CHERI capabilities. > > I'm curious what the motivation for these intrinsic wrappers is, given that > GCC trunk doesn't currently support them. Out of

[COMMITTED] ada: Further fixes to handling of private views in instances

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This removes more bypasses for private views in instances that are present in type predicates (Conforming_Types, Covers, Specific_Type and Wrong_Type), which in exchange requires additional work in Sem_Ch12 to restore the proper view of types during the instantiation of

[COMMITTED] ada: Minor tweaks

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) : Pass the NULL_TREE explicitly and test imported_p in lieu of Is_Imported. : Remove public_flag local variable and make extern_flag local variable a constant. Tested on

[COMMITTED] ada: Fix crash on inlining in GNATprove

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy After the recent change on detection of non-inlining, calls inside the iterator part of a quantified expression were not considered as preventing inlining anymore, leading to a crash later on inside GNATprove. Now fixed. gcc/ada/ * sem_res.adb (Resolve_Call): Fix

[COMMITTED] ada: Remove outdated comment

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques The Preelaborate pragma the removed comment was referring to was indeed present in AI 167, as well as in clause 5.3 of the rationale for Ada 2012, but it never made it into the 2012 version of the reference manual. gcc/ada/ * libgnarl/s-mudido.ads: Remove

[COMMITTED] ada: Fix couple of issues in documentation of overflow checking

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou There is still a mention of the defunct CHECKED mode and the Default Settings paragraph is confusing with regard to the -gnato switch. gcc/ada/ * doc/gnat_ugn/gnat_and_program_execution.rst (Overflows in GNAT) : Remove obsolete paragraph about -gnato.

[COMMITTED] ada: Fix for attribute Range in Exceptional_Cases

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Attribute Range is now handled like First and Last when occurring within the consequence of Exceptional_Cases, i.e. attribute Range is not considered to be a read of a formal parameter that would not be allowed in the contract. gcc/ada/ * sem_res.adb

[COMMITTED] ada: Do not issue warning on postcondition in some cases

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy Warning on suspicious postcondition is not relevant if contract Exceptional_Cases is present, or if contract Always_Terminates is present with a non-statically True value, as in those cases the postcondition can be used to indicate constraints on those pre-state for which the

[COMMITTED] ada: Add the ability to add error codes to error messages

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy Add a new character sequence [] for error codes in error messages handled by Error_Msg procedures, to use for SPARK-related errors. Display of additional information on the error or warning based on the error code is delegated to GNATprove. gcc/ada/ * err_vars.ads

[COMMITTED] ada: Fix for quantified expressions in Exceptional_Cases

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek When detecting illegal uses of formal parameters of the current subprogram in contract of its Exceptional_Cases, we relied on the Current_Scope. However, quantified expressions introduce an implicit scope, which we need to take into account. gcc/ada/ * sem_res.adb

[COMMITTED] ada: Introduce -gnateH switch to force reverse Bit_Order threshold to 64

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This can be helpful for legacy code that still makes use of an original reverse Bit_Order clause, i.e. without a Scalar_Storage_Order clause. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Compiler Switches): Document -gnateH. *

[COMMITTED] ada: Fix -fdiagnostics-format=json not printing all messages

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Ghjuvan Lacambre The previous version of this code stopped printing messages as soon as it encountered a deleted or continuation message. This was wrong, continuation and deleted messages can be followed by live messages that do need to be printed. gcc/ada/ * errout.adb

[COMMITTED] ada: Fix bug in predicate checks with address clauses

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff This patch fixes a compiler bug triggered by having a type with some defaulted components, and a predicate, and an object of that type with an address clause. In this case, the compiler was crashing. gcc/ada/ * sem_ch3.adb (Analyze_Object_Declaration): Remove

[COMMITTED] ada: Update annotations in runtime for proof

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy With bump of stable SPARK used for proof of the runtime, some annotations need to change. gcc/ada/ * libgnat/s-aridou.adb (Scaled_Divide): Add assertions. * libgnat/s-valuti.adb: Add Loop_Variant. * libgnat/s-valuti.ads: Add Exceptional_Cases on

[COMMITTED] ada: Remove references to Might_Not_Return and Always_Return

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Claire Dross The Might_Not_Return and Always_Return annotations for GNATprove should now be replaced by the two more precise aspects Exceptional_Cases and Always_Terminates. They allow to specify whether a subprogram is allowed to raise exceptions or fail to complete. gcc/ada/ *

[COMMITTED] ada: Fix fallout of fix to handling of private views in instances

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou Check_Actual_Type incorrectly switches the view of a private type declared in the enclosing scope of a generic unit but that has a private ancestor. gcc/ada/ * einfo.ads (Has_Private_Ancestor): Fix inaccuracy in description. * sem_ch12.adb

[COMMITTED] ada: Small fixes to handling of private views in instances

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The main change is the removal of the special bypass for private views in Resolve_Implicit_Dereference, which in exchange requires additional work in Check_Generic_Actuals and a couple more calls to Set_Global_Type in Save_References_In_Identifier. This also removes an

[COMMITTED] ada: Pass Error_Node to calls to Error_Msg in lib-load.adb

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Ghjuvan Lacambre When not passing Error_Node, Error_Msg will treat Current_Node as the node attached to the message. When this happens in lib-load.adb due to a file that cannot be loaded, Current_Node might reference a node that doesn't actually exist. This is a problem when using -gnatdJ

[COMMITTED] ada: Fix type derivation of subtype of derived type

2023-06-20 Thread Marc Poulhiès via Gcc-patches
Deriving from a subtype of a derived type of a private type, whose full view is itself a derived type of a discriminated record with a known discriminatant was failing with the error message: invalid constraint: type has no discriminant The compiler needs to use the full view to be able to

[COMMITTED] ada: Add CHERI intrinsic bindings and helper functions.

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Daniel King The package Interfaces.CHERI provides intrinsic bindings and helper functions to allow software to query, create, and manipulate CHERI capabilities. gcc/ada/ * libgnat/i-cheri.ads: Add CHERI intrinsics and helper functions. * libgnat/i-cheri.adb: Likewise

[COMMITTED] ada: Fix internal error on aggregate within container aggregate

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This just applies the same fix to Expand_Array_Aggregate as the one that was recently applied to Convert_To_Assignments. gcc/ada/ * exp_aggr.adb (Convert_To_Assignments): Tweak comment. (Expand_Array_Aggregate): Do not delay the expansion if the parent

[COMMITTED] ada: Spurious error on package instantiation

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda The compiler reports spurious errors processing the instantation of a generic package when the instantation is performed in the the body of a package that has a private type T, a dispatching primitive of T has the same name as a component of T, and an extension of T is used

[COMMITTED] ada: Fix edge case in Ada.Calendar.Formatting.Time_Of

2023-06-20 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques Before this patch, Ada.Calendar.Formatting.Time_Of executed extra code when passed a number of seconds equal to the number of seconds in a day. This caused the result to be off, perhaps because a statement resetting the number of seconds to zero was missing. Instead of

[COMMITTED] ada: Fix wrong finalization for double subtype of bounded vector

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The special handling of temporaries created for return values and subject to a renaming needs to be restricted to the top level, where it is needed to prevent dangling references to the frame of the elaboration routine from being created, because, at a lower level, the

[COMMITTED] ada: Make minor improvements to user's guide

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques gcc/ada/ * doc/gnat_ugn/about_this_guide.rst: Fix typo. Uniformize punctuation. * doc/gnat_ugn/the_gnat_compilation_model.rst: Uniformize punctuation. Fix capitalization. Fix indentation of code block. Fix RST formatting syntax errors.

[COMMITTED] ada: Fix wrong code for ACATS cd1c03i on Morello target

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou gcc/ada/ * gcc-interface/utils2.cc (build_binary_op) : Do not remove a VIEW_CONVERT_EXPR on the LHS if it is also on the RHS. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/utils2.cc | 8 ++-- 1 file changed, 6

[COMMITTED] ada: Reject Loop_Entry inside prefix of Loop_Entry

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy This rule was incompletely stated in SPARK RM and not checked. This is now fixed. gcc/ada/ * sem_attr.adb (Analyze_Attribute): Reject case of Loop_Entry inside the prefix of Loop_Entry, as per SPARK RM 5.5.3.1(4,8). Tested on x86_64-pc-linux-gnu, committed on

[COMMITTED] ada: Remove unused files

2023-06-15 Thread Marc Poulhiès via Gcc-patches
gcc/ada/ChangeLog: * vxworks7-cert-rtp-base-link.spec: Removed. * vxworks7-cert-rtp-base-link__ppc64.spec: Removed. * vxworks7-cert-rtp-base-link__x86.spec: Removed. * vxworks7-cert-rtp-base-link__x86_64.spec: Removed. * vxworks7-cert-rtp-link.spec:

[COMMITTED] ada: Fix internal error on loop iterator filter with -gnatVa

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The problem is that the condition of the iterator filter is expanded early, before it is integrated into an if statement of the loop body, so there is no place to attach the actions generated by this expansion. This happens only for simple loops, i.e. with a parameter

[COMMITTED] ada: Remove dead code in Expand_Iterator_Loop_Over_Container

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The Condition_Actions field can only be populated for while loops. gcc/ada/ * exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Do not insert an always empty list. Remove unused parameter Isc. (Expand_Iterator_Loop): Adjust call to above procedure.

[COMMITTED] ada: Fix too small secondary stack allocation for returned conversion

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The previous fix did not address a latent issue whereby the allocation would be made using the (static) subtype of the conversion instead of the (dynamic) subtype of the return object, so this change rewrites the code responsible for determining the type used for the

[COMMITTED] ada: Adjust comments in targparm.ads

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques This patch removes a few dangling references to the late front-end implementation of exceptions from the comments of targparm.ads, and also fixes a thinko there. gcc/ada/ * targparm.ads: Remove references to front-end-based exceptions. Fix thinko.

[COMMITTED] ada: Revert latest change to Find_Hook_Context

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The issue is that, if an aggregate is both below a conditional expression and above another conditional expression in the tree, we have currently no place to put the finalization actions generated by the innermost expression in the context of the aggregate before it is

[COMMITTED] ada: Adjust QNX Ada priorities to match QNX system priorities

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Johannes Kliemann The Ada priority range of the QNX runtime started from 0, differing from the QNX system priorities range starting from 1. As this may cause confusion, especially if used in a mixed language environment, the Ada priority range now starts at 1. The default priority of Ada

[COMMITTED] ada: Fix too small secondary stack allocation for returned aggregate

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This restores the specific treatment of aggregates that are returned through an extended return statement in a function returning a class-wide type, and which was incorrectly dropped in an earlier change. gcc/ada/ * exp_ch3.adb (Make_Allocator_For_Return): Deal

[COMMITTED] ada: Accept aspect Always_Terminates on entries

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek The recently added aspect Always_Terminates is allowed on both procedures and entries. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Accept pragma Always_Terminates when it applies to an entry. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: Fix missing finalization for aggregates nested in conditional expressions

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The finalization actions for the components of the aggregates are blocked by Expand_Ctrl_Function_Call, which sets Is_Ignored_Transient on all the temporaries generated from within a conditional expression whatever the intermediate constructs. Now aggregates and their

[COMMITTED] ada: Add escape hatch to configurable run-time

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques Before this patch, the fact that Restrictions pragmas had to fit on a single line in system.ads was difficult to reconcile with the 80-character line limit that is enforced in that file. The special rules for pragmas in system.ads made it impossible to us the

[COMMITTED] ada: Reject aspect Always_Terminates on functions and generic functions

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek The recently added aspect Always_Terminates is only allowed on procedures. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Reject pragma Always_Terminates when it applies to a function or generic function. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: Fix missing error on function call returning incomplete view

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou Testing for the presence of Non_Limited_View is not sufficient to detect whether the nonlimited view has been analyzed because Build_Limited_Views always sets the field on the limited view. Instead the discriminant is whether this nonlimited view is itself an incomplete

[COMMITTED] ada: Remove Ttypes.Max_Unaligned_Field

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This constant has been unused for ages. The corresponding getter function is also removed from the Get_Targ package, but the corresponding constant declared in Set_Targ is preserved for the sake of backward compatibility of the target file format. gcc/ada/ *

[COMMITTED] ada: Accept aspect Always_Terminates on packages

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek The recently added aspect Always_Terminates is now allowed on packages and generic packages, but only when it has no arguments. The intuitive meaning is that all subprograms declared in such a package are always terminating. gcc/ada/ * contracts.adb

[COMMITTED] ada: Fix minor issues in comments

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques The package Ttypef has been removed but a reference to it was left over in a comment. This patch removes that reference, and also fixes a typo. gcc/ada/ * ttypes.ads: Remove reference to Ttypef in comment. Fix typo in comment. Tested on

[COMMITTED] ada: Accept aspect Always_Terminates without expression

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek The recently added aspect Always_Terminates is now accepted without explicit boolean expression, where a missing expression implicitly means True, similar to aspects Async_Readers, Async_Writers, etc. gcc/ada/ * aspects.adb (Base_Aspect): Fix layout.

[COMMITTED] ada: Fix aspect Linker_Section ignored on subprogram body

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The compiler is waiting for the freeze node of the body, but it is never generated since the freezing of the body is not delayed. The change also removes an obsolete piece of code. gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Specifications): Add missing items

[COMMITTED] ada: Fix inverted implementation of RM 8.4(10) clause for operators

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The comment is correct but the code implements the opposite outcome. gcc/ada/ * sem_type.adb (Disambiguate): Fix pasto in the implementation of the RM 8.4(10) clause for operators. Tested on x86_64-pc-linux-gnu, committed on master. ---

[COMMITTED] ada: Crash on C++ constructor of private type

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda The compiler crashes compiling a function that has pragma CPP_constructor when its return type is a private type. gcc/ada/ * sem_util.adb (Is_CPP_Constructor_Call): Add missing support for calls to functions returning a private type. Tested on

[COMMITTED] ada: Remove obsolete references for Build_Transient_Object_Statements

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou gcc/ada/ * exp_util.ads (Build_Transient_Object_Statements): Remove obsolete references to array and record aggregates in documentation. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_util.ads | 6 +++--- 1 file changed, 3

[COMMITTED] ada: Cleanup analysis of iterated component association

2023-06-15 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Cleanups related to analysis of iterated component association for GNATprove. gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Simplify comment. (Resolve_Iterated_Component_Association): Tune comment; change variable to constant. Tested

[COMMITTED] ada: Fix decoration of iterated component association for GNATprove

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek This patch is an alternative solution for a recent fix in analysis of iterated component association. To recap, if the iterated expression is an aggregate, we want to propagate the component type downward with a call to Resolve_Aggr_Expr; otherwise we want this expression

[COMMITTED] ada: Fix another case of missing Has_Private_View flag

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou It occurs for the case of a function call first parsed as an identifier. gcc/ada/ * sem_ch12.adb (Save_References_In_Identifier): In the case where the identifier has been turned into a function call by analysis, call Set_Global_Type on the entity if

[COMMITTED] ada: Recognize iterated_component_association as repeatedly evaluated

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek As iterated_component_association is an array_component_association (because of a grammar rule Ada 2022 RM 4.3.3(5/5)), its expression is repeatedly evaluated (because of Ada 2022 RM 6.1.1(22.14/5)). With this patch we will now get errors for both conjuncts in this code,

[COMMITTED] ada: Recognize iterated_component_association as potentially unevaluated

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Routine Is_Potentially_Unevaluated was written for Ada 2012, but now we use it for Ada 2022 as well, so it must recognize iterated component associations (which were added by Ada 2022) as an array component association. gcc/ada/ * sem_util.adb

[COMMITTED] ada: Fix iterated component initialization

2023-06-13 Thread Marc Poulhiès via Gcc-patches
The call to Resolve_Aggr_Expr may leave references to temporary entities used to check for the construct legality and meant to be removed. Using Preanalyze_And_Resolve correctly guarantees that there is no visible occurrence of such entities. gcc/ada/ * sem_aggr.adb

[COMMITTED] ada: Disable inlining in potentially unevaluated contexts

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Instead of explicitly disabling inlining in quantified expressions, (which happen to be only preanalysed) and then disabling inlining in potentially unevaluated contexts that are fully analysed (which happen to include quantified expressions), we now simply disable inlining

[COMMITTED] ada: Fix spurious error on call to function returning private in generic

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The spurious error is given on a call to a parameterless function returning a private type, present in the body of a generic construct both declared and instantiated in the presence of the full view of the type, because this full view is not properly restored for the

[COMMITTED] ada: Implement new aspect Always_Terminates for SPARK

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek This patch allows subprograms to be annotated with aspect Always_Terminates that requires a boolean expression. When this expression evaluates to True, the subprogram is required to terminate or raise an exception, but not loop infinitely. This aspect is only meant to be

[COMMITTED] ada: Mark attribute Initialized as ghost code

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy Implement the SPARK RM change that defines attribute Initialized as being ghost, i.e. only allowed where a ghost entity would be allowed. gcc/ada/ * ghost.adb (Check_Ghost_Context): Allow absence of Ghost_Id for attribute. Update error message to mention

[COMMITTED] ada: Skip elaboration checks for abstract subprograms on derived types

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Elaboration checks skip abstract subprogram declarations, which have no body that could be examined. Now these checks also skip abstract subprograms of a derived type, which have no body either. gcc/ada/ * sem_elab.adb (Check_Overriding_Primitive): Prevent

[COMMITTED] ada: Streamline expansion of controlled actions for aggregates

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This changes the strategy used to expand controlled actions for array and record aggregates so as to make it simpler and more robust. The current strategy is to set the No_Ctrl_Actions flag on the assignments generated during the expansion of aggregate, as done during the

[COMMITTED] ada: Use ghost predicate in standard library

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy In preparation for attribute Initialized to become ghost, use aspect Ghost_Predicate instead of Predicate in unit Ada.Strings.Superbounded of the standard library. gcc/ada/ * libgnat/a-strsup.ads: Change predicate aspect. * sem_ch13.adb (Add_Predicate): Fix

[COMMITTED] ada: Add missing ss_mark/ss_release in quantified expressions

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff If a quantified expression says "for all ... of F(...)" where F(...) is a function call that returns on the secondary stack, we need to clean up the secondary stack. This patch adds the required ss_mark/ss_release in that case. gcc/ada/ * exp_ch4.adb

[COMMITTED] ada: Fix exception raised on invalid contract in generic package

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This lets the compiler give a proper error message instead. gcc/ada/ * contracts.adb (Contract_Error): New exception. (Add_Contract_Item): Raise Contract_Error instead of Program_Error. (Add_Generic_Contract_Pragma): Deal with Contract_Error. Tested

[COMMITTED] ada: Remove unreferenced routine Is_Inherited_Operation_For_Type

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Remove routine that is no referenced after deconstructing of restriction SPARK_05. gcc/ada/ * sem_util.ads (Is_Inherited_Operation_For_Type): Remove spec. * sem_util.adb (Is_Inherited_Operation_For_Type): Remove body. Tested on x86_64-pc-linux-gnu,

[COMMITTED] ada: Remove wrong comment about expansion of exceptions for GNATprove

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup related to handling exceptions in GNATprove. gcc/ada/ * exp_ch11.adb (Expand_N_Raise_Statement): Expansion of raise statements never happens in GNATprove mode. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch11.adb | 8

[COMMITTED] ada: Fix internal error on imported function with post-condition

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The problem, which is also present for an expression function, is that the function is invoked in the initializing expression of a variable declared in the same declarative part as the function, which causes the freezing of its artificial body before the post-condition is

[COMMITTED] ada: Remove obsolete code in Analyze_Assignment

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This code was dealing with build-in-place calls for nonlimited types, but they no longer exist since Is_Build_In_Place_Result_Type => Is_Limited_View. gcc/ada/ * sem_ch5.adb (Analyze_Assignment): Turn Rhs into a constant and remove calls to the following

[COMMITTED] ada: Cleanup finding of locally handled exception handlers

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup related to handling exceptions in GNATprove; semantics is unaffected. gcc/ada/ * exp_ch11.adb (Find_Local_Handler): Replace guard against other constructs appearing in the list of exception handlers with iteration using

[COMMITTED] ada: Fix wrong expansion of limited extension aggregate

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This happens when the ancestor part is itself an aggregate: in this case, the tag of the extension aggregate is wrongly set to that of the ancestor. gcc/ada/ * exp_aggr.adb (Build_Record_Aggr_Code): In the case of an extension aggregate of a limited type

[COMMITTED] ada: Small housekeeping work in expansion of extension aggregates

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This avoids repeatedly calling Unqualify on the same node, removes a dead call to Generate_Finalization_Actions, a redundant setting of Assignment_OK and reuses a local variable more consistently. No functional changes. gcc/ada/ * exp_aggr.adb

[COMMITTED] ada: Cleanup expansion of locally handled exception handlers

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup related to handling exceptions in GNATprove; semantics is unaffected. gcc/ada/ * exp_ch11.ads (Find_Local_Handler): Fix typo in comment. * exp_ch11.adb (Find_Local_Handler): Remove redundant check for the Exception_Handler list being

[COMMITTED] ada: Add No_Elaboration_Code_All pragma to System.Storage_Elements

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Daniel King Allows System.Storage_Elements to be used in units that have the No_Elaboration_Code_All restriction. gcc/ada/ * libgnat/s-stoele.ads: Add No_Elaboration_Code_All pragma. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/s-stoele.ads | 3 +++

[COMMITTED] ada: Factor common processing in expansion of aggregates

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The final processing at the component level of array aggregates and record aggregates is very similar, so this factors out the common processing into three new library-level subprograms. There should be no functional changes, but the expanded code may be changed in the case

[COMMITTED] ada: Tune style in detection of writable function actuals

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Cleanup; semantics is unaffected. gcc/ada/ * sem_util.adb (Check_Function_Writable_Actuals): Tune style; use subtype name to detect membership test nodes. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 10 ++ 1

[COMMITTED] ada: Factor out tag assignments from type in expander

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou They are performed in a few different places during expansion. gcc/ada/ * exp_util.ads (Make_Tag_Assignment_From_Type): Declare. * exp_util.adb (Make_Tag_Assignment_From_Type): New function. * exp_aggr.adb (Build_Record_Aggr_Code): Call the above

[COMMITTED] ada: Fix expansion of aggregates with controlled components

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The expansion is incorrect in the case where the initialization expression of a component is a conditional expression that has a function call as one of its dependent expressions, leading to a wrong order of initialization, adjustment and finalization. gcc/ada/ *

[COMMITTED] ada: Simplify appending to a newly created list

2023-06-13 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * exp_disp.adb (Make_Disp_Asynchronous_Select_Spec): Use a single call to New_List. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_disp.adb | 6 +++--- 1 file changed, 3 insertions(+),

<    3   4   5   6   7   8   9   10   11   12   >