[Ada] Plug minor loophole for integer named number

2019-10-10 Thread Pierre-Marie de Rodat
Analyze_Number_Declaration contains a fast track for the case where the expression of an integer named number is a literal, but it fails to set the Debug_Info_Needed flag on the named number. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-10-10 Eric Botcazou gc

[Ada] Flag Sec_Stack_Used incorrectly set by ghost code

2019-10-10 Thread Pierre-Marie de Rodat
Correct an issue where ghost code will set the flag Sec_Stack_Used even though the code will be eliminated and result in the program not using the secondary stack. This could confuse the binder into importing objects from System.Secondary_Stack even though that package is not in the program's closu

[Ada] Fix awkward placement of freeze node for actual subtype

2019-10-10 Thread Pierre-Marie de Rodat
In the case where the tyoe of the formal has a predicate, the compiler generates a freeze node for the actual subtype of the formal that is placed just before the declaration of that subtype. No big deal, but awkward enough as to warrant a correction. No functional changes. Tested on x86_64-pc-l

[Ada] Spurious restriction violation on Ghost code

2019-10-10 Thread Pierre-Marie de Rodat
This patch fixes a spurious error when expanding the code for a function that appears in a Ghost context, when return return type of the function is unconstrainedm and the restriction No_Secondary_Stack is active. Running this command: gcc -c repro_main.adb On the following sources: with Boun

[Ada] Spurious visibility error on formal package with Abstract_State

2019-10-10 Thread Pierre-Marie de Rodat
Compiler rejects a formal package in a generic unit, when the corresponding generic package includes the SPARK aspect Abstract_State, and the name introduced by the aspect is referenced in the generic package. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-10-10 Ed Schonberg gcc/ada/

[Ada] Do not inline subprograms with deep parameter/result in GNATprove

2019-10-10 Thread Pierre-Marie de Rodat
Subprograms with a parameter or function result with deep type should not be inlined in the special mode for GNATprove, as inlining may lead to spurious violations of SPARK borrow-checking rules for pointers. There is no impact on compilation and thus no test. Tested on x86_64-pc-linux-gnu, commi

[Ada] Ensure constructor is a C++ constructor

2019-10-10 Thread Pierre-Marie de Rodat
Freeze_Subprogram has special handling of C++ constructor interfacing. This is currently implicit but assuming we introduce other conventions (e.g. Java) the current code won't hold. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-10-10 Arnaud Charlet gcc/ada/ * freeze.adb (Fr

[Ada] Handling up-level references in loops within library-level declarations

