[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

[Ada] Postcondition checks performed before finalization

2020-12-15 Thread Pierre-Marie de Rodat
This patch fixes an issue in the compiler whereby postconditions were incorrectly checked prior to the execution of finalization. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * contracts.adb, contracts.ads (Build_Postconditions_Procedure): Add declarations for Postc

[Ada] Fix serial port baud rate setting on GNU/Linux

2020-12-15 Thread Pierre-Marie de Rodat
This fixes an issue when setting the baud rate. The baud rate is set using the cfsetospeed and cfsetispeed system calls. The code is using speed_t for clarity. The non-blocking status is only reset when Block is True. And serial blocking mode is now properly set according to termios manual. Add do

Re: [Ada] Fix serial port baud rate setting on GNU/Linux

2020-12-16 Thread Pierre-Marie de Rodat
incremental builds. The actual correction is a few patches later in my porting queue: I’m about to commit it. Sorry for the trouble! -- Pierre-Marie de Rodat

[Ada] Another small adjustment to System.Value_R

2020-12-16 Thread Pierre-Marie de Rodat
This makes the code more explicit for the sake of static analyzers. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-valuer.adb (Scan_Decimal_Digits): Tweak overflow test. (Scan_Integral_Digits): Likewise.diff --git a/gcc/ada/libgnat/s-valuer.adb b/gcc/ada/l

[Ada] Add some OS constants to control serial port

2020-12-16 Thread Pierre-Marie de Rodat
This adds some OS constants that are needed to control the serial port on GNU/Linux. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * s-oscons-tmplt.c: Add some OS constants.diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c --- a/gcc/ada/s-oscons-tmplt.c +++ b/

[Ada] Mark generic body outside of SPARK

2020-12-16 Thread Pierre-Marie de Rodat
Unit Ada.Text_IO.Fixed_IO is now generic, which makes it necessary to exclude the generic body from SPARK explicitly because it uses type Long_Long_Float which is not supported in GNATprove. This ensures that the unit can be instantiated from SPARK code. Tested on x86_64-pc-linux-gnu, committed on

[Ada] Reject junk syntax for Contract_Cases/Test_Case/Subprogram_Variant

2020-12-16 Thread Pierre-Marie de Rodat
Reject contracts Contract_Cases, Test_Case and Subprogram_Variant whose expression is either "null", "(null record)" or has extra parentheses. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Specifications): Add a codefix for extra parent

[Ada] Fix gmem.out corruption by GNAT.Expect

2020-12-16 Thread Pierre-Marie de Rodat
GNAT.Expect.Non_Blocking_Spawn executes memory allocation/deallocation after calling fork on the child process side. The libgmem library could write to the same gmem.out file in the parent and child processes simultaneously before the child process would load and initialize the new executable file.

[Ada] Fix glitch in comment of System.Powten_Table

2020-12-16 Thread Pierre-Marie de Rodat
There is a typo in the formula to compute Maxpow exposed in the comment. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-powtab.ads (Maxpow): Use explicit formula in comment.diff --git a/gcc/ada/libgnat/s-powtab.ads b/gcc/ada/libgnat/s-powtab.ads --- a/gcc/ada/libg

[Ada] Fix integer-vs-float errors in example for Test_Case pragma

2020-12-16 Thread Pierre-Marie de Rodat
The example for Test_Case pragma was rejected by the compiler; now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (Test_Case): Change integer to float literals. * gnat_rm.texi: Regenerate.diff --git a/gcc

[Ada] Fix possible uninitialized ATCB component use

2020-12-16 Thread Pierre-Marie de Rodat
When System.Memory implementation is using Debug_Pools, Common ATCB's uninitialized Global_Task_Lock_Nesting component may be used. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnarl/s-tporft.adb (Register_Foreign_Thread): Set Global_Task_Lock_Nesting before us

[Ada] Simplify membership tests with N_Subprogram_Call subtype

2020-12-16 Thread Pierre-Marie de Rodat
Simplify membership test on N_Procedure_Call_Statement and N_Function_Call using the collective N_Subprogram_Call subtype. Cleanup only; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch6.adb, exp_util.adb, sem_ch4.adb, sem_disp.adb, sem

[Ada] Avoid artificial underflow in System.Val_Real

2020-12-16 Thread Pierre-Marie de Rodat
The final computation now needs to be protected against artificial underflow when the value is very small. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-valrea.adb (Maxexp32): New constant array. (Maxexp64): Likewise. (Maxexp80): Likewise.

[Ada] Refine types of variables for parsing formal object declarations

