[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

[Ada] Fix punctuation in description of Enum_Rep attribute

2020-06-05 Thread Pierre-Marie de Rodat
Style guides might disagree whether "i.e." should be followed by a comma, but certainly it should not be followed by a comma and a colon. Also, this colon was inconsistent with how the same phrase is punctuated when describing Enum_Val. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-05

[Ada] Fix incorrect initialization for array of non-standard enumeration type

2020-06-05 Thread Pierre-Marie de Rodat
This prevents the compiler from generating an incorrect call to a memset primitive for the initialization of an array, whose component type is an enumeration type with a non-standard representation, by means of an aggregate with a single Others choice. The predicate Aggr_Assignment_OK_For_Backend

[Ada] Add note about gnatcov reliance on thunk names

2020-06-05 Thread Pierre-Marie de Rodat
Add a note indicating that the names generated for interface thunks should not be changed without reflecting the change in gnatcoverage, as it relies on that information to exclude thunks from source coverage. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-05 Thomas Quinot gcc/ada/

[Ada] Simplify iteration over components

2020-06-05 Thread Pierre-Marie de Rodat
Instead of iterating with First_Entity/Next_Entity and then detecting components with Ekind, it feels simpler to iterate with First_Component/ Next_Component. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-05 Piotr Trojanek gcc/ada/ * einfo.adb: Minor reformatting.

[Ada] Make the Has_Dynamic_Range_Check flag obsolete

2020-06-05 Thread Pierre-Marie de Rodat
This flag is set on N_Subtype_Declaration nodes and on all expression nodes to prevent checks from being generated multiple times for the same node. It was probably deemed necessary because semantic analysis and expansion for Ch3 tread on each other's toes and can generate the same check twice, in

[Ada] Spurious error on address clause in task body

2020-06-05 Thread Pierre-Marie de Rodat
Compiler rejects an aspect specification for Address on a local variable in a task body, when the expression for the address is the address of a previous local object in the same task body. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-05 Ed Schonberg gcc/ada/ * sem_ch9.a

[Ada] Update comment for processing of pragma Assertion_Policy

2020-12-14 Thread Pierre-Marie de Rodat
The code for pragma Assertion_Policy has been recently updated to include Subprogram_Variant and change the kind of Default_Initial_Condition, but the comment was not modified. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sa_messages.ads: Reference Subprogram_Variant in t

[Ada] Adjust documentation of System.Img_Util.Set_Decimal_Digits

2020-12-14 Thread Pierre-Marie de Rodat
The routine is now used both for decimal and for ordinary fixed-point types. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-imguti.ads (Set_Decimal_Digits): Adjust documentation.diff --git a/gcc/ada/libgnat/s-imguti.ads b/gcc/ada/libgnat/s-imguti.ads --- a/gcc/ada

[Ada] Correctly mark subprogram as not always inlined in GNATprove mode

2020-12-14 Thread Pierre-Marie de Rodat
In GNATprove mode, a call inside a Subprogram_Variant should lead to the called subprogram being marked as not always inlined. This was not always the case, now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * inline.adb (Cannot_Inline): Add No_Info parameter to disabl

[Ada] Tidy up implementation of System.Fat_Gen.Valid and inline it again

2020-12-14 Thread Pierre-Marie de Rodat
Besides the improved commentary, the removal of superfluous subtypes and other small tweaks throughout to make it more readable, this replaces the use of T'Mantissa by the more appropriate T'Machine_Mantissa in the body of System.Fat_Gen.Valid and also removes an unnecessary trick used to distingui

[Ada] Fix analysis of access objects in Depends contracts

2020-12-14 Thread Pierre-Marie de Rodat
In the Depends/Refined_Depends contracts we now accept constant objects as the dependency outputs if they are of an access-to-variable type, but not when they are of an access-to-constant or access-to-subprogram types. This needs to be implemented in two places: for checking the Depends contract a

[Ada] Avoid reanalysis of malformed dependency relations

2020-12-14 Thread Pierre-Marie de Rodat
When analysis of pragma Depends/Refined_Depends returns early because of a malformed pragma, it marks the pragma as analyzed to avoid repeated work. This is now done consistently for all early returns. Cleanup only; the GNAT and GNATprove behaviours are not really affected by this patch. Tested

[Ada] Compiler crash on call to function instance

2020-12-14 Thread Pierre-Marie de Rodat
This patch fixes a bug that causes the compiler to crash if a renaming-as-body renames a function that is an instance of a generic function that returns a generic formal type, and the actual type is controlled, and the instantiation is nested within a procedure. Tested on x86_64-pc-linux-gnu, comm

[Ada] Fix couple of bugs in the implementation of Round attribute

2020-12-14 Thread Pierre-Marie de Rodat
The first issue is that the attribute leaks into a multiplication or a division explicitly done in another fixed-point type before being passed to the attribute. The second issue is that the attribute is ignored for simple conversions from another fixed-point type. Tested on x86_64-pc-linux-gnu,

[Ada] Simplify prevention of cascaded errors for Refined_State

2020-12-14 Thread Pierre-Marie de Rodat
The condition for adding a dummy constituent is now simpler (and seems more robust) and the dummy constituent is Any_Id (which exists precisely for avoiding cascaded errors). Finally, an assertion guards against returning with an ill-formed refinement. Cleanup only; the tool behaviour is unaffecte

[Ada] armhf-linux: symbolic tracebacks

2020-12-14 Thread Pierre-Marie de Rodat
Implement non-symbolic tracebacks as a first step towards symbolic. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * tracebak.c: Add a section for ARM Linux.diff --git a/gcc/ada/tracebak.c b/gcc/ada/tracebak.c --- a/gcc/ada/tracebak.c +++ b/gcc/ada/tracebak.c @@ -309,6 +309,1

[Ada] Remove double initialization of the known value cache

2020-12-14 Thread Pierre-Marie de Rodat
Global variable CV_Cache, where values known at compilation time are stored, was initialization both by elaboration and by Sem_Eval.Initialize, which is called from Gnatdrv1 and required by the GNSA (GNAT Semantic Analyzer). Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * se

[Ada] Additional fixes for Default_Initial_Condition

2020-12-14 Thread Pierre-Marie de Rodat
After the recent implementation work for the Default_Initial_Condition aspect there were still some cases where DIC checks weren't performed properly with respect to calls to Initialize in the case of array and record components of controlled types. That is now corrected. There was also an issue of

[Ada] Implement AI12-0398-1/03

2020-12-14 Thread Pierre-Marie de Rodat
This commit implements AI12-0398-1/03, which adds the ability to specify aspects on discriminant specifications, extended return object declarations and entry index specifications. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * par-ch3.adb (P_Discriminant_Part_Opt): Parse a

[Ada] Adjust previous change to System.Fat_Gen

2020-12-14 Thread Pierre-Marie de Rodat
This removes the use clause for System.Unsigned_Type and replaces it with a localized use type clause for Long_Long_Unsigned. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-fatgen.adb: Remove use clause for System.Unsigned_Types. (Scaling): Add ren

[Ada] Adjust again previous change to System.Fat_Gen

2020-12-14 Thread Pierre-Marie de Rodat
This removes the direct declaration of the smallest denormalized number and replaces it with an overlay of the equivalent integer constant, because such a direct declaration cannot be translated into C90. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-fatgen.adb:

[Ada] Implement part of System.Fat_Gen more efficiently

2020-12-14 Thread Pierre-Marie de Rodat
This reimplements the low-level primitives of System.Fat_Gen, i.e. Copy_Sign, Decompose and Scaling more efficiently, by using the same direct approach as the existing implementation of Valid; only the normalization of denormalized numbers and the gradual underflow are still left to the hardware.

[Ada] Incorrect accessibility level on type in formal package

2020-12-14 Thread Pierre-Marie de Rodat
This patch fixes an issue in the compiler whereby a class-wide allocator for a type declared within a generic formal package was not treated the same as a formal type with respect to accessibility checks - leading to spurious accessibility errors. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] Process Truncation just like other floating point attributes

