[Ada] Implementation of AI12-0125, use of @ as abbreviation for LHS.

2017-04-25 Thread Arnaud Charlet
With this patch the compiler now handles properly the use of @ as a prefix of a reference to a discriminated record component and to its bounds. The following must compile quietly in gnat2020 mode: --- procedure Discrs is begin declare -- Discrim-dependent subtypes subtype Index is Int

[Ada] Spurious compile failure with nested packages

2017-04-25 Thread Arnaud Charlet
This patch adds another condition to an edge case used to delay expression function freezing (P804-015). The offending package is within the body of a library-level unit where this edge-case does not apply. By adding a condition that only delays freezing of expression functions if we are in a libra

[Ada] Remove uses of global variables from Sem_Prag

2017-04-25 Thread Arnaud Charlet
This patch cleans up some uses of global variables in Sem_Prag. No change in behavior; no test available. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Bob Duff * sem_prag.adb: Remove suspicious uses of Name_Buf. * stringt.ads, stringt.adb, exp_dbug.adb, sem_dim

[Ada] Support for discriminants in pragma Default_Initial_Condition

2017-04-25 Thread Arnaud Charlet
This patch augments the existing support for tagged discriminants in assertion expressions such as those of pragma Default_Initial_Condition or Type_Invariant 'Class by adding support for ancestor subtypes. -- Source -- -- tester.ads package Tester is type Type_Id i

[Ada] pragma Ignore_Pragma(Interface); is illegal

2017-04-25 Thread Arnaud Charlet
This patch fixes a bug in which pragma Ignore_Pragma(Interface); is illegal, except in Ada 83 mode. It should be legal in all modes. The following test should compile quietly. -- gnat.adc pragma Ignore_Pragma(Interface); -- legal_interface.ads package Legal_Interface is procedure Interfa

[Ada] Crash on illegal specification for a configuration file.

2017-04-25 Thread Arnaud Charlet
The -gnatec switch is used to specify configuration files containing that contain configuration pragmas. With This patch the compiler rejects properly a name for a configuration file that designates a directory rather than crashing. Executing gcc -c pkg.ads -gnatec=. must yield: gnat1: canno

[Ada] Ignore_Pragma causes errors in the run-time system

2017-04-25 Thread Arnaud Charlet
This patch fixes a bug in which pragma Ignore_Pragma can cause errors in the run-time system, if it applies to pragmas actually used in the run-time system. Pragma Ignore_Pragma no longer applies to pragmas in the run-time system. The following test should compile quietly. -- gnat.adc pragma Ig

[Ada] Missing error on illegal reference to Part_Of constituent

2017-04-25 Thread Arnaud Charlet
This patch corrects the mechanism which verifies the legality of references to variables and constants acting as Part_Of constituents of single protected or task types to continue examining the context of the reference when it appears in an expression function. -- Source -- --

[Ada] Spurious error on call to protected op. of same type as current instance.

2017-04-25 Thread Arnaud Charlet
If the prefix of a selected component denotes a synchronized object the selected component is part of an external call (or requeue) that can only access public operations of the object. The previous check on this construct was too restrictive, and did not allow public protected operations, only tas

[Ada] Spurious compile failure with nested packages

