[COMMITTED] ada: Remove outdated part of comment

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques The concept of extended nodes was retired with the introduction of variable-sized node types, but a reference to that concept was left over in a comment. This change removes that reference. gcc/ada/ * atree.ads: Remove outdated part of comment. Tested on x86_64-

[COMMITTED] ada: Remove a remaining reference to ?

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Arnaud Charlet We should no longer use ? anywhere when emitting warnings. gcc/ada/ * sem_aggr.adb (Get_Value): Use ?? instead of ?. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_aggr.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/g

[COMMITTED] ada: Fix crash on Ada.Containers with No_Dispatching_Calls restriction

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This makes it so that the compiler does not crash and flags the underlying violation of the restriction instead. gcc/ada/ * exp_ch3.adb (Freeze_Type): Do not associate the Finalize_Address routine for a class-wide type if restriction No_Dispatching_Calls

[COMMITTED] ada: Remove unreferenced utility routine Is_Actual_Tagged_Parameter

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Routine Is_Actual_Tagged_Parameter was added to detect unsupported SPARK 2005 constructs, but this feature was deconstructed in favor of SPARK 2014 and its SPARK_Mode aspects. gcc/ada/ * sem_util.ads (Is_Actual_Tagged_Parameter): Remove spec. * sem_util.adb

[COMMITTED] ada: Fix source location for crashes in expanded Loop_Entry attributes

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Historically, Loop_Entry attributes were expanded while expanding their corresponding loops, so it was easier to use location of these loops for expanded code. Now, these attributes are expanded where they appear, so we can easily use the location of the attribute reference f

[COMMITTED] ada: Remove extra parentheses

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Arnaud Charlet In preparation of enhancing -gnatyx to check for these automatically. gcc/ada/ * ali-util.adb, par-endh.adb, par-prag.adb, par-ch2.adb, checks.adb, fmap.adb, libgnat/a-nbnbig.ads, libgnat/g-dynhta.adb, libgnat/s-carun8.adb, libgnat/s-strcom.adb, libg

[COMMITTED] ada: Support calls through dereferences in Find_Actual

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Claire Dross Return the corresponding formal in the designated subprogram profile in that case. gcc/ada/ * sem_util.adb (Find_Actual): On calls through dereferences, return the corresponding formal in the designated subprogram profile. Tested on x86_64-pc-linux-gn

[COMMITTED] ada: Accept Assert pragmas in expression functions

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Steve Baird gcc/ada/ * sem_ch4.adb (Analyze_Expression_With_Actions.Check_Action_Ok): Accept an executable pragma occuring in a declare expression as per AI22-0045. This means Assert and Inspection_Point pragmas as well as any implementation-defined pragmas

[COMMITTED] ada: Improve -gnatyx style check

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Arnaud Charlet Check redundant parentheses in many more places, for now only under -gnatdQ, while pending violations are fixed. gcc/ada/ * par-ch3.adb, sem_ch4.adb (P_Discrete_Range, Analyze_Logical_Op, Analyze_Short_Circuit): Add calls to Check_Xtra_Parentheses. *

[COMMITTED] ada: Remove redundant protection against empty lists

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Calls to List_Length on No_List intentionally return 0 (and likewise call to First on No_List intentionally return Empty), so explicit guards against No_List are unnecessary. Code cleanup; semantics is unaffected. gcc/ada/ * exp_aggr.adb (Aggregate_Size): Remove red