2020-12-14 Thread Pierre-Marie de Rodat
Analysis of attribute Truncation was first calling Resolve and then Set_Etype, while all the similar attributes had these calls in the reverse order. This inconsistency was present since the support for Truncation was added, but it had no semantics implications. Tested on x86_64-pc-linux-gnu, comm

[Ada] Fix internal error on bit-packed array in Volatile_Full_Access record

2020-12-14 Thread Pierre-Marie de Rodat
This fixes an issue in Remove_Side_Effects, which insists that a renaming be handled by the back-end whereas Evaluation_Required says that it should be handled by the front-end (renamings involving Volatile_Full_Access must be fully expanded by the front-end). This also reinstates an earlier fix i

[Ada] Analyze second parameter of attribute Scaling

2020-12-14 Thread Pierre-Marie de Rodat
Attribute Scaling has two parameters but only one of them has been resolved. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_attr.adb (Analyze_Attribute): Resolve second parameter of attribute Scaling just like it is resolved for a similar attribute Compo

[Ada] Fix compile time evaluation of shift intrinsics

2020-12-14 Thread Pierre-Marie de Rodat
Recent improvements to sem_eval.adb (Fold_Shift) do not take into account that these operations should be performed on the base type. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_eval.adb (Fold_Shift): Compute values using the base type.diff --git a/gcc/ada/sem_eval.a