2020-12-16 Thread Pierre-Marie de Rodat
Local variables in parsing of formal object declarations take only positive values, so their types can be narrowed to Pos. Cleanup only; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * par-ch12.adb (P_Formal_Object_Declarations): Refine types to

[Ada] Fix memory leak in GNAT.Expect.Non_Blocking_Spawn on Windows

2020-12-16 Thread Pierre-Marie de Rodat
It is not leaking on Linux because the memory heap is reinitialized when the new executable is loaded into the child process after calling fork. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/g-expect.adb (Non_Blocking_Spawn): Deallocate elements on Arg_List

[Ada] Remove inconsistent colons in messages for Ada 83 violations

2020-12-16 Thread Pierre-Marie de Rodat
Most of the errors of the form "(Ada 83) ..." don't have a colon; fix inconsistencies. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * par-ch3.adb (P_Modular_Type_Definition): Remove colon from error message. * sem_ch11.adb (Check_Duplication): Likewise.

[Ada] Fix typo in checks for implementation defined units

2020-12-16 Thread Pierre-Marie de Rodat
Fix mismatch in iterating over a range for Ada 2012 and referencing an array for Ada 95. This didn't affect the behaviour, because the referenced boolean flags in both arrays were the same for the iterated subrange. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * impunit.adb

[Ada] Simplify membership tests with N_Delay_Statement subtype

2020-12-16 Thread Pierre-Marie de Rodat
Simplify membership test on N_Delay_Relative_Statement and N_Delay_Until_Statement using the collective N_Delay_Statement subtype. Cleanup only; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch9.adb, sem_warn.adb: Simplify membership test.diff

[Ada] Code cleanup: rename ALI.Scope

2020-12-16 Thread Pierre-Marie de Rodat
Rename it to IS_Scope so that calling scope (node) under gdb is unambiguous, so ease debugging sessions. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * ali.ads, ali.adb, bindo-writers.adb, lib-writ.adb (Scope): Renamed to IS_Scope.diff --git a/gcc/ada/ali.adb b/gcc/

[Ada] Add contracts to Ada.Strings.Fixed

2020-12-16 Thread Pierre-Marie de Rodat
This adds complete postconditions and contract cases to subprograms in Ada.Strings.Fixed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-strfix.ads: Add postconditions and contract cases to subprograms. patch.diff.gz Description: application/gzip

[Ada] Handle iterator filters on loop specifications over containers

2020-12-16 Thread Pierre-Marie de Rodat
A loop parameter specification over a container is rewrtten as an iterator specification, so that expansion can use the Iterator opwrations declared for the container type. If an Ada2020 interator filter appears on the loop_parameter_specification it must be transfered to the iterator, and preanaly

[Ada] armhf-linux: symbolic tracebacks

2020-12-16 Thread Pierre-Marie de Rodat
Implement symbolic tracebacks on armhf-linux. It's an ELF target so just a matter of some bookkeeping changes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-objrea.ads (Object_Arch): Add ARM enum * libgnat/s-objrea.adb (Initialize): Add EM_ARM case.

Re: [Ada] Fix serial port baud rate setting on GNU/Linux

2020-12-16 Thread Pierre-Marie de Rodat
On Wed, Dec 16, 2020 at 1:18 PM Pierre-Marie de Rodat wrote: > Thank you. I can reproduce the issue: at this point I suspect that my > testing hasn’t detected this because of some inconsistency with my > incremental builds. The actual correction is a few patches later in my > portin

[Ada] Assert failure on b38105a in -gnat95 mode

2020-12-17 Thread Pierre-Marie de Rodat
A cascaded error leads to some confusion in this case, fixed by making Inherit_Predicate_Flags a no-op pre Ada 2012. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Inherit_Predicate_Flags): No-op before Ada 2012.diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_

[Ada] Spurious error on Type'Access and <>

2020-12-17 Thread Pierre-Marie de Rodat
When mixing the <> in an aggregrate and the default initialization of the Type involved by the box references Type'Access, GNAT may generate a spurious error of the form: "Access" attribute cannot be applied to type Fixed by only considering nodes that come from source in this legality check:

[Ada] Fixes for GNAT error/warning messages

2020-12-17 Thread Pierre-Marie de Rodat
These fixes aim at making GNAT messages more readable and uniform, just by following the current rules generally followed for messages: - start with a lowercase character - use ALL CAPITAL for keywords (so that they are properly quoted in the final message), Capitalized attribute/pragma names - u

[Ada] Compiler crash on protected component of controlled type

2020-12-17 Thread Pierre-Marie de Rodat
When declaring a component of a protected type as part of a controlled type, the compiler may crash trying to generate the finalize routine. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch7.adb (Make_Final_Call, Make_Init_Call): Take protected types into accou