2019-10-10 Thread Pierre-Marie de Rodat
For GNAT-LLVM, we now wrap top-level loop statements in library package declaration lists within a procedure when there are nested subprograms within the loop that might make up-level references to entities of the loop (or to entities of loops and blocks nested within the outer loop for that matter

[Ada] Assertion_Policy (Ignore) ignores invariants

2019-10-10 Thread Pierre-Marie de Rodat
A pragma Assertion_Policy (Ignore) was ignored with respect to invariants; invariants are checked even in the presence of this pragma. This patch fixes that bug. Running these commands: gcc -S -fverbose-asm -g ess-main.adb -gnata grep Invariant ess-main.s On the following sources: pragma As

[Ada] Fix inlining of subprograms with deep param/result in GNATprove

2019-10-10 Thread Pierre-Marie de Rodat
In the special inlining done for GNATprove, subprograms with parameters or result of deep type (i.e. containing an access type) should not be inlined. This was the purpose of a previous patch. But this should not be applied to private types whose completion has SPARK_Mode Off, as these types are no

[Ada] Add pragma Preelaborable_Initialization to Stream_IO.File_Type

2019-10-10 Thread Pierre-Marie de Rodat
Pragma Preelaborable_Initialization is added to type File_Type in package Ada.Streams.Stream_IO, per the Binding Interpretation of AI12-0102. No other source or tool changes are required. No test needed. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-10-10 Gary Dismukes gcc/ada/

[Ada] Generation of procedures for blocks occurring in elaboration code for LLVM

2019-10-10 Thread Pierre-Marie de Rodat
For compilers such as GNAT-LLVM that requiring unnesting of subprograms that make up-level references, the GNAT front end needs to check for block statements occurring within elaboration of library-level packages, and transform those into procedures that can be passed an activation-record parameter

[Ada] Unnesting issues with entry families and accept statements

2019-10-10 Thread Pierre-Marie de Rodat
The case of a protected entry family body with a nested subprogram wasn't recognized for purposes of unnesting, leading to unhandled up-level references, because Has_Nested_Subprogram was incorrectly returning False. This was due to Set_Has_Nested_Subprogram not being called on the procedure create

[Ada] Spurious warning on call with out parameter in expression function

2019-10-10 Thread Pierre-Marie de Rodat
If the exprsssion in an expression function includes a function call with an out-parameter, the corresponding assignment may be flagged as redundant because it is analyzed twice, once in the expression function and once in the body constructed for it. Running this command: gcc -c -gnatg warn.ad

[Ada] Get rid of spurious error for _Tag on extension with reverse bit order

2019-10-10 Thread Pierre-Marie de Rodat
This prevents the compiler from issuing a spurious error for the _Tag component of a tagged record extension if the parent type has a Bit_Order clause specifying the reverse order and a component clause. The cause is a simple off-by-one bug in the artificial component clause synthetized for the _Ta

[Ada] Change pragma Compile_Time_Error to force compile-time evaluation

2020-05-25 Thread Pierre-Marie de Rodat
Issue an error now when the expression in pragma Compile_Time_Error cannot be evaluated at compile time. This allows static analyzers like GNATprove to rely on such expressions always being False. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-05-25 Yannick Moy gcc/ada/ * doc

[Ada] Fix spurious error on checking of null Abstract_State

2020-05-25 Thread Pierre-Marie de Rodat
A declaration of an object inside a declare block of elaboration code should not count as hidden state of the package. Nor should declarations inside a task or an entry. Now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-05-25 Yannick Moy gcc/ada/ * sem_util.adb (Check

[Ada] Spurious accessibility error on return aggregate in GNATprove mode

2020-05-25 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby valid actuals within return aggregates could trigger spurious accessibility errors in GNATprove mode. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-05-25 Justin Squirek gcc/ada/ * sem_ch6.adb (Check_Return_Obj_Accessibility): Use original

[PATCH 1/2] gcc-changelog: remove file descriptor leaks

2020-05-26 Thread Pierre-Marie de Rodat
Currently, running gcc-changelog's unit tests may clutter the output with tons of warnings such as: .../contrib/gcc-changelog/git_email.py:40: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpt5okd4qp.patch' mode='r' encoding='UTF-8'> lines = open(self.filename).re

[PATCH 2/2] gcc-changelog: handle entries with multi-line file lists

2020-05-26 Thread Pierre-Marie de Rodat
This extends the ChangeLog entries parsing machinery to handle entries that cover multiple files spanning over multiple lines. For instance: * first_file_patched.c, second_file_patched.c, third_file_patched.c, fourth_file_patched.c: Do things. contrib/ * gcc-changelog/git_commit.

Re: [PATCH 1/2] gcc-changelog: remove file descriptor leaks

2020-05-26 Thread Pierre-Marie de Rodat
On 26/05/2020 17:04, Martin Liška wrote: Oh, that's new for me. I've never seen the warning. Please install the patch. That was the first time I saw it as well. :-) I just pushed the commit on master. -- Pierre-Marie de Rodat

Re: [PATCH 2/2] gcc-changelog: handle entries with multi-line file lists

2020-05-26 Thread Pierre-Marie de Rodat
install it with the change. Done and pushed. Thank you for the quick review! -- Pierre-Marie de Rodat

[PATCH] gcc-changelog: enhance handling of renamings

2020-05-27 Thread Pierre-Marie de Rodat
So far, we expect from a commit that renames a file to contain a changelog entry only for the new name. For example, after the following commit: $ git move foo bar $ git commit We expect the following changelog: * bar: Renamed from foo. Git does not keep track of renamings, only file d

Re: [PATCH] gcc-changelog: enhance handling of renamings

2020-05-28 Thread Pierre-Marie de Rodat
t. We'll need here a skip based on version of unidiff. So something like: @pytest.mark.skipif ? I'm going to prepare a counter-part for mklog that can also handle file renaming. Thanks! The updated patch is attached. -- Pierre-Marie de Rodat >From 42b48c97cb30bcc1b05679ced3cb946551b

Re: [PATCH] gcc-changelog: enhance handling of renamings

2020-05-28 Thread Pierre-Marie de Rodat
On 28/05/2020 11:09, Martin Liška wrote: On 5/28/20 11:05 AM, Pierre-Marie de Rodat wrote: Thanks! The updated patch is attached. The patch is fine, please install it. Now pushed. Thank you again. -- Pierre-Marie de Rodat

[Ada] Reuse Is_Package_Or_Generic_Package where possible

2020-06-02 Thread Pierre-Marie de Rodat
Replace a low-level Ekind_In with a high-level Is_Package_Or_Generic_Package wrapper where possible. Arguably the wrapper was introduced to make the code easier to read, so let's use it; semantics is unaffected. Modified expressions were detected with: $ grep "Ekind_In " *|grep E_Package|grep E

[Ada] Do not set the bounds of integer types to be universal

2020-06-02 Thread Pierre-Marie de Rodat
This changes the type set on the bounds of signed integer types declared by the programmer: instead of Universal_Integer, it is set to the anonymous base type created by the declaration. The reason is that Universal_Integer must be a type as large as the largest supported integer type and, therefo

[Ada] Fix bogus error for clause on derived type with variant part

2020-06-02 Thread Pierre-Marie de Rodat
This prevents the compiler from giving a bogus error message on the representation clause specified for a discriminated record type that is derived from an untagged discriminated record type with a variant part, when the representation clause gives overlapping positions to components in different v

[Ada] Fix small oversight in latest change for Replace_Discriminants

2020-06-02 Thread Pierre-Marie de Rodat
This prevents the compiler from giving a bogus error on a discriminated record type derived from an untagged discriminated record type with a variant part, when the subtype of the discriminant of the former is more constrained than that of the latter and the variant part contains a discrete choice

[Ada] Use Standard.Natural on indices in support routines for Ada.Tags

2020-06-02 Thread Pierre-Marie de Rodat
This changes the type set on indices and ranges that are made of integer literals in the support routines for Ada.Tags generated during expansion: instead of Universal_Integer, it is set to Standard.Natural, which is the index type used in a-tags.ads. The reason is that Universal_Integer must be a

[Ada] Unnesting bugs with array renamings generated for quantified expr

2020-06-02 Thread Pierre-Marie de Rodat
A quantified expression for an array object within a postcondition (and presumably in other contexts) results in the creation of a renaming of the array object (such as the formal parameter of the enclosing postcondition procedure), and when the array's corresponding subtype has nonstatic bounds th

[Ada] Fix minor discrepancy in Expand_N_Attribute_Reference

2020-06-02 Thread Pierre-Marie de Rodat
This fixes a minor discrepancy in Expand_N_Attribute_Reference, which still thinks that the Alignment primitive operation for tagged types is a function call returning Integer, while it's a selected component returning Natural these days. No functional changes. Tested on x86_64-pc-linux-gnu, comm

[Ada] Remove dead code for detecting hidden package state

2020-06-02 Thread Pierre-Marie de Rodat
When climbing the chain of scopes (using Sinfo.Scope) we always process unique entities, e.g. an E_Procedure even for entities that syntactically reside in E_Subprogram_Body; same for tasks, entries and packages. There is no need to expect E_Package_Body, because it never occurs. The removed dead

[Ada] Use Standard.Natural on bit references to packed arrays

2020-06-02 Thread Pierre-Marie de Rodat
This changes the type set on bit references made to packed arrays: instead of Universal_Integer, it is set to Standard.Natural. The reason is that Universal_Integer must be a type as large as the largest supported integer type and, therefore, can be much larger than what is really needed here. No

[Ada] ICE during unnesting when nested subprograms have address taken

2020-06-02 Thread Pierre-Marie de Rodat
When doing subprogram unnesting for GNAT-LLVM (or CCG), the compiler can crash when it tries to access an unreachable enclosing subprogram that contains nested subprograms that are marked reachable due to having Access or Unchecked_Access applied to them. This is fixed by ensuring that the subprogr

[Ada] Remove degenerate Treat_Fixed_As_Integer mechanism

2020-06-02 Thread Pierre-Marie de Rodat
The Treat_Fixed_As_Integer mechanism has been degenerate for quite some time and the flag is only set on divide nodes at this point. We can use the same trick as in the multiply case to get rid of it altogether, with the positive by-product that the compiler will stop doing divisions of small fixe

[Ada] Statement SCO code for degenerate subprograms

2020-06-02 Thread Pierre-Marie de Rodat
Use statement SCO code 'X' to specifically identify the statement SCOs for degenerate subprogram bodies (null procedures and expression functions). This allows coverage analysis tools to apply specific processing for these cases if necessary, and ensures consistency with SCOs generated through sour

[Ada] Accept objects from nested packages in Initializes contract

2020-06-02 Thread Pierre-Marie de Rodat
Objects and abstract states declared in nested packages should be allowed to appear in the Initializes contract of the enclosing package. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-02 Piotr Trojanek gcc/ada/ * sem_prag.adb (Collect_States_And_Objects): Call itself on

[Ada] Compiler crash processing controlled type primitive

2020-06-02 Thread Pierre-Marie de Rodat
The compiler crashes processing the body of dispatching primitive that is a function whose controlling type is a tagged private type and its full view is a derivation of a controlled type. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-02 Javier Miranda gcc/ada/ * sem_util

[Ada] Get rid of more references to Universal_Integer in expanded code

2020-06-02 Thread Pierre-Marie de Rodat
This further tweaks the expanded code generated by the front-end, so as to avoid having references to Universal_Integer reaching the code generator, either directly or indirectly through attributes returning Universal_Integer. The reason is that Universal_Integer must be a type as large as the lar

[Ada] Remove ASIS_Mode

2020-06-02 Thread Pierre-Marie de Rodat
In order to simplify the long term maintenance of the GNAT frontend, support for generating trees for ASIS is removed from trunk. ASIS is being phased out at this stage in favor of Libadalang. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-02 Arnaud Charlet gcc/ada/ * atre

[Ada] Get rid of more references to Universal_Integer in expanded code

2020-06-02 Thread Pierre-Marie de Rodat
This further tweaks the expanded code generated by the front-end, so as to avoid having references to Universal_Integer reaching the code generator, either directly or indirectly through attributes returning Universal_Integer. There is also a minor tweak to the a-sequio.adb unit of the runtime to t

[Ada] Remove -gnatt switch processing

2020-06-03 Thread Pierre-Marie de Rodat
ASIS is now maintained on a separate branch, so newer compilers no longer need to generate ASIS trees. First remove processing of -gnatt, then in a second stage, we'll remove all associated code. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Arnaud Charlet gcc/ada/ * s

[Ada] Remove ASIS tree generation

2020-06-03 Thread Pierre-Marie de Rodat
This patch removes completely the processing associated with -gnatt. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Arnaud Charlet gcc/ada/ * aspects.adb, aspects.ads, atree.adb, atree.ads, elists.adb, elists.ads, fname.adb, fname.ads, gnat1drv.adb, lib.adb,

[Ada] More efficient System.Random_Numbers.Random_Discrete for 32-bit types

2020-06-03 Thread Pierre-Marie de Rodat
The current implementation is suboptimal for 32-bit or smaller types because it does the computation in Universal_Integer and can generate checks. That's unnecessary in the common case, i.e. for integer types or enumeration types with contiguous representation. No functional changes. Tested on x

[Ada] Get rid of more references to Universal_Integer in expanded code

2020-06-03 Thread Pierre-Marie de Rodat
This fixes a couple of places to using the standard idiom for choosing an appropriately-sized integer type. No practical change since the old and the new type are effectively identical. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Eric Botcazou gcc/ada/ * exp_attr.ad

[Ada] Debug info not available on subp having a class-wide precondition

2020-06-03 Thread Pierre-Marie de Rodat
The debugger doesn't allow stepping into a subprogram when the subprogram has a class-wide precondition (or postcondition). The compiler generates wrappers for such subprograms and creates a new "class-wide clone" of the subprogram, and the Needs_Debug_Info flag isn't set on the clone subprogram's

[Ada] Unnesting problems with expansion of Loop_Entry attribute

2020-06-03 Thread Pierre-Marie de Rodat
For expansion of a Loop_Entry attribute, a function body is generated in association with the condition of a generated while loop, and the entities within the function need to have their scopes reset to the function Entity_Id, for proper handling of up-level-reference processing in the GNAT-LLVM co

[Ada] Minor change to comment in System.Regexp spec

2020-06-03 Thread Pierre-Marie de Rodat
Fix the comment about the form of a 'term'. Allow a sequence of elmts, in {...}, but not nested {...}. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Bob Duff gcc/ada/ * libgnat/s-regexp.ads: Fix comment--- gcc/ada/libgnat/s-regexp.ads +++ gcc/ada/libgnat/s-regexp.ads @

[Ada] Avoid creating temporaries in Universal_Integer for range checks

2020-06-03 Thread Pierre-Marie de Rodat
This extends the exception made for attribute references in the code generating range checks to the simple expressions containing a single attribute reference, thus avoiding to create a temporary whose type is Universal_Integer when the attribute returns Universal_Integer, which is the common case.

[Ada] Incorrect accessibility checking on aliased formals

2020-06-03 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby the compiler incorrectly omits static and dynamic accessibility checks on explicitly aliased parameters within functions. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Justin Squirek gcc/ada/ * libgnat/a-cborse.adb, libgnat/a-cihase.ad

[Ada] Improve handling of SPARK_Mode in generic instances

2020-06-03 Thread Pierre-Marie de Rodat
SPARK_Mode aspect/pragma used to signal parts of the code in SPARK is now allowed to be Off inside generic instantiations for parts of the code that should not be considered in SPARK. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Yannick Moy gcc/ada/ * rtsfind.adb (Loa

[Ada] Small improvement to Expand_N_Unchecked_Type_Conversion

2020-06-03 Thread Pierre-Marie de Rodat
This extends the constant folding done in the procedure to literals of enumeration types. This is just a matter of calling Expr_Rep_Value in lieu of Expr_Value on the operand, since the result is the bit pattern. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-0

[Ada] Small housekeeping work in Check_Private_View

2020-06-03 Thread Pierre-Marie de Rodat
This reverts a series of 3 old changes made without real explanation to the second main case of Check_Private_View, which appear to be largely obsolete by now and have made it quite hard to follow, and also changes it to using In_Open_Scopes as the other cases. No functional changes. Tested on x8

[Ada] Iterate with procedural versions of Next_... routines where possible

2020-06-03 Thread Pierre-Marie de Rodat
Routines like Next_Index and Next_Formal are implemented both as procedures and functions. The procedure variant seems meant to be used when iterating, e.g.: Next_Formal (Formal); because it is more readable than the corresponding functions: Formal := Next_Formal (Formal); (and it is inli

[Ada] Remove more cases of empty loops

2020-06-03 Thread Pierre-Marie de Rodat
We introduce new functions to detect a list of statements with no side effects as well as a loop with no side effect so that we can then mark them for removal. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Arnaud Charlet gcc/ada/ * sem_util.ads, sem_util.adb (Side_Effe

[Ada] Initial infrastructure for adding a tree checker

2020-06-03 Thread Pierre-Marie de Rodat
This is part of a larger project to add a tree checker in GNAT to check that the GNAT tree out of expansion is properly formed before passing it to the code generator. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Arnaud Charlet gcc/ada/ * frontend.adb (Frontend): Call

[Ada] Get rid of more references to Universal_Integer in expanded code

2020-06-03 Thread Pierre-Marie de Rodat
This changes a few places in the System.Atomic_Operations packages to using static expressions, which guarantees that contant folding is done in the front-end instead of the code generator. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Eric Botcazou gcc/

[Ada] Avoid creating temporaries in Universal_Integer, continued

2020-06-03 Thread Pierre-Marie de Rodat
This gets rid of one more case where the front-end would create a temporary in Universal_Integer type, which is unnecessary. The reason is that Universal_Integer must be a type as large as the largest supported integer type and, therefore, can be much larger than what is really needed here. No fu

[Ada] Get rid of more references to Universal_Integer in expanded code

2020-06-03 Thread Pierre-Marie de Rodat
This further tweaks the expanded code generated by the front-end for attributes returning Universal_Integer, in particular removes hardcoded references to it and fixes a couple of type mismatches in the process. The only observable change is that 'Val is now expanded by the front-end for integer t

[Ada] Improve 'Val implementation for some enumeration types

2020-06-03 Thread Pierre-Marie de Rodat
This improves the expanded code generated by the front-end for the Val, Pred and Succ attributes when they are applied to an enumeration type with a non-standard but contiguous representation. There is no need to call the Rep_To_Pos routine to generate the required constraint checks in this case,

[Ada] Support pragma Allow_Integer_Address on 64-bit targets

2020-06-03 Thread Pierre-Marie de Rodat
This implements the documented semantics of the pragma for operators, that is to say, introduces an implicit unchecked conversion from the integer value to type System.Address, thus making the pragma work on 64-bit targets as well. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Eri

[Ada] Spurious ineffective with clause warnings on use type clause

2020-06-03 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby the compiler generates spurious ineffective with_clause warnings under -gnatwr when the only use of the with'ed package occurs in a use_type clause in the context area of the body of the target package and such use_type clause has multiple prefixes. Tested on x86_

[Ada] Fix for missing calls to Adjust primitive with nested generics

2020-06-03 Thread Pierre-Marie de Rodat
This changes the strategy for dealing with the limitations of the Has_Private_View mechanism, which is responsible for updating the views in instantiations of a type first declared as private; this is necessary because the views of a type may be different at the declaration point of a generic and a

[Ada] Add detection of uninitialized big reals

2020-06-03 Thread Pierre-Marie de Rodat
This was there for big integers after the previous code changes but not (yet) for big reals, now done. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-03 Arnaud Charlet gcc/ada/ * libgnat/a-nbnbin.ads: Minor reformatting. * libgnat/a-nbnbre.ads, libgnat/a-nbnbre.adb

[Ada] Avoid buffer overflow in Long_Long_Float_Text_IO

2020-06-04 Thread Pierre-Marie de Rodat
The internal packages used to implement Ada.Text_IO.Float_IO declare some String variables that need to be large enough to hold the longest possible images computed by Float_IO. If Exp is specified to be zero and Aft is specified to be Text_IO.Field'Last then the computed image of Long_Long_Float'L

[Ada] Add another ad-hoc case to the Has_Private_View mechanism

2020-06-04 Thread Pierre-Marie de Rodat
This adds another ad-hoc treatment to Copy_Generic_Node for the case of type conversions involving access types designing private types, when the Designated_Type is not referenced in the generic tree. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Eric Botcazou gcc/ada/

[Ada] New procedure Register_Global_Unhandled_Action

2020-06-04 Thread Pierre-Marie de Rodat
Provided to enhance the GNAT.Exception_Actions API and allowing registration of an action on unhandled exceptions (e.g. Core_Dump). Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Arnaud Charlet gcc/ada/ * libgnat/a-exextr.adb (Global_Unhandled_Action): New global

[Ada] Remove System.Parameters.Single_Lock

2020-06-04 Thread Pierre-Marie de Rodat
This setting has never been used in practice and isn't tested, so remove it. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Arnaud Charlet gcc/ada/ * libgnarl/a-dynpri.adb, libgnarl/a-taside.adb, libgnarl/a-taster.adb, libgnarl/s-interr.adb, libgnarl/s-i

[Ada] Set convention and inlined flag on default null procedure

2020-06-04 Thread Pierre-Marie de Rodat
This slightly tweaks the null procedure generated for a subprogram default in a generic instantiation: as per RM 12.6 (16 2/2), the convention is explicitly set to Intrinsic, and the procedure is also marked inlined. This has two main effects: first, to help the algorithm computing the setting of

[Ada] Small tweak to special handling of private index types

2020-06-04 Thread Pierre-Marie de Rodat
This both extends the special handling applied to private index types in array type declarations to generic packages and restricts it to the index types defined in the same scope as the array type, which is the original intent of the code. This fixes the discrepancy between the direct compilation

[Ada] Fix fallout of cleanup to Has_Private_View mechanism

2020-06-04 Thread Pierre-Marie de Rodat
The Has_Private_View mechanism is also applied to actuals of the instantiations and there is the same issue for array type actuals whose component type is the actual of a preceding formal as for global types whose component type is not referenced in the tree. This can happen for nested instantiati

[Ada] Fix glitch for N_Delta_Aggregate/N_Case_Expression/N_Quantified_Expression

2020-06-04 Thread Pierre-Marie de Rodat
The Etype of the first 2 nodes is set during type resolution by procedure Resolve_Delta_Aggregate and Resolve_Case_Expression, whereas the Etype of the last one is not. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Eric Botcazou gcc/ada/ * sinfo.ads (N_Delta_Aggregate)

[Ada] Fix Is_Absolute_Path on Windows

2020-06-04 Thread Pierre-Marie de Rodat
The Windows filename D:dir\name mean the path relative to drive D current directory. Windows has current directory on each drive separately. The D:dir\name was treated absolute before this fix. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Dmitriy Anisimkov gcc/ada/ *

[Ada] Alignment clause ignored on completion derived from private type

2020-06-04 Thread Pierre-Marie de Rodat
This fixes the discrepancy visible between an alignment clause put on a type derived from a private type and an alignment clause put on a completion derived from the same private type, for example: with System.OS_Interface; package P is type T is limited private; type V is new System.OS_Inter

[Ada] Missing accessibility check on access discriminant in extended return

2020-06-04 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby the compiler may fail to issue static accessibility errors on access discriminants within subtype indications within extended return statements. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Justin Squirek gcc/ada/ * sem_ch6.adb (Check

[Ada] Add missing conversion in call to Finalize primitive

2020-06-04 Thread Pierre-Marie de Rodat
This makes sure that Convert_View adds the unchecked conversion from actual to formal type in the case where the type of the actual is derived from a private formal type and for the Finalize primitive; the same trick is already used for the call to the Adjust primitive. That's necessary since Unde

[Ada] Implement AI12-0275 (Make subtype_mark optional in object renamings)

2020-06-04 Thread Pierre-Marie de Rodat
This set of changes implements the Ada 202X shorthand feature of object renamings that don't specify an explicit subtype (they have neither a subtype_mark nor an access_definition), taking their subtype from the renamed object (which must be denoted by an unambiguous name). Tested on x86_64-pc-lin

[Ada] Fix a couple of oversights in previous change

2020-06-04 Thread Pierre-Marie de Rodat
This adds a missing guard in Make_Final_Call for illegal cases and make sure Build_Derived_Private_Type does a full derivation in the new handled cases. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Eric Botcazou gcc/ada/ * exp_ch7.adb (Make_Final_Call): Add missing gu

[Ada] Revamp dump and aux output names

2020-06-04 Thread Pierre-Marie de Rodat
This change accepts the new -dumpbase-ext and the preexisting -dumpdir options as internal GCC options. It also marks the obsolete -auxbase and -auxbase-strip options for future removal. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Alexandre Oliva gcc/ada/ * switch.a

[Ada] Import Adafinal as convention Ada

2020-06-04 Thread Pierre-Marie de Rodat
This is in general harmless but can cause inconsistencies on some targets. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Arnaud Charlet gcc/ada/ * bindgen.adb (Gen_Adafinal): Adafinal is convention Ada, not C.--- gcc/ada/bindgen.adb +++ gcc/ada/bindgen.adb @@ -457,7 +4

[Ada] Wrong walk order in Walk_Library_Items

2020-06-04 Thread Pierre-Marie de Rodat
We need to process the main spec later in Walk_Library_Items in order to avoid forward references in e.g. CCG. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Arnaud Charlet gcc/ada/ * sem.adb (Walk_Library_Items): Defer processing of main spec after all other sp

[Ada] Update the documentation in checks.ads about range checks

2020-06-04 Thread Pierre-Marie de Rodat
This documents that range checks are now entirely generated by the front-end of the compiler. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Eric Botcazou gcc/ada/ * checks.ads: Update documentation about range checks and fix minor other things.--- gcc/ada/check

[Ada] Remove OpenACC support

2020-06-04 Thread Pierre-Marie de Rodat
Remove the experimental support for OpenACC in GNAT which has never been really used and is no longer maintained. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Arnaud Charlet gcc/ada/ * back_end.adb, opt.ads, par-prag.adb, sem_ch5.adb, sem_prag.adb, sinfo.adb,

[Ada] Put_Image attribute

2020-06-04 Thread Pierre-Marie de Rodat
First cut at implementation of the Put_Image attribute. Work in progress. Support for Put_Image is currently disabled (see Enable_Put_Image in exp_put_image.adb). Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Bob Duff gcc/ada/ * libgnat/a-stobbu.adb, libgnat/a-stobbu.

[Ada] Ada_2020: contracts for formal subprograms

2020-06-04 Thread Pierre-Marie de Rodat
AI12-0272 specifies that pre- and postconditions can be given for formal subprograms. In the presence of these contracts the formal subprogram cannot be treated simply as a renaming of the actual, but instead we must create a subgprogram wrapper that carries the specified contracts and calls the ac

[Ada] New package Ada.Task_Initialization

2020-06-04 Thread Pierre-Marie de Rodat
This package provides a way to set up a global initialization handler when tasks start. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-04 Arnaud Charlet gcc/ada/ * Makefile.rtl: add a-tasini object * impunit.adb (Non_Imp_File_Names_95): Add s-tasini. * libg

[Ada] AI12-0144 Make Discrete_Random more flexible

2020-06-05 Thread Pierre-Marie de Rodat
A new version of Random is provided to provide more flexibility on the range of values returned, see the Ada AI for more details. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-05 Arnaud Charlet gcc/ada/ * libgnat/a-nudira.ads, libgnat/a-nudira.adb (Random): New fu

[Ada] Add No_Truncation flag on view conversion for GNAT-LLVM

2020-06-05 Thread Pierre-Marie de Rodat
This puts the No_Truncation flag on the unchecked conversion built for converting between the prefix of 'Valid_Scalars and the view of its type as returned by Validated_View for scalar types. This is needed in order to prevent GNAT-LLVM from masking out the bits outside the RM size of the prefix,

[Ada] Assertion_Policy (Ignore) ignores invariants

2020-06-05 Thread Pierre-Marie de Rodat
Previous check-in for this ticket was incomplete. It did not properly cover invariants inherited from one type to another. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-05 Bob Duff gcc/ada/ * einfo.adb, einfo.ads, exp_util.adb: Remove Invariants_Ignored flag.

[Ada] AI12-0207 Convention of anonymous access types

2020-06-05 Thread Pierre-Marie de Rodat
This AI was already implemented except for the case of array components which is done here. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-05 Arnaud Charlet gcc/ada/ * sem_prag.adb (Set_Convention_From_Pragma): Set the convention of anonymous access array component

[Ada] AI12-0237 Getting the representation of an enumeration value

2020-06-05 Thread Pierre-Marie de Rodat
Attributes Enum_Rep/Enum_Val are now standard in Ada 202x, so adjust their handling accordingly. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-05 Arnaud Charlet gcc/ada/ * sem_attr.ads (Attribute_Impl_Def): Remove Enum_Rep/Val. * sem_attr.adb (Attribute_20): New,

[Ada] Add missing Global contract to Ada.Containers.Functional_Vectors

2020-06-05 Thread Pierre-Marie de Rodat
While annotating Ada.Containers.Functional_Vectors unit with Global/Pre/Post contracts we omitted its First function. This was most likely because it is an expression function and we though that Global will be generated, while Pre/Post will be effectively provided by inlining. However, GNATprove s

[Ada] Fix assertion failure on double rederivation of private type

2020-06-05 Thread Pierre-Marie de Rodat
As shown by the testcase, Build_Derived_Private_Type still does not handle properly multiple rederivations of a private type initially derived as a completion. In order to address this, this changes factors out the retrieval of the full and underlying full views of the parent type into an helper f

[Ada] Move routine for detecting special Text_IO packages from GNATprove

2020-06-05 Thread Pierre-Marie de Rodat
In GNATprove we were detecting special Text_IO packages by looking at the Ada[_Wide[_Wide]]_Text_IO_Child subtypes provided by the frontend Rtsfind spec. However, it seems more elegant to hide those subtypes in the Rtsfind body and only expose a single query routine. This patch implements this rout

[Ada] Put_Image attribute

2020-06-05 Thread Pierre-Marie de Rodat
Misc cleanup in preparation for further work on Put_Image and Image. Mostly removal of redundant or obvious comments. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-05 Bob Duff gcc/ada/ * exp_attr.adb, exp_ch11.adb, exp_imgv.adb, exp_tss.ads, par-ch4.adb, sem_attr.

[Ada] Do not create an empty list of nodes that confuses GNATprove

2020-06-05 Thread Pierre-Marie de Rodat
Frontend typically expands record aggregates to an N_Aggregate node with Expressions field set to No_List; for example, in Step_8 of the Sem_Aggr.Resolve_Record_Aggregate routine. In the GNATprove backend we never traverse this field, but we have an assertion to confirm that the Expressions field i

[Ada] Rename parameter of routines in Checks

2020-06-05 Thread Pierre-Marie de Rodat
This renames the Ck_Node parameter of some routines in Checks to the more consistent Expr, which is used and documented by other routines. In order to avoid any shadowing, parameters of a few child procedures are also renamed (although no actual shadowing would have occurred). No functional chang

[Ada] Optimize Normalize_Pathname

2020-06-05 Thread Pierre-Marie de Rodat
No need to get current directory if Directory parameter is absolute pathname. No need to convert Windows drive letter to upper case and slash to backslash in Normalize_Pathname.Get_Directory on Windows because it is alredy done in Normalize_Pathname body processing. Avoid recursion together with r

[Ada] Support 'Reduce under -gnatX

2020-06-05 Thread Pierre-Marie de Rodat
There are still ongoing discussions about the usefulness of this as a language attribute, so keep it under -gnatX for now. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-05 Arnaud Charlet gcc/ada/ * scng.adb (Scan): Fix typo to take into account all future versions

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