2017-04-25 Thread Arnaud Charlet
This patch adds a predicate to verify that entities within an inner package do not rely on library unit level private types in cases where the full view of said private types are unseen. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Justin Squirek * sem_ch3.adb (Analyze

[Ada] New pragma No_Heap_Finalization

2017-04-25 Thread Arnaud Charlet
This patch introduces support for pragma No_Heap_Finalization which has the following syntax and semantics: pragma No_Heap_Finalization [ (first_subtype_LOCAL_NAME) ]; Pragma `No_Heap_Finalization` may be used as a configuration pragma or as a type-specific pragma. In its configuration form,

[Ada] Visibility problem using Import aspect

2017-04-25 Thread Arnaud Charlet
This patch corrects an issue whereby an import aspect used within a generic package would fail to resolve. By analyzing the expresions within the aspect's arguments (a.k.a "interfacing" aspects) in addition to the generated pragma's arguments the generic template gets properly resolved names for in

[Ada] Reduce rounding overhead in sin/cos/tan functions on x86

2017-04-25 Thread Arnaud Charlet
The trigonometric functions of children of Ada.Numerics are implemented by inline assembly statements on the x86 architecture, and for sin/cos/tan a special range reduction algorithm is used to avoid a loss of accuracy in range reduction implemented in hardware on x86 processors. This algorithm co

[Ada] Specifying Address clause on controlled objects

2017-04-25 Thread Arnaud Charlet
This patch removes the restriction on attribute definition clause 'Address which prevented it from being used with controlled objects. The restriction was a legacy left over from the previous controlled type implementation where each controlled type had hidden components that should not be overlaye

[Ada] Use out-of-line string concatenation at library level

2017-04-25 Thread Arnaud Charlet
String concatenation can be implemented either in-line or out-of-line by the compiler, depending on the optimization level and other factors. But doing in-line concatenation at library level is undesirable in general and the compiler already avoids it for simple declarations: S : String := S1 &

[Ada] Static intialization with pragma Linker_Section

2017-04-25 Thread Arnaud Charlet
This patch is an improvement that causes an array object that has a pragma Linker_Section with a compile-time-known initial value to be statically initialized in place in the appropriate section. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Bob Duff * freeze.adb (Freez

[Ada] Wrong casing of restriction and check names

2017-04-25 Thread Arnaud Charlet
Fixes bugs in which the wrong casing was used for restriction names in pragmas Restrictions and Restriction_Warnings, and check names in pragma Check. No test is available -- too complicated to make it fail. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Bob Duff * sem_p

[Ada] For CodePeer, omit some tag checks which confuse gnat2scil

2017-04-25 Thread Arnaud Charlet
CodePeer does not do anything useful with the various components of the record type Ada.Tags.Type_Specific_Data. Suppress generation of some checks which reference these components in cases where these checks cause CodePeer to generate unwanted messages. This change has no user-visible effect exce

[Ada] Use type clause in parent of a generic package

2017-04-25 Thread Arnaud Charlet
This patch fixes a bug in the handling of use_type_clauses If a use_type_clause "use type X;" appears in the parent of a generic child package, and "use type X;" also appears before an instantiation of that generic child package, the second "use type X;" is ineffective; the primitive operators of t

[Ada] for CodePeer, omit Finalize_Address routines

2017-04-25 Thread Arnaud Charlet
Calls to Finalize_Address routines were already being omitted for CodePeer. If we are never going to call them, then we also shouldn't generate them. This change has no user-visible effect except when Gnat2scil is running. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Steve Baird

[Ada] Legality rules on class-wide preconditions of overriding operations.

2017-04-25 Thread Arnaud Charlet
AI12-0131, part of the Ada2012 Corrigendum, places restrictions on class-wide preconditions of overriding operations, to prevent anomalies that would violate LSP if an overriding operation could declare such a precondition without an acestor of the operation having such a precondition to override.

[Ada] Validity checks and volatility

2017-04-25 Thread Arnaud Charlet
This patch partially reimplements validity checks to prevent multiple reads or copies of volatile expressions. This is achieved by first capturing the value of a volatile object into a variable (rather than a constant). The variable is then tested for validity (rather than the object again) and use

[Ada] Improve computation of real bounds of type conversion expressions

2017-04-25 Thread Arnaud Charlet
Function Determine_Range_R is used in GNATprove to compute the maximal bounds of floating-point expressions. This computation now also deals with type conversion expressions, for conversions from integer to float. This allows to prove more checks (range and overflow) in GNATprove with a simple inte

[Ada] Better range checking in GNATprove mode for float-to-int conversions

2017-04-25 Thread Arnaud Charlet
Range checks are now optimized away on float-to-int conversions when bound analysis can determine that the value is always in range. This is only possible in GNATprove mode, where NaN and infinite values are ruled out by the analysis. Also improve the computation of bounds for expressions that invo

[Ada] Use of convention aspect Stdcall on a record component.

2017-04-25 Thread Arnaud Charlet
This patch fixes a spurious error on a record component whose type is an anonymous access to subprogram, when the component carries the Windows convention Stdcall. The following must compile quietly: --- package P is type T is record AF : access function (i:Integer) return integer wi

[Ada] Missing error on illegal object.operation call

2017-04-25 Thread Arnaud Charlet
This patch modifies the mechanism which determines whether A.B denotes an object.operation call to work with the base type when the candidate type is a private extension. -- Source -- -- base.ads package Base is type A is tagged private; private type A is tagged

[Ada] New warning on late dispatching primitives

2017-04-25 Thread Arnaud Charlet
Ada allows adding visible operations to a tagged type after deriving a private extension from it, which leads to confusing specifications on which declarations of public primitives of different types are mixed. This patch adds a new warning (enabled by means of -gnatw.j or -gnatwa) that warns on p

[Ada] Failure to detect illegal pragma No_Return

2017-04-25 Thread Arnaud Charlet
A pragma No_Return that applies to a procedure body is illegal. This patch fixes a bug that caused the compiler to fail to give an error. The following test should get an error: no_return.adb:6:04: representation item appears too late package No_Return is procedure P; end No_Return; package b

[Ada] Compiler crash on function with 'in out' parameter

2017-04-25 Thread Arnaud Charlet
This patch fixes the following bug: If a function returns an unconstrained array whose component type is nonlimited controlled, and the function has an 'out' or 'in out' parameter, calls to that function can cause the compiler to crash. The following test must compile quietly. with Ada.Strings.Un

[Ada] Duplicate copy of IN OUT parameter with -gnatVa

2017-04-25 Thread Arnaud Charlet
Thic patch modifies the expansion of actual parameters to account for a case where a validation variable may act as the argument of a type conversion and produce proper code to avoid a potential duplicate copy of the variable. -- Source -- -- types.ads package Types is

[Ada] Recover from significant slowdown in the front-end

2017-04-25 Thread Arnaud Charlet
Recent changes made to New_Copy_Tree significantly slowed down the front-end of the compiler, up to 10% of the compilation time spent in the front-end, which translated into a 5% slowdown of the entire compiler at -O0 for typical files of real codebases. The function was wasting tens of millions o

[Ada] Fix elab counter handling when preserving control flow

2017-04-25 Thread Arnaud Charlet
When control flow preservation is requested, we want to be explicit about the units elaboration order in a partition, and we want to have in the executable an object file for all the units involved in the partition. This requires special processing for units which wouldn't produce any object code

[Ada] Do not mention an error on continuation message of info message

2017-04-25 Thread Arnaud Charlet
Info messages are used in GNATprove to inform the user of subtleties in how source constructs are verified. They should not be mistaken for error messages in continuation messages. Now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Yannick Moy * errout.adb (Error_

[Ada] Micro-optimize again Is_Internal_File_Name & Is_Predefined_File_Name

2017-04-25 Thread Arnaud Charlet
This micro-optimizes again the implementation of a couple of hot functions after recent changes. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Eric Botcazou * fname.adb (Has_Internal_Extension): Add pragma Inline. Use direct 4-character s

[Ada] Spurious error on missing SPARK_Mode annotation with inlining

2017-04-25 Thread Arnaud Charlet
This patch augments the generic instantiation machinery to preserve a key property of a package or subprogram spec for the corresponding body which may be instantiated or inlined later. Whenever a generic is instantiated in an environment where the SPARK_Mode is Off, any SPARK_Mode pragma found wit

[Ada] Compiler crash on large array aggregate

2017-04-25 Thread Arnaud Charlet
This patch fixes a bug in which the compiler crashes if the number of subcomponents in an array aggregate is 2**31 or more. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Bob Duff * exp_aggr.adb (Component_Count): Protect the arithmetic from attempting to convert

[Ada] Spurious warning on non-existend exception handler

2017-04-25 Thread Arnaud Charlet
This patch modifies the analysis of exception handlers to bypass restriction checks when the handler is internally generated and the verification mode is warnings. -- Source -- -- gen.ads generic type Ptr is private; package Gen is end Gen; -- types.ads with Gen;

[Ada] Re-implement classwide invariants to evaluate statically

2017-04-25 Thread Arnaud Charlet
This patch corrects an issue outlined by AI12-0150-1 (text below) and changes class-wide type invariant procedures to avoid expensive dynamic dispatching. To accomplish this changes to most calls to Build_Invariant_Procedure_Body and Build_Invariant_Procedure_Declaration were made to handle the spe

[Ada] Better diagnostics for illegal expression functions as completions.

2017-04-25 Thread Arnaud Charlet
This patch provides a better error message on expression functions that are completions, when the expression has a reference to a type that cannot be frozen yet. Compiling try.ads must yield: try.ads:10:49: premature usage of incomplete type "T2" defined at line 3 try.ads:10:49: type "T2" h

[Ada] Crash processing comparison of composite objects

2017-04-25 Thread Arnaud Charlet
Comparisons of composite objects may be internally transformed by the frontend into a special kind of node that facilitates their internal management. If processing the comparison causes the internal declaration of a subtype declaration associated with some sub-expression, the backend may crash whe

[Ada] Missing predicate functions for private types.

2017-04-25 Thread Arnaud Charlet
This patch fixes an omission in the generation of predicate functions for private types whose full view derives from a subtype with predicates. Executing the following: gnatmake -gnata -q predicate_check predicate_check must yield; OK derived subtype OK original subtype --- with Te

[Ada] Compiler abort on nested instantions with pragma Ignore_Pragma.

2017-04-25 Thread Arnaud Charlet
This patch fixes a crash in a compilation involving nested generics when a generic subprogram carries an Inline_Always pragma, and a configuration file has a corresponding pragma Ignore_Pragma (Inline_Always). No small example available. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-

[Ada] Compiler abort on components that are unchecked unions.

2017-04-25 Thread Arnaud Charlet
This patch fixes two errors in the handling of unchecked unions used as record components, in cases where such a use a potentially erroneous. The following must ocmpile quietly: gcc -c objects-base.adb --- package body Objects.Base is procedure setClass (self: in out SObject'Class; class :

[Ada] Add GNAT_Ravenscar_EDF profile

2017-04-25 Thread Arnaud Charlet
This is an experimental profile to test EDF scheduling on bareboard platforms. No test as no runtime yet. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Tristan Gingold * exp_ch9.adb (Expand_N_Task_Type_Declaration): Add relative_deadline to task record on edf pr

[Ada] Don't emit unit version on configurable run time target if not needed.

2017-04-25 Thread Arnaud Charlet
Minor clean-up in the binder generated file: data for 'Version and 'Body_Version are not emitted anymore if not needed. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Tristan Gingold * bingen.adb (System_Version_Control_Used): New variable. (Resolve_Binder_Option

[Ada] Spurious error on predicate of local private type.

2017-04-25 Thread Arnaud Charlet
This patch fixes a spurious error on a predicate specification for a type declared in a local package, when an object declaration that references that type appears outside of the package. The following must compile quietly: --- procedure Pred_Scope is package P is Local : Boolean := Fal

[Ada] With clause inhibits error in SPARK subunit

2017-04-25 Thread Arnaud Charlet
This patch modifies the analysis of subunits to preserve the SPARK mode in effect while multiple scopes and contexts are uninstalled to provide a clean environment for the context of the subunit itself. As a result, the original SPARK mode is still in effect when the subunit is analyzed. The patch

[Ada] Spurious error on container indexing that is in-out parameter in call

2017-04-25 Thread Arnaud Charlet
This patch fixes a spurious error on a user-defined indexing that appears as the actual in a parameter association of a procedure call. Given that the enclosing call has not been analyzed yet, determining the matching formal of the candidate subprogram must be located by name and not by position.

[Ada] Remove zero-origin array indexing for Source_Buffers

2017-04-25 Thread Arnaud Charlet
This patch removes the zero-origin array indexing that was used for Source_Buffers with thin pointers. It is impossible to implement zero-origin indexing correctly in Ada without fat pointers. For one thing, 'First and 'Last can't work. For another thing, array bounds checking can't work. And final

[Ada] Spurious visibility error with entity in formal package.

2017-04-27 Thread Arnaud Charlet
This patch removes a spurious visibility error on a reference to a formal T of a formal package, when T is declared as a formal derived type and there is no corresponding actual for T in the formal package declaration, that is to say it is covered by an (others => <>) clause. Compiling c.adb must

[Ada] Finer grained secondary stack management

2017-04-27 Thread Arnaud Charlet
This patch has several effects: 1) The management of the secondary stack is now "tighter". A transient block created for the purpose of managing the secondary stack will do so unless the block appears within a function returning on the secondary stack or when 2) is in effect. Previously,

[Ada] Crash on ambiguous allocator expression

2017-04-27 Thread Arnaud Charlet
This patch corrects a crash that was produced when comparing "null" to an allocator due to type Any_Access being improperly setup with no designated type. Because both operands require a specific type from context such a case will now emit the proper "ambiguous operands" error. -- Sou

[Ada] Provide library for functional containers

2017-04-27 Thread Arnaud Charlet
This patch introduces new children of Ada.Containers. They provide functional, mathematical like containers, which can be used as high level models when specifying data structures. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-27 Claire Dross * a-cofuba.ads, a-cofuba.adb (

[Ada] Crash on illegal quantified expression

2017-04-27 Thread Arnaud Charlet
This patch adds a diagnostic to detect an illegal quantified expression which is masquerading as an iterated component association. -- Source -- -- proc.adb with Ada.Containers; with Ada.Containers.Hashed_Sets; procedure Proc is function Hash (X : Integer) return A

[Ada] Names of Ghost entities are uniquely identified in executable

2017-04-27 Thread Arnaud Charlet
Names of Ghost entities are now prefixed by "___ghost_" (three leading underscores) to make it possible to independently check the presence of ghost code in an object file or an executable. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-27 Yannick Moy * exp_dbug.adb, exp_db

[Ada] Raise exception if Current_Directory does not exist

2017-04-27 Thread Arnaud Charlet
This patch fixes a bug in which Ada.Directories.Current_Directory returns invalid data if the current directory does not exist. The following test should run silently: rm -rf bug7550 mkdir -p bug7550 cd bug7550 cp ../bug7550.adb . gnatmake -q -f bug7550.adb -o bug7550 ./bug7550 & cd .. sleep 1 rm

[Ada] Strict and relaxed secondary stack management

2017-04-27 Thread Arnaud Charlet
This patch modifies the management of secondary stack within transient blocks by allowing "relaxed management" to be the default. In this mode a block will not manage the secondary stack if there exists an enclosing scope which already does that. "Strict management" can be enforced by means of swit

[Ada] Provide extended contracts for formal doubly linked lists

2017-04-27 Thread Arnaud Charlet
Primitives of doubly linked lists are now annotated with precise contracts which can be used for formal verification with GNATprove. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-27 Claire Dross * a-cfdlli.adb, a-cfdlli.ads (=): Generic parameter removed to allow t

[Ada] Spurious error in function call with incomplete type

2017-04-27 Thread Arnaud Charlet
This patch removes a spurious error from a function call when the return type of the function is an incomplete type. This can be the case if the type is a generic formal, or a limited view. It can also happen when the function declaration appears before the full view of the type (which is legal in

[Ada] 'Type_Key on subtypes and derived types

2017-04-27 Thread Arnaud Charlet
This patch fixes a bug in which 'Type_Key on a subtype or derived type could sometimes access the wrong source buffer. The following test should compile and run silently. package P is type My_Int is range 1 .. 10; for My_Int'Size use 10; end P; with P; use P; package Q is type New_My_Int

[Ada] for CodePeer, don't expand Image, Wide_Image, Wide_Wide_Image attributes

2017-04-27 Thread Arnaud Charlet
This change has no user-visible effect except when Gnat2scil is running. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-27 Steve Baird * exp_attr.adb (Expand_N_Attribute_Reference): Don't expand Image, Wide_Image, Wide_Wide_Image attributes for CodePeer. In

[Ada] Spurious visibility error in instance with nested packages

2017-04-27 Thread Arnaud Charlet
This patch corrects the visibility machinery to properly infer the original visibility of a use-visible entity defined within a nested package within a generic when the generic is instantiated and there is already another use- visible entity which satisfies the referenced. -- Source -

[Ada] Memory leak when using variant records

2017-04-27 Thread Arnaud Charlet
This patch corrects an issue whereby variant records with controlled components would skip generation of finalization routines due to a counter (Num_Comps) improperly being reset. -- Source -- -- map_leak.adb with Ada.Strings.Hash; with Ada.Containers.Indefinite_Hashed

[Ada] Fix side-effect removal for GNATprove

2017-04-27 Thread Arnaud Charlet
GNATprove relies on side-effects being removed and value being fixed from renamings, which was not the case for the renaming of a qualified expression. Now done. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-27 Yannick Moy * exp_util.ads, exp_util.adb (Evaluate_Name): Forc

[Ada] Fix handling of wrappers for some primitives in GNATprove

2017-04-27 Thread Arnaud Charlet
The wrappers introduced to handle correctly calls to overridden primitives in class-wide contracts of inherited primitives need to be introduced for compilation (whether SPARK_Mode is On or Off) but not formal verification (when GNATprove_Mode is True). Tested on x86_64-pc-linux-gnu, committed on

[Ada] Fix evaluation of comparisons for GNATprove

2017-04-27 Thread Arnaud Charlet
Static analysis tools benefit from some evaluations being done in frontend, in particular comparisons between values of universal types which are supposed to be evaluated at compile time and which static analysis tools like GNATprove may not support. Restore such evaluation during semantic analysis

[Ada] Removal of elaboration-related flags for SPARK

2017-04-27 Thread Arnaud Charlet
This patch suppresses the generation of elaboration counters and access-before- elaboration checks for GNATprove compilations. -- Source -- -- dic.ads package Dic with Elaborate_Body Is G : Integer; type T is private with Default_Initial_Condition => Foo (T);

[Ada] Elaboration checks for dispatching calls

2017-04-27 Thread Arnaud Charlet
This patch introduces a new access-before-elaboration check which attempts to detect an indirect call to a primitive of a tagged type through dispatching where the body of the primitive has not been elaborated yet. The check uses a flag which is set after the body of the primitive is elaborated and

[Ada] Class-wide preconditions in dispatching calls.

2017-04-27 Thread Arnaud Charlet
This patch is a partial implementation of the semantics mandated in AI12-0195 concerning class-wide preconditions on dispatching calls: the precondition that applies is that of the denoted subprogram entity, not that of the body that is actually executed. Tested in ACATS test C611A03 Tested on x8

[Ada] Give warnings on questionable layout of record types

2017-04-27 Thread Arnaud Charlet
This implements a warning on the questionable placement of specific sorts of components in record types, more specifically those with non-fixed size or those with a fixed size that is not a mutiple of the storage unit. It is enabled by -gnatw.q (and disabled by -gnatw.Q) only for the time being.

[Ada] Fix some warnings in compiler bootstrap

2017-04-28 Thread Arnaud Charlet
This fixes some of the remaining warnings that appear in a compiler bootstrap. The above ones are false positives of -Wmaybe-uninitialized and most are fixed by initializing the variable in case the control flow is fairly complicated; a couple of very local cases are fixed by just adding pragma War

[Ada] Freezing in expression function that is a completion.

2017-04-28 Thread Arnaud Charlet
The expresion in an expression function that is a completion freezes. This is implemented by first freezing the return type of the function, and then traversing the analyzed expression and freezing explicitly all type references within. If the expression includes a type conversion between access to

[Ada] Fix remaining warnings in compiler bootstrap #2

2017-04-28 Thread Arnaud Charlet
This fixes some of the remaining warnings that appear in a compiler bootstrap. The above ones are false positives of -Wmaybe-uninitialized and most are fixed by initializing the variable in case the control flow is fairly complicated; a couple of very local cases are fixed by just adding pragma War

[Ada] Deadlock when protected procedure propagates an exception

2017-04-28 Thread Arnaud Charlet
This patch fixes a bug where a protected procedure that propagates an exception can cause deadlock. This can happen if all of these checks are suppressed: Access_Check, Discriminant_Check, Range_Check, Index_Check, and Stack_Check (possibly by -gnatp), and the protected procedure calls something th

[Ada] Info messages treated as errors with -gnatwe

2017-04-28 Thread Arnaud Charlet
This patch ensures that info messages are not treated as errors when warnings must be treated as errors due to -gnatwe. -- Source -- -- pack.ads package Pack is procedure Proc_1; procedure Proc_2; end Pack; -- pack.adb package body Pack is procedure Proc_1

[Ada] Fix remaining warnings in compiler bootstrap #3

2017-04-28 Thread Arnaud Charlet
This fixes some of the remaining warnings that appear in a compiler bootstrap. The above ones are false positives of -Wmaybe-uninitialized and some are fixed by initializing the variable in case the control flow is complicated; the rest is fixed by just adding pragma Warnings. No functional change

[Ada] Compiler loop on use of a faulty object in an address clause.

2017-05-02 Thread Arnaud Charlet
This patch fixes a loop in the compiler when an address clause is used to specify an overlay, and the overlaid object has an illegal object declaration in which the expression is a premature reference to the object itself. Compiling p.ads must yield: p.ads:3:33: object "Nowhere" cannot be used

[Ada] Spurious error on aspect of a discriminated protected type

2017-05-02 Thread Arnaud Charlet
This patch fixes a spurious conformance error on the occurrence of the discriminant of a protected type in the expression for an aspect of the type, when the type and its body appear within a subprogram body. The check that the expression has the same visbility at the freeze point of the type and a

[Ada] Compile-time warnings for uninitialized null-excluding components

2017-05-02 Thread Arnaud Charlet
This patch adds an enhancement for detecting and warning about constraint errors in aggregate types with uninitialized null-excluding components at compile-time. All composite types without aggregate initialization will now be recursivly checked for such null-excluding components without default in

[Ada] Optimization of fixed/fixed operations with compatible 'smalls.

2017-05-02 Thread Arnaud Charlet
If the Small values of the fixed points involved in a division operation have common factors, it is possible to simplify the restulting expression, which will involve numerators and denominators of the corresponding Small values of the type, as those values are integer literals. The following must

[Ada] Crash on extended return of indefinite object

2017-05-02 Thread Arnaud Charlet
This patch suppresses the generation of a discriminant check when the associated type is a constrained subtype created for an unconstrained nominal type. The discriminant check is not needed because the subtype has the correct discriminants by construction. -- Source --

[Ada] Warning on library-level objects that require dynamic allocation

2017-05-02 Thread Arnaud Charlet
When restriction No_Implicit_Heap_Allocation is active, the compiler rejects a protected type that includes private components of dynamic size, This patch extends the corresponding warning to the declaration of discriminated objects. Given the following gnat.adc file: pragma profile (Ravenscar

[Ada] Ceiling priorities off by one on Linux

2017-05-02 Thread Arnaud Charlet
This patch fixes a bug in which ceiling priorities were off by one, so that Program_Error is raised for a ceiling violation when a task calls a protected operation and the priority of the task is equal to the ceiling priority of the protected object. Program_Error should be raised only if the prior

[Ada] Move variable-length components to last position in record types

2017-05-02 Thread Arnaud Charlet
This optimizes the layout of some record types declared in the runtime, but only in the private part of the spec or in the body, hence no API changes. There is also a similar to the Xr_Tabls support package. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-05-02 Eric Botcazou *

[Ada] Dispatching calls to renamed equality

2017-05-02 Thread Arnaud Charlet
This patch fixes a bug in the handling of primitive operations that involve renamings of equality. The placement of the primitive in the dispatch table depends on whether the operation overrides an existing operation, is an explicit renaming, or is inherited by a type extension. Executing testz88

[Ada] GNAT option to treat run-time exception warnings as errors

2017-05-02 Thread Arnaud Charlet
This patch adds a gnatmake compiliation flag to treat certain warnings as errors similar to -gnatwe. However, the new flag -gnatwE looks for any warnings regarding run-time exceptions being generated in order to only raise a compile-time error in these cases. -- Source --

[Ada] Missing error on T'Enum_Rep with no parameter

2017-05-02 Thread Arnaud Charlet
This patch fixes a bug in which the compiler fails to give an error on T'Enum_Rep, where T is a type. If X is an object of enumeration type T, then X'Enum_Rep and T'Enum_Rep(X) are allowed, but not T'Enum_Rep. The following test must get an error. enum_val_test.adb:4:21: prefix of "Enum_Rep" attr

[Ada] Bug in handling of library-level freeze actions

2017-05-02 Thread Arnaud Charlet
This patch fixes an error in the handling of freeze actions generated for a generic package that is a compilation unit, whose entities carry iterable aspects. The following must compile quietly: --- generic type Data_Type (<>) is limited private; package Data_Streams is type Root_Data_Stre

[Ada] Reimplement layout of partially constrained derived untagged types

2017-05-02 Thread Arnaud Charlet
The layout done in gigi for partially constrained derived untagged types, that is to say discriminated record types derived from an untagged parent type with constraints, is done independently of that of their parent type, which is a bit annoying since the layouts must be compatible if there is no

new Ada merger

2017-09-13 Thread Arnaud Charlet
This is a heads up that I am working with Pierre-Marie (in cc:) to transition my work as "AdaCore merger" - aka the person who submits most of AdaCore front-end changes in GCC - over to him. Pierre-Marie has already write-after-approval and has submitted and committed many patches already in the p

Re: [Ada] Improve performance of 'Image with enumeration types.

2017-09-26 Thread Arnaud Charlet
Duncan, > >>it looks like this is in essence inlining the run-time library > >>routine. In which case, shouldn't you only do it if inlining is > >>enabled?  For example, it seems rather odd to do this if > >>compiling with -Os. > > > >Actually, measurements showed that this instance of inlining is

Re: [PATCH] x32: Add and use libgnarl/s-taprop__x32.adb

2017-10-01 Thread Arnaud Charlet
> s-taprop.adb failed to compile for x32: > > s-taprop.adb:341:29: operator for type "System.Linux.time_t" is not > directly visible > s-taprop.adb:341:29: add with_clause and use_clause for "Linux" > > which is caused by > > 2017-09-25 Doug Rupp > > * libgnarl/s-taprop__linux.adb (B

Re: [PATCH] x32: Add and use libgnarl/s-taprop__x32.adb

2017-10-02 Thread Arnaud Charlet
> I have no idea how to do it. I opened: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82384 See Pierre-Marie's suggested patch on the PR. Arno

Re: Add Ada support for aarch64-*-freebsd*

2017-02-07 Thread Arnaud Charlet
> The attached patch to gcc trunk enables Ada support on > aarch64-*-freebsd*. All tests pass except those affected by the > currently missing unwind support (c52103x, c52104x, c52104y, > cb1010a, cb1010c, cb1010d, gnat.dg/null_pointer_deref* (3)). > > I'd also like to get this patch backported

Re: Add Ada support for aarch64-*-freebsd*

2017-02-07 Thread Arnaud Charlet
> This is exactly what aarch64-*-linux* is doing is doing in gcc 6 > branch (e.g. system.ads modeled it after, but now I see it has been changed to Well no, you are reusing an x86_64 file for an aarch64 architecture, so this is exactly the same issue. Arno

Re: Add Ada support for aarch64-*-freebsd*

2017-02-07 Thread Arnaud Charlet
> I was pointing out that on gcc-6, aarch64-linux is using x86-64 > system file too. Since I used gcc-6 for the original testing on > freebsd, that's where it came from. It's been changed on trunk, but > nobody backported those changes to gcc-6. It was obviously "good > enough" and a "placeholde

Re: Add Ada support for aarch64-*-freebsd*

2017-02-07 Thread Arnaud Charlet
> gcc/ada/Changelog: > 2017-02-XX John Marino > > * system-freebsd-x86.ads: Rename into... > * system-freebsd.ads: ...this > (Default_Bit_Order): Define using Standard'Default_Bit_Order > * gcc-interface/Makefile.in: Support aarch64-freebsd > (x86_64/FreeBSD): Adju

Re: [PATCH] [ADA] Fix bootstrap failure on mips64el-linux-gnuabi64

2017-03-11 Thread Arnaud Charlet
> This patch fixes an error caused by my changing of the signal constants > on MIPS in r244026. While that patch worked on mipsel, ada fails to > bootstrap with it on mips64el with the error: > > s-osinte.ads:610:07: component "sa_flags" overlaps "sa_handler" at > line 608 > ../gcc-interface/Makef

Re: Please include ada-hurd.diff upstream (try2)

2016-03-19 Thread Arnaud Charlet
> Yes, you are right, somehow I submitted the old patch. Attached is the > updated one, with a proposed ChangeLog entry included. The copyright notices are wrong (or at least incomplete). Arno > > Thanks! > 2016-03-16 Svante Signell > > * gcc-interface/Makefile.in: Add support for x

Re: Please include ada-hurd.diff upstream (try2)

2016-03-19 Thread Arnaud Charlet
> > The copyright notices are wrong (or at least incomplete). > > Hi, what is wrong then, copyright years and/or the text? Both. The copyright year should include 2016 and the text should be copyright FSF, not AdaCore. Arno

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