[Ada] Spurious discriminant check on bounded synchronized queue

2020-12-17 Thread Pierre-Marie de Rodat
An improper run-time error is raised on a bounded synchronized queue when the container element is a discriminated type that is itself a bounded container. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-cbsyqu.ads (Implementation): Provide a box initializa

[Ada] Do not generate encodings for fixed-point types by default

2020-12-17 Thread Pierre-Marie de Rodat
This flips the default for the generation of encodings for fixed-point types in the debugging information generated by the compiler. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_dbug.adb (Get_Encoded_Name): Generate encodings for fixed point types only if -fgn

[Ada] Crash on discriminant check with current instance

2020-12-17 Thread Pierre-Marie de Rodat
This patch fixes an issue in the compiler whereby a reference to the current instance of the type occurring within a subtype contraint causes a crash during backend expansion of associated discriminant checks. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * checks.adb (Build

[Ada] Do not use exponentiation for common bases in floating-point Value

2020-12-17 Thread Pierre-Marie de Rodat
This changes the implementation of the Value attribute for floating-point types not to use exponentiation to compute the final value, at least for the common bases 2, 4, 8, 10 and 16. The powers of two use the Scaling attribute instead, while a precomputed table of powers is used for 10. The first

[Ada] Move folding of unchecked conversions from expansion to evaluation

2020-12-17 Thread Pierre-Marie de Rodat
Discrete values in unchecked conversions were only folded when compiling. Now they are also folded in GNATprove and semantics checking modes (-gnatc). This is particularly important for calls to static functions, since unchecked conversions are likely to appear for their actual parameters or resu

[Ada] Consistent wording for missing -gnat2020 switch

2020-12-17 Thread Pierre-Marie de Rodat
Reuse Error_Msg_Ada_2020_Feature to complain about a missing -gnat2020 switch when code that would be legal in Ada 2020 is compiled in an earlier language version. Also, refer to language construct and not to syntactic category of the missing feature, i.e. "declare expression" and not "declare_exp

[Ada] Ada2020: AI12-0400 Ambiguities associated with Vector

2020-12-17 Thread Pierre-Marie de Rodat
...Append and container aggregates. This patch implements the above AI, except we do not yet remove the Append procedures that append vectors (for compatibility reasons). Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-cbdlli.adb, libgnat/a-cbdlli.ads, lib

[Ada] Prevent In_Check_Node routine from going too far in the parent chain

2020-12-17 Thread Pierre-Marie de Rodat
Routines that examine the parent chain of a subexpression don't need to cross the subprogram or package boundaries and go until the very root of the compilation unit. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (In_Check_Node): Add guard and rename Node to

[Ada] Better diagnostic for new language features

2020-12-17 Thread Pierre-Marie de Rodat
Complain about missing -gnat20xx switches when the code would be accepted in a newer version of Ada rather than silently rejecting it. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * par-ch12.adb (P_Formal_Derived_Type_Definition): Complain about formal type with asp

[Ada] Prevent early exits without restoring a global variable

2020-12-17 Thread Pierre-Marie de Rodat
In Analyze_Case_Statement we save the current value of Unblocked_Exit_Count with the intention to restore it on exit. However, when returning early due to errors we failed to restore the previous value. It seems cleaner to only modify this variable after the possible early exits. Mainly just a cle

[Ada] Remove unused subprograms in validsw

2020-12-17 Thread Pierre-Marie de Rodat
Spotted by running GNATcoverage on GNAT sources, some subprograms are no longer used. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * checks.adb: Remove, not used. * checks.ads: Likewise. * exp_ch6.adb: Likewise. * exp_ch7.adb: Likewise. * ex

[Ada] Code cleanup: remove Old_Requires_Transient_Scope

2020-12-17 Thread Pierre-Marie de Rodat
This temporary code kept 3+ years ago can now be removed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (New_Requires_Transient_Scope): Renamed Requires_Transient_Scope. (Requires_Transient_Scope, Old_Requires_Transient_Scope, Results_D

[Ada] Remove unused files

2020-12-17 Thread Pierre-Marie de Rodat
Spotted by running GNATcoverage on GNAT sources, some files are no longer used. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * symbols.ads, symbols.adb: Removed no longer used.diff --git a/gcc/ada/symbols.adb /dev/null deleted file mode 100644 --- a/gcc/ada/symbols.adb +++

[Ada] Crash on if expression inside declare expression

2020-12-17 Thread Pierre-Marie de Rodat
Combining an N_Expression_With_Actions within another N_Expression_With_Actions is causing inconsistencies and leads to dropping some actions on the floor. Fixed by creating a transient scope for declare expressions when needed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/

[Ada] Remove discriminant checks processing in gigi

2020-12-17 Thread Pierre-Marie de Rodat
There is a fallback code in gigi in case the front-end constructs trees referencing non existing record fields. At this stage, it's safer and cleaner to ensure that the front-end never generates such references, and eventually replace the code in gigi by a gcc_unreachable(). We are not quite there

[Ada] Performance of CW_Membership

2020-12-17 Thread Pierre-Marie de Rodat
CM_Membership is used implicitly by some tagged related constructs, and having it never inlined may cause performance issues, so move it to the spec by taking advantage of the recently added declare expressions. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-tags.

[Ada] Refine type of a multi unit index number

2020-12-17 Thread Pierre-Marie de Rodat
With multi unit naming scheme (e.g. "unit.1.ada" and "unit.2.ada" instead of "unit.ads" and "unit.adb") the Multiple_Unit_Index global variable keeps the current index number. It is only assigned by routines that return non-negative numbers. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/a

[Ada] Fix socket timeout correction for Windows Server 2019 case

2020-06-08 Thread Pierre-Marie de Rodat
All Windows Servers till 2019 correcting the socket timeout for 500ms. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-08 Dmitriy Anisimkov gcc/ada/ * socket.c (__gnat_minus_500ms): Remove IsWindowsVersionOrGreater from condition.--- gcc/ada/socket.c +++ gcc/ada/soc

[Ada] Add Depends contracts to Delete procedures of formal containers

2020-06-08 Thread Pierre-Marie de Rodat
Add a Depends contract to Delete procedures of formal containers to state that the output value of the Position cursor depends on no inputs (it is No_Element). This now ensures that no warnings will be emitted by GNATprove if this value is not used after a call to Delete. Tested on x86_64-pc-linux

[Ada] gnatbind: Deterministic No_Entry_Calls_In_Elaboration_Code messages

2020-06-08 Thread Pierre-Marie de Rodat
This patch fixes a bug in which the messages produced by gnatbind could be nondeterministic. In particular, the message: info: use pragma Restrictions (No_Entry_Calls_In_Elaboration_Code) could be missing, depending on details that should be irrelevant. Tested on x86_64-pc-linux-gnu, commit

[Ada] AI12-0226 Make objects more consistent

2020-06-08 Thread Pierre-Marie de Rodat
Clean up Analyze_Object_Renaming and Is_Object_Reference while implementing this new AI and recognize value conversion of objects as an object reference. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-08 Arnaud Charlet gcc/ada/ * sem_ch8.adb (Analyze_Object_Renaming): Simp

[Ada] AI12-0309 Missing checks for pragma Suppress

2020-06-08 Thread Pierre-Marie de Rodat
Recognize (no-ops for now) new check names Program_Error_Check, Tasking_Check. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-08 Arnaud Charlet gcc/ada/ * snames.ads-tmpl (Name_Program_Error_Check, Name_Tasking_Check): New constants. * types.ads (Program_Er

[Ada] Ada_2020: shared variable control aspects on formal derived types

2020-06-08 Thread Pierre-Marie de Rodat
This completes the implementation of AI12-0282, which allows variable control aspects to apply to formal types. This patch extends the implementation to handle properly formal derived types. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-08 Ed Schonberg gcc/ada/ * par-ch12

[Ada] Reuse standard expansion of 'First and 'Last in GNATprove mode

2020-06-08 Thread Pierre-Marie de Rodat
Expansion of attribute Enum_Rep applied to First and Last attributes, both in the standard compilation mode and in the GNATprove mode, relies on those First and Last attributes being already expanded. However, they were only expanded in the standard compilation mode; now they are also expanded in t

[Ada] Reuse Get_Index_Subtype in the special expander for GNATprove

2020-06-08 Thread Pierre-Marie de Rodat
In the special expander that is only applied in GNATprove mode we had a code that duplicated Get_Index_Subtype routine from the standard expander. Now this routine is properly reused. Behaviour of both GNAT and GNATprove remains unchanged. Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06

[Ada] Better code generation for nested aggregates

2020-06-08 Thread Pierre-Marie de Rodat
For aggregate components that are aggregates the frontend has been enhanced to evaluate if the inner aggregate depends on the variable being assigned to. This enhancement allows the compiler to avoid the generation of a temporary and thus generate better code for large nested aggregates. Tested on

[Ada] Do not warn on partial access to atomic object with address clause

2020-06-08 Thread Pierre-Marie de Rodat
This disables the warning given in the specific case of an atomic composite object subject to an address clause accessed partially, when the code is compiled in Ada 2020 mode, on the grounds that the semantics of these accesses to components of atomic composite objects is perfectly defined in Ada 2

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