[COMMITTED] ada: Fix spurious freezing error on nonabstract null extension

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This prevents the wrapper function created for each nonoverridden inherited function with a controlling result of nonabstract null extensions of tagged types from causing premature freezing of types referenced in its profile. gcc/ada/ * exp_ch3.adb (Make_Controlling_

[COMMITTED] ada: Fix spurious warning on Inline_Always and contracts

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Warnings about pre/postconditions being ignored with Inline_Always were only true for the obsolete frontend inlining. With the current backend pre/postconditions work fine with Inline_Always. gcc/ada/ * sem_prag.adb (Check_Postcondition_Use_In_Inlined_Subprogram): O

[COMMITTED] ada: Fix missing finalization in library-unit instance spec

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This fixes the missing finalization of objects declared in the spec of package instances that are library units (and only them, i.e. not all library-level package instances) when the instances have a package body. The finalization is done when there is no package body, and su

[COMMITTED] ada: Add warning on frontend inlining of Subprogram_Variant

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek We already warned when contracts like pre/postcondition appear together with pragma Inline_Always and they are ignored by the frontend inlining. For consistency we now also warn for Subprogram_Variant, which is similarly ignored even though this contract is only meaningful f

[COMMITTED] ada: Add Is_Past_Self_Hiding_Point flag

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff This patch adds a flag Is_Past_Self_Hiding_Point. When False, this will replace E_Void as the indicator for a premature use of a declaration within itself -- for example, "X : T := X;". One might think this flag should be called something like Is_Hidden_From_All_Visibility, revers

[COMMITTED] ada: Add missing word in comment

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques gcc/ada/ * par-ch3.adb: Add missing word in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/par-ch3.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb index 7126afbfbeb..a71

[COMMITTED] ada: Cleanup redundant condition in resolution of entity names

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup related to new contract for SPARK; semantics is unaffected. gcc/ada/ * sem_res.adb (Resolve_Entity_Name): Combine two IF statements that execute code only for references that come from source. Tested on x86_64-pc-linux-gnu, committed on master.

[COMMITTED] ada: Fix missing finalization in separate package body

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This directly comes from a loophole in the implementation. gcc/ada/ * exp_ch7.adb (Process_Package_Body): New procedure taken from... (Build_Finalizer.Process_Declarations): ...here. Call the above procedure to deal with both package bodies and packa

[COMMITTED] ada: Avoid repeated calls when looking for first/last slocs of a node

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek gcc/ada/ * errout.adb (First_Loc): Avoid repeated calls. (Last_Loc): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/errout.adb | 34 ++ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git

[COMMITTED] ada: Further fixes to GNATprove and CodePeer expression pretty-printer

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek The expression pretty-printer still crashes on several tests, but already gives much better outputs for many previously unsupported constructs. gcc/ada/ * pprint.adb (Expression_Image): Handle several previously unsupported constructs. Tested on x86_64-pc-l

[COMMITTED] ada: Use idiomatic construct in Expand_N_Package_Body

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou gcc/ada/ * exp_ch7.adb (Expand_N_Package_Body): Call Defining_Entity to get the entity of the body. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch7.adb | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/g

[COMMITTED] ada: Small cleanup in support for protected subprograms

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This moves the propagation of the Uses_Sec_Stack flag, from the original to the rewritten subprogram, to the point where the latter is expanded, along with the propagation of the Has_Nested_Subprogram flag, as well as addresses a ??? comment in the same block of code. No func

[COMMITTED] ada: Rename Is_Past_Self_Hiding_Point flag to be Is_Not_Self_Hidden

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff ...which seems clearer. Still work in progress. gcc/ada/ * cstand.adb (Is_Past_Self_Hiding_Point): Rename to be Is_Not_Self_Hidden. * einfo.ads: Likewise. * exp_aggr.adb: Likewise. * gen_il-fields.ads: Likewise. * gen_il-gen-gen_en

[COMMITTED] ada: Fix crash caused by incorrect expansion of iterated component

2023-05-22 Thread Marc Poulhiès via Gcc-patches
The way iterated component are expanded could lead to inconsistent tree. This change fixes 2 issues: - in an early step during Pre_Analyze, the loop variable still has Any_Type and the compiler must not emit an error. A later full Analyze is supposed to correctly set the Etype, and only then shou

[COMMITTED] ada: Incorrect constant folding in postcondition involving 'Old

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Justin Squirek The following patch fixes an issue in the compiler whereby certain flavors of access comparisons may be incorrectly constant-folded out of contract expressions - notably in postcondition expressions featuring a reference to 'Old. gcc/ada/ * checks.adb (Install_Null_

[COMMITTED] ada: Reuse idiomatic procedure in CStand

2023-05-22 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques This change replaces a call to Set_Name_Entity_Id with a call to the higher-level Set_Current_Entity. gcc/ada/ * cstand.adb: Use more idiomatic procedure. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/cstand.adb | 3 +-- 1 file changed, 1 ins

[COMMITTED] ada: Crash on dispatching primitive referencing limited-with type

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda The compiler crashes processing a compilation unit has limited-with context clauses, and the profile of some dispatching primitive references a type visible through a limited-with clause, and the dispatching primitive has class-wide preconditions. gcc/ada/ * sem_ch1

[COMMITTED] ada: Minor fix typo in comment

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Spotted while reviewing a patch with a similar typo. gcc/ada/ * libgnat/s-mmap.adb (Mapped_Region_Record): Fix typo in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/s-mmap.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-

[COMMITTED] ada: Small code cleanup

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This just merges two conditional blocks depending on the same condition. gcc/ada/ * frontend.adb (Frontend): Merge two conditional blocks and adjust. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/frontend.adb | 21 - 1 file ch

[COMMITTED] ada: Fix address arithmetic issues in the runtime

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This is most notably the addition of addresses in Interfaces.C.Pointers and System.Bitfield_Utils. There is also a change to System.Stream_Attributes, which was representing a thin pointer as a record, which is not problematic per se, but is in the end, because the expanded c

[COMMITTED] ada: Remove duplicate comment

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques gcc/ada/ * sem_ch7.adb: Remove duplicate comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch7.adb | 4 1 file changed, 4 deletions(-) diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 5021d0ee04f..2610a7bba4d 100644

[COMMITTED] ada: Transfer fix for pretty-printed parentheses from GNATprove to GNAT

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Expressions with parentheses are notoriously problematic to pretty-print. In GNATprove we had a post-processing fix for them, but it is better to have this fix in the GNAT frontend repository and apply it for CodePeer as well. gcc/ada/ * pprint.adb (Expression_Image

[COMMITTED] ada: Sync different variants of interrupt handler registration

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek This patch propagates the apparently cleanest solutions between various variants of the runtime units for interrupt handler registration. In particular, the unnecessary default expressions for list cells with interrupt handler addresses are removed, the list is changed from

[COMMITTED] ada: Add new switch -gnatyz

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Arnaud Charlet Improve -gnatyx to check additional complete conditions, and introduce a new switch -gnatyz to check for unnecessary parentheses according to operator precedence rules. Enable -gnatyz as part of -gnatyg. gcc/ada/ * par-ch5.adb, style.ads, styleg.adb, styleg.ads

[COMMITTED] ada: Fix expression pretty-printer for SPARK counterexamples

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek The expression pretty-printer that is used for SPARK counterexamples was essentially duplicating the logic of First_Node/Last_Node and First_Sloc/Last_Sloc routines. Now it simply reuses those routines. gcc/ada/ * errout.adb (Paren_Required): New subsidiary

[COMMITTED] ada: Revert to old pretty-printing of internal entities for CodePeer

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Add some defensive code to get pretty-printed CodePeer outputs for ACATS back to shape. At least some of this code appears to be redundant and perhaps unnecessary, but we can this up later. Expression pretty-printer should not be called with N_Defining_Identifier nodes at al

[COMMITTED] ada: Fix endings of pretty-printed numeric literals

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek When looking for the end of an numeric literal we consumed '+' and '-' characters, because they might appear in the exponent part. This was too aggressive when they separated the number from the subsequent operand, like in "123+456". Now we skip past numeric literals by stric

[COMMITTED] ada: Fix address manipulation issue in the tasking runtime

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The implementation of task attributes in the runtime defines an atomic clone of System.Address, which is awkward for targets where addresses and pointers have a specific representation, so this change replaces that with a pragma Atomic_Components on the Attribute_Array type.

[COMMITTED] ada: Add mention of what LSP stands for

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques There are multiple possible interpretations of "LSP". For example, "Language Server Protocol". This patch clarifies that the occurrences of "LSP" in GNAT's source code refer to the Liskov Substitution Principle. gcc/ada/ * einfo.ads: Mention full name of LSP. Te

[COMMITTED] ada: Suppress warning about Subprogram_Variant failing at run time

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Warning about check failing at run time is likely spurious for mutually recursive subprograms with multiple variant clauses. These will be non-trivial to detect, so we simply suppress the warning altogether for all subprogram variants. gcc/ada/ * exp_prag.adb (Expan

[COMMITTED] ada: Spurious errors on class-wide preconditions of private types

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda The compiler reports spurious errors processing the class-wide preconditions of a dispatching primitive of a private type T, when the class-wide precondition invokes another dispatching primitive of T that has the same name as a record component of T. gcc/ada/ * sem

[COMMITTED] ada: Make string interpolation part of the core extensions

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Raphael Amiard gcc/ada/ * scng.adb (Scan): Replace occurrences of All_Extensions_Allowed by Core_Extensions_Allowed. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/scng.adb | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/

[COMMITTED] ada: Fix internal error on quantified expression with predicated type

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The problem is that the special function created by the compiler to check the predicate does not inherit the public status of the type, because it is generated as part of the freezing of the quantified expression, which occurs from within a couple of intermediate internal scop

[COMMITTED] ada: Remove special-case for parentheses in expansion for GNATprove

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek When expanding of inequality operators for GNAT we were adding extra parens, supposedly to "fix Sprint output" (source print); for GNATprove we didn't, as these extra parens were leading to wrong columns for check messages. Adding these extra parens couldn't be a right, beca

[COMMITTED] ada: Add default value at initialization for CodePeer

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy Avoid spurious alarm by CodePeer analysis by adding default value for a variable initialization. gcc/ada/ * sem_util.adb (Check_Node): Add default init on local Id. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 3 ++- 1 file changed,

[COMMITTED] ada: Add tags to warnings controlled by Warn_On_Redundant_Constructs

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Some of the calls to Error_Msg_N controlled by the flag Warn_On_Redundant_Constructs missed the "?r?" tag in their message string. This caused a misleading "[enabled by default]" label to appear next to the error message. Spotted while adding a warning about duplicated choic

[COMMITTED] ada: Cleanup inconsistent iteration over exception handlers

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek When detecting duplicate choices in exception handlers we had inconsistent pairs of First/Next_Non_Pragma and First_Non_Pragma/Next. This was harmless, because exception choices don't allow pragmas at all, e.g.: when Program_Error | Constraint_Error | ...; -- pragma not

[COMMITTED] ada: Ignore accessibility actuals in expression pretty-printer

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Extra actual parameters for accessibility checks are confusing for the expression pretty-printer that is used by CodePeer. It seems that nodes created for the accessibility checks should use the Sloc of the source expression of accessibility checks, not the target. However, t

[COMMITTED] ada: Facilitate proof of Interfaces.C.To_Ada

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy Nightly runs of GNATprove fail on proof of the assertion following the loop. Add a loop invariant to facilitate that proof. gcc/ada/ * libgnat/i-c.adb (To_Ada): Add loop invariant. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/i-c.adb | 1 +

[COMMITTED] ada: ICE on BIP call in class-wide function return within instance

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Gary Dismukes The compiler blows up (such as with a Storage_Error or Assert_Failure) on a call to a limited build-in-place function occurring in the return for a function with a limited class-wide result. Such a function should include extra formals for a task master and activation chain (b

[COMMITTED] ada: Rework fix for internal error on quantified expression with predicated type

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou It turns out that skipping compiler-generated block scopes is problematic when computing the public status of a subprogram, because this subprogram may end up being nested in the elaboration procedure of a package spec or body, in which case it may not be public. This replace

[COMMITTED] ada: Remove unnecessary call to Detach.

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Vadim Godunko Holder object is constant and protected from modification by tampering rules. gcc/ada/ * libgnat/a-coinho__shared.adb (Constant_Reference): Remove call of Detach (Query_Element): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc

[COMMITTED] ada: Fix bogus error on predicated limited record declared in protected type

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This happens when the limited record is initialized with a function call because of a couple of issues: incorrect tree sharing when building the predicate check and too late freezing for a compiler-generated subtype. It turns out that building the predicate check manually is

[COMMITTED] ada: Accept and analyze new aspect Exceptional_Cases

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Add new aspect Exceptional_Cases, which is intended for SPARK and describes in which cases an exception will be raised, and optionally supply a postcondition that shall be verified in this case. The implementation is heavily modeled after Subprogram_Variant, which in turn wa

[COMMITTED] ada: Fix oversight in latest change

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The resolution must be identical inside and outside the System hierarchy. gcc/ada/ * sem_res.adb (Resolve_Intrinsic_Operator): Always perform the same resolution for the special mod operator of System.Storage_Elements. Tested on x86_64-pc-linux-gnu, committe

[COMMITTED] ada: Turn assertions into defensive code in error locations

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek We pretty-print numeric literals that do not come from source by relying on their Sloc. This generally works well, but sporadically the Sloc is set wrongly. We might want to trace and fix such occurrences, but for now it is simpler to replace an otherwise reasonable assertion

[COMMITTED] ada: Fix minor address arithmetic issues in System.Dwarf_Lines

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou Offset calculations should use the operator of System.Storage_Elements. gcc/ada/ * libgnat/s-dwalin.adb (Enable_Cache): Use the subtract operator of System.Storage_Elements to compute the offset. (Symbolic_Address): Likewise. Tested on x86_64-pc-linu

[COMMITTED] ada: Remove the body of System.Storage_Elements

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou All the subprograms declared in the unit have convention Intrinsic and their current implementation makes some implicit assumptions that are not valid universally, so it is replaced by a direct expansion. This is mostly straightforward because Resolve_Intrinsic_Operator alrea

[COMMITTED] ada: Update ghost code for proof of integer input functions

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Claire Dross Introduce new ghost helper functions to facilitate proof. gcc/ada/ * libgnat/s-valueu.adb (Scan_Raw_Unsigned): Use new helpers. * libgnat/s-vauspe.ads (Raw_Unsigned_Starts_As_Based_Ghost, Raw_Unsigned_Is_Based_Ghost): New ghost helper functions.

[COMMITTED] ada: Fix reference to Ada issue in comment

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques gcc/ada/ * sem_disp.adb: Fix reference to Ada issue in comment. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_disp.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb index b0

[COMMITTED] ada: Fix latent issue in support for protected entries

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The problem is that, unlike for protected subprograms, the expansion of cleanups for protected entries is not delayed when they contain package instances with a body, so the cleanups are generated twice and this may yield two finalizers if the secondary stack is used in the en

[COMMITTED] ada: A discriminant of a variable is not a variable

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Steve Baird gcc/ada/ * sem_util.adb (Is_Variable): Correctly return False for a selected component name of the form Some_Object.Some_Discriminant, even if Some_Object is a variable. We don't want to allow such a name as an actual parameter in a call

[COMMITTED] ada: Remove redundant parentheses from System.Stack_Checking.Operations

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Patrick Bernardi gcc/ada/ * libgnat/s-stchop.adb (Stack_Check): Remove redundant parentheses. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/s-stchop.adb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/ada/libgnat/s-stchop.ad

[COMMITTED] ada: Fix address arithmetic issues in the expanded code

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This is most notably the addition of addresses in Expand_Interface_Thunk. There is also a small change to Expand_Dispatching_Call, which was directly accessing a class-wide interface object as a tag, thus giving rise later to unchecked conversions between either the root or th

[COMMITTED] ada: Fix resolution of mod operator of System.Storage_Elements

2023-05-23 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This operator is special because the left operand is of Address type while the right operand and the result are of Storage_Offset type (but we raise Constraint_Error if the right operand is not positive) and it needs to be resolved to the type of the left operand to implement

[COMMITTED] ada: Accept aliased parameters in Exceptional_Cases

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Aliased parameters, just like parameters by-reference types, can safely appear in consequences of Exceptional_Cases aspect. gcc/ada/ * sem_res.adb (Resolve_Entity_Name): Allow aliased parameters; tune error message. Tested on x86_64-pc-linux-gnu, committed

[COMMITTED] ada: Restrict use of formal parameters within exceptional cases

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Restrict references to formal parameters within the new SPARK aspect Exceptional_Cases and allow occurrences of 'Old in this aspect. gcc/ada/ * sem_attr.adb (Analyze_Attribute_Old_Result): Allow uses of 'Old and 'Result within the new aspect.

[COMMITTED] ada: Fix SPARK context not restored when Load_Unit is failing

2023-05-25 Thread Marc Poulhiès via Gcc-patches
When Load_Unit fails to find the unit or encounters an error, the Load_Fail procedure is called and an exception is raised, skipping the restoration of the SPARK/Ghost context stored on procedure entry. gcc/ada/ * rtsfind.adb (Load_RTU.Restore_SPARK_Context): New. (Load_RTU): Use

[COMMITTED] ada: Minor fixes in description of scope depth

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou In particular, the scope depth of library units is 1 instead of 0. gcc/ada/ * einfo.ads (Scope_Depth): Fix circular definition. (Scope_Depth_Value): Fix value for library units. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/einfo.ads | 6

[COMMITTED] ada: Tune warning about assignment just before a raise statement

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Tune warning about a possibly ineffective assignment to a formal parameter that happens just before a raise statement. The warning is now emitted for parameters of all by-copy types and not just of scalar types (this gives more warnings), but is suppressed for aliased parame

[COMMITTED] ada: Fix obsolete comment in Sinfo.Utils

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff ...caused by moving code here from Atree. gcc/ada/ * sinfo-utils.adb: Update comment to refer to New_Node_Debugging_Output. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sinfo-utils.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) di

[COMMITTED] ada: Reduce span of variable

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques This patch does not change the behavior of the compiler, but is intended to improve readability. It seizes an opportunity to move a variable declaration to a smaller scope, so that it's clearer that the variable is not used outside of that scope. gcc/ada/ * sem_c

[COMMITTED] ada: Fix error message for Aggregate aspect

2023-05-25 Thread Marc Poulhiès via Gcc-patches
The error message was wrongly using % instead of & in the format string, causing the displayed message to refer to incorrect names in some cases. gcc/ada/ * sem_ch13.adb (Check_Aspect_At_Freeze_Point): fix format string, use existing local Ident. Tested on x86_64-pc-linux-gnu, co

[COMMITTED] ada: Handle controlling access parameters in DTWs

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques This patch improves the way controlling access parameters are handled in dispatch table wrappers. The constructions of both the specifications and the bodies of wrappers are modified. gcc/ada/ * freeze.adb (Build_DTW_Body): Add appropriate type conversions for

[COMMITTED] ada: Fix incorrect handling of Aggregate aspect

2023-05-25 Thread Marc Poulhiès via Gcc-patches
This change fixes 2 incorrect handlings of the aspect. The arguments are now correctly resolved and the aspect is rejected on non array types. gcc/ada/ * sem_ch13.adb (Analyze_One_Aspect): Mark Aggregate aspect as needing delayed resolution and reject the aspect on non-array

[COMMITTED] ada: Add missing supportive code for recently added SPARK aspects

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Fix minor inconsistencies with the recently added SPARK aspects Exceptional_Cases and Subprogram_Variant, whose implementation is based on Contract_Cases. gcc/ada/ * aspects.ads (Implementation_Defined_Aspect): Recently added aspects are implementati

[COMMITTED] ada: Fix internal error on declare-expression in post-condition

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou It comes from an incorrect node sharing in the expanded tree. gcc/ada/ * sem_ch3.adb (Find_Type_Of_Object): Copy the object definition when building the subtype declaration in the case of a spec expression. Tested on x86_64-pc-linux-gnu, committed on master.

[COMMITTED] ada: Enrich documentation of subprogram

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques This patch adds documentation to the subprogram Replace_Type in Sem_Ch3. In particular, references to relevant parts of the Ada reference manual are added. gcc/ada/ * sem_ch3.adb (Replace_Type): Add more documentation. Tested on x86_64-pc-linux-gnu, committed on

[COMMITTED] ada: Add Entry_Cancel_Parameter to E_Label

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff ...and other (minor) changes. gcc/ada/ * gen_il-gen-gen_entities.adb (E_Label): Add Entry_Cancel_Parameter. This is necessary because Analyze_Implicit_Label_Declaration set the Ekind to E_Label. Without this change, this field would fail the vanish

[COMMITTED] ada: Fix crash during function return analysis

2023-05-25 Thread Marc Poulhiès via Gcc-patches
The compiler would crash when checking type relation between the function's return type and the type of the expression used in the return statement. It would not work if the function's return type is an access type and the expression is not. gcc/ada/ * sem_ch6.adb (Analyze_Function_Return

[COMMITTED] ada: Set Is_Not_Self_Hidden flag in more cases

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff More work-in-progress for changing E_Void checks to the flag. gcc/ada/ * sem_ch9.adb (Analyze_Protected_Type_Declaration): Set the flag for protected types. (Analyze_Single_Protected_Declaration): Likewise, for singleton protected objects.

[COMMITTED] ada: Fix comments for recently added SPARK aspects

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Implementation of contract Subprogram_Variant and Exceptional_Cases was based on the existing code for Contract_Cases, i.e. on the existing occurrences of Aspect_Contract_Cases, Name_Contract_Cases and Pragma_Contract_Cases. However, occurrences of "Contract_Cases" itself in

[COMMITTED] ada: Prevent search of calls in preconditions from going too far

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek When determining whether a call to protected function appears within a pragma expression we can safely stop at the subprogram body. Cleanup related to recently added support for a new SPARK aspects, whose implementation was based on Contract_Cases. gcc/ada/ * sem_u

[COMMITTED] ada: Small tweak to implementation of by-copy semantics for storage models

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou Get_Actual_Subtype can be used to access the Actual_Designated_Subtype of explicit dereferences with a storage model. As a side effect, this also handles the case where the prefix of the dereference is a formal parameter. gcc/ada/ * exp_ch6.adb (Add_Simple_Call_By_Co

[COMMITTED] ada: Tune handling of attributes Old in contract Exceptional_Cases

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Contract Exceptional_Cases allows formal parameters to appear *in* prefixes of attributes Old, but the code only allowed them to appear *as* prefixes of those attributes. For example, we now accetp expressions like "X.all'Old" that were previously rejected. gcc/ada/

[COMMITTED] ada: Remove unused initial value of a local variable

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Cleanup related to improved handling of expression functions in GNATprove; semantics is unaffected. gcc/ada/ * sem_ch6.adb (Analyze_Return_Type): Remove unused initial value. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch6.adb | 2 +- 1 fi

[COMMITTED] ada: Maximize use of existing constant

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques This patch does not change the behavior of the compiler and is intended as a readability improvement. gcc/ada/ * sem_ch3.adb (Replace_Type): Use existing constant wherever possible. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch

[COMMITTED] ada: Clean up copying of node trees

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Before calling routine In_Entity_Map we checked if the entity map is present; inside this routine we checked this again. Code cleanup; semantics is unaffected. gcc/ada/ * sem_util.adb (Update_New_Entities): Remove redundant check for entity map being presen

[COMMITTED] ada: Deconstruct a no longer used parameter of New_Copy_Tree

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Parameter Scopes_In_EWA_OK of New_Copy_Tree was introduced in 2018 to deal with expressions-with-actions (EWA) in the build-in-place machinery. However, after changes made in 2022 it is no longer used by any caller. Cleanup related to handling of expression functions in GNAT

[COMMITTED] ada: Remove redundant guards from calls to Move_Aspects

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Routine Move_Aspects does nothing if its From parameter has no aspects. There is no need to check this at the call sites. Code cleanup related to changes in handling of expressions functions in GNATprove; semantics is unaffected. gcc/ada/ * par-ch7.adb (P_Package):

[COMMITTED] ada: Decouple size of addresses and pointers from size of memory space

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This decouples the size of the types representing addresses and pointers, which is Standard'Address_Size, from the size of the memory space, which is System.Memory_Size (more precisely log2 of it). They are tied through the definition of System.Address: type Address is mod

[COMMITTED] ada: Add size clause to System.Address

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou Standard'Address_Size is the value provided by the code generator for the size of pointers, and it is set as the default size of every thin pointer by the front-end. Now it is documented in the GNAT RM as having the value of System.Address'Size, which is indeed the case on (c

[COMMITTED] ada: Fix copy-paste mistake in analysis of Exceptional_Cases

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Trivial mistakes in copied code. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Fix references to Exceptional_Cases in code copied from handling of Subprogram_Variant. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 6 +++--- 1 f

[COMMITTED] ada: Switch from E_Void to Is_Not_Self_Hidden

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff We had previously used Ekind = E_Void to indicate that a declaration is self-hidden. We now use the Is_Not_Self_Hidden flag instead. This allows us to avoid many "vanishing fields", which are (possibly-latent) bugs, and we now enable the assertions in Atree that detect such bugs.

[COMMITTED] ada: Crash on empty aggregate using the Ada 2022 notation

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda The compiler crashes processing an empty aggregate initializing a component of a discriminated record type using the Ada 2022 notation (that is, []). gcc/ada/ * exp_aggr.adb (Build_Record_Aggr_Code): Protect access to aggregate components when the aggregate

[COMMITTED] ada: Fix (again) incorrect handling of Aggregate aspect

2023-05-25 Thread Marc Poulhiès via Gcc-patches
Previous fix stopped the processing of the Aggregate aspect early, skipping the call to Record_Rep_Item, making later call to Resolve_Container_Aggregate fail. Also, the previous fix would not handle correctly the case where the type is private and the check for non-array type can only be done at

[COMMITTED] ada: Avoid duplicated streaming subprograms

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Steve Baird In some common cases, a reference to Some_Type'Some_Streaming_Attribute causes the needed subprogram to be generated "on demand". If there are multiple such references (e.g., two calls to Some_Type'Write) then we want to avoid generating multiple essentially-identical subprogram

[COMMITTED] ada: Use procedural variant of Next_Index where possible

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * einfo-utils.adb (Write_Entity_Info): Use procedural Next_Index. * sem_aggr.adb (Collect_Aggr_Bounds): Reuse local constant. (Resolve_Null_Array_Aggregate): Use procedural Next_Index. Tested on x86_64

[COMMITTED] ada: Simplify copying of node lists

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek When creating a copy of a node list we called Copy_Entity for entities and Copy_Separate_Tree for other nodes. This was unnecessary, because the Copy_Separate_Tree when called on entities will just do Copy_Entity. Code cleanup; semantics is unaffected. gcc/ada/ * a

[COMMITTED] ada: Expect Exceptional_Cases as a context for attribute Old

2023-05-25 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek When determining whether attribute Old is evaluated conditionally, we must also expect it to appear in the recently added contract Exceptional_Cases. gcc/ada/ * sem_util.adb (Determining_Expressions): Fix style; fix layout and ordering of pragma names; expec

<    1   2   3   4   5   6   7   8   9   >