[Ada] Small cleanup in the Ada.Text_IO hierarchy

2020-12-14 Thread Pierre-Marie de Rodat
This replaces the remaining uses of Current_Input with Current_In and those of Current_Output with Current_Out for the sake of consistency. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-tifiio.adb (Get): Replace Current_Input with Current_In. * libgnat/a-

[Ada] Small adjustments to fixed-point I/O units

2020-12-14 Thread Pierre-Marie de Rodat
The first adjustment is to the documentation contained in the units, which explains the implementation choices. The second adjustment is to the size selection mechanism, which is better done on base types. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-tifiio.adb:

[Ada] Refactor repeated code for Value attributes

2020-12-15 Thread Pierre-Marie de Rodat
Check related to restriction No_Enumeration_Maps and marking enumeration literals as referenced were done to attribute Value in both compilation and semantic checking mode (-gnatc), but to attributes Wide_Value and Wide_Wide_Value only in compilation (because those attributes are rewritten into att

[Ada] Fix possible infinite recursion in directory iterator

2020-12-15 Thread Pierre-Marie de Rodat
When the directory iterator Find is called we need to ensure that symbolic links are skipped to avoid possible circularities or exploring unrelated directories. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/g-diopit.adb (Find): Fix possible infinite recursion

[Ada] Crash on unnesting unnamed blocks

2020-12-15 Thread Pierre-Marie de Rodat
As seen on e.g. ACATS ca5006a when front-end unnesting is enabled. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch7.adb (Reset_Scopes_To_Block_Elab_Proc): Do not crash on a block with no Identifier. Code cleanups.diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_

[Ada] Remove redundant calls to UI_To_Int in relational operands

2020-12-15 Thread Pierre-Marie de Rodat
Relational operations on Uint are overloaded to accept Int as one of the operands. There is no need to explicitly convert such operands with UI_To_Int. Cleanup only; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_disp.adb (Make_Tags): Remove cal

[Ada] Transform_Function_Array issues

2020-12-15 Thread Pierre-Marie de Rodat
As shown by ACATS c74209a, there are remaining cases where the Transform_Function_Array does not trigger properly, related to private types on one hand, and to freezing of function with no separate spec on the other hand. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_c

[Ada] Mark generic body outside of SPARK

2020-12-15 Thread Pierre-Marie de Rodat
New body for Ada.Text_IO.Float_IO makes explicit use of Long_Long_Float which is not supported by GNATprove for now. Exclude that generic body from SPARK explicitly so that the unit can be instantiated from SPARK code. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/

[Ada] Small adjustment to System.Val_Real

2020-12-15 Thread Pierre-Marie de Rodat
This recovers a few bits of precision by always using the Extra digit. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-valrea.adb (Integer_to_Real): Always use Extra.diff --git a/gcc/ada/libgnat/s-valrea.adb b/gcc/ada/libgnat/s-valrea.adb --- a/gcc/ada/libgnat/s-va

[Ada] Small adjustment to parameterization of System.Value_R

2020-12-15 Thread Pierre-Marie de Rodat
This changes Precision_Limit from being computed based on the unsigned type to being explicitly specified in the instantiation, and restores its value to the precision of the mantissa for floating-pointt types. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * doc/gnat_ugn/gna

[Ada] Implement tiered support for floating-point input operations

2020-12-15 Thread Pierre-Marie de Rodat
This changes the implementation of input operations for floating-point types from using Long_Long_Float for all floating-point types to using a base type tailored to the type being operated on. This comprises adjusting Ada.Text_IO.Float_IO and Ada.Text_IO.Complex_IO to the new approach, as well as

[Ada] Complain about missing -gnat2020 switch on iterator_filter

2020-12-15 Thread Pierre-Marie de Rodat
Reuse Error_Msg_Ada_2020_Feature to complain about a missing -gnat2020 switch when compiling iterator_filter that would be legal in Ada 2020, but the compiler is expecting an earlier version of the language. A small enhancement; opportunity spotted while adding support for iterator filters in GNAT

[Ada] Refactor repeated complains about missing -gnat2005 switch

2020-12-15 Thread Pierre-Marie de Rodat
Refactor repeated code in the parser for complaining about a missing -gnat2005 switch. Fix singular-vs-plural phrasing. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * errout.ads (Error_Msg_Ada_2005_Extension): New routine (spec). * errout.adb (Error_Msg_Ada_2005_Ext

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