[Ada] Clean up support for validity checks in the compiler

2019-07-04 Thread Pierre-Marie de Rodat
This removes old code in the parser that serves no useful purpose and fixes minor issues in the Validsw package. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Eric Botcazou gcc/ada/ * gnat1drv.adb (Adjust_Global_Switches): Use proper interface t

[Ada] Hang on expansion of library-level instantiation

2019-07-04 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby instantiation of a generic at the library-level may cause a hang or crash during compilation due to inappropriate expansion of generic actuals. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Justin Squirek gcc/ada/ * sem_ch12.adb (Perfo

[Ada] Spurious error on 'First in a generic context

2019-07-04 Thread Pierre-Marie de Rodat
This patch fixes a spurious error on an attribute reference within an aspect specification for an unconstrained array type when the corresponding type declaration appears within a generic unit. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Ed Schonberg gcc/ada/ * sem_

[Ada] Bug in composition of equality for variant records

2019-07-04 Thread Pierre-Marie de Rodat
This patch fixes an omission in the construction of equality routines for variant records, to take into account user-defined equality functions for components of the record. Previously the constructed equality routine for variant records used the predefined equality for all components, When composa

[Ada] Expr. func. with private formal rejected in nested Ghost package

2019-07-04 Thread Pierre-Marie de Rodat
The compiler prematurely freezes a private type that is the type of a formal parameter of an expression function declared within a nested, inactivated Ghost package, resulting is an error complaining that the private type must be fully defined at that point. This is fixed by testing for Ignored_Gho

[Ada] Spurious error on incomplete tagged formal parameter

2019-07-04 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby a check for competing controlling formals led to a spurious dispatching error due to an incomplete type being used within a subprogram specification. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Justin Squirek gcc/ada/ * sem_disp.adb

[Ada] Missing actual for generated initialization procedure

2019-07-04 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby the use of an allocator with a composite type containing null-excluding components may lead to a compile time error due to incorrect code generation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Justin Squirek gcc/ada/ * exp_ch3.adb (

[Ada] SPARK_Mode Off now allowed inside subprogram

2019-07-04 Thread Pierre-Marie de Rodat
The rule on SPARK_Mode have been modified so that it is now possible to have a subprogram or package declared with SPARK_Mode Off inside a subprogram. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Yannick Moy gcc/ada/ * sem_prag.adb (Check_Library_Level_Entity): Update

[Ada] Spurious error on non-default C++ constructor

2019-07-04 Thread Pierre-Marie de Rodat
The frontend reports spurious errors on C++ non-default constructors that have formals whose type is an access to subprogram. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Javier Miranda gcc/ada/ * exp_tss.adb (Init_Proc): Adding missing support for access to s

[Ada] No_Stream_Optimizations ignored for 'Class'Input

2019-07-05 Thread Pierre-Marie de Rodat
This patch fixes a bug in which if pragma Restrictions (No_Stream_Optimizations) is in effect, it is ignored for T'Class'Input. Revision 251886 was causing the compiler to bypass No_Stream_Optimizations. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-05 Bob Duff gcc/ada/

[Ada] Fix inlining in GNATprove inside quantified expressions

2019-07-05 Thread Pierre-Marie de Rodat
Calls to local subprograms in GNATprove may be inlined in some case, but it should not be the case inside quantified expressions which are handled as expressions inside GNATprove. Because quantified expressions are only preanalayzed, the detection of the impossible inlining was not performed. Now

[Ada] Compiler abort on a dynamic predicate used in a precondition

2019-07-05 Thread Pierre-Marie de Rodat
This patch suppresses the generation of a predicate check when the expression is a formal IN parameter of a subprogram S. If the check is being applied to the actual in a call, the call is either in the body of S, or in an aspect specfication for S, e.g. a precondition, In both cases the check is r

[Ada] Spurious error on aggregate with choice that is predicted subtype

2019-07-05 Thread Pierre-Marie de Rodat
This patch fixes a spurious error on a record aggregate for a variant record when a choice in the aggregate is given by a subtype with a static predicate. The same expansion mechanism for such a variant, used in case statements, must be used here as well. Tested on x86_64-pc-linux-gnu, committed o

[Ada] Crash on exported build-in-place function

2019-07-05 Thread Pierre-Marie de Rodat
This patch fixes a bug where if a function is build-in-place, and is exported, and contains an extended_return_statement whose object is initialized with another build-in-place function call, then the compiler will crash. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-05 Bob Duff g

[Ada] Diagnostics in Elaboration order v4.0

2019-07-05 Thread Pierre-Marie de Rodat
This patch introduces several changes to the new elaboration order mechanism: * The library graph can now discover, store, and organize the various cycles it contains. * The elaboration order mechanism can now diagnose one or all cycles within the library graph. Diagnostics consist of

[Ada] Missing range check on assignment to bit-packed array

2019-07-05 Thread Pierre-Marie de Rodat
This patch adds an explicit range check on an assignment to a component of a bit-packed array, when the index type of the array is an enumeration type with a non-standard representation, Executing the following: gnatmake -f -gnata -q main ./main must yield: 1 is invalid 4097 is inv

[Ada] Crash on deallocating component with discriminated task

2019-07-05 Thread Pierre-Marie de Rodat
This patch modifies the generation of task deallocation code to examine the underlying type for task components. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-05 Hristian Kirtchev gcc/ada/ * exp_ch7.adb (Cleanup_Record): Use the underlying type when checking for c

[Ada] Removing support for SCIL "contract-only" subprogram bodies

2019-07-05 Thread Pierre-Marie de Rodat
Remove support added for CodePeer (which was never enabled by default; it was controlled by the -gnatd.K option) for generation of SCIL "contract-only" subprogram bodies. These were intended for use when a subprogram's "real" body is unavailable but the subprogram spec has pre/post-conditions speci

[Ada] Accept compilation switches -Og/-Ofast in non-GCC backends

2019-07-05 Thread Pierre-Marie de Rodat
Tools like GNATprove built as GNAT backends rely on adabkend.adb to handle generic switches like the optimisation switches -Oxxx. This patch adds support for -Og and -Ofast that was missing. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-05 Yannick

[Ada] Compiler loop on illegal nested accept statement

2019-07-05 Thread Pierre-Marie de Rodat
This patch fixes a "Compilation abandoned" message in a compiler built with assertions, or a compiler loop otherwise, when an accept statement contains an illegal accept statement for the same entry. Compiling accept_in_accept.adb must yield: accept_in_accept.adb:12:13: duplicate accept

[Ada] Fix internal error on packed array In/Out actual parameter

2019-07-05 Thread Pierre-Marie de Rodat
This fixes an issue introduced in Ada 2012 for calls to functions taking an In/Out parameter and for which the actual is the component of a packed array. In this case, the front-end needs to create a temporary for the actual, initialize it before the call and assign it back after it, because opera

[Ada] Wrong accessibility level under -gnat12

2019-07-05 Thread Pierre-Marie de Rodat
For an anonymous allocator whose type is that of a stand-alone object of an anonymous access-to-object type, the accessibility level is that of the declaration of the stand-alone object; however it was incorrectly computed as being library level compiling under -gnat12 mode. Tested on x86_64-pc-li

[Ada] Add contracts to Ada.Text_IO for SPARK

2019-07-05 Thread Pierre-Marie de Rodat
This change removes the warnings returned when using Ada.Text_IO library in SPARK. An abstract state and global contracts were added to modelize the action of Text_IO procedures and function on the memory and the files. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-05 Joffrey Huguet

[Ada] Failure to detect trivial infinite recursion

2019-07-05 Thread Pierre-Marie de Rodat
This patch includes delay statements in the set of control flow statements since their expressions may have side effects, which in turn may affect an infinite recursion. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-05 Hristian Kirtchev gcc/ada/ * sem_res.adb (Is_Control_

[Ada] Incorrect accessibility check

2019-07-05 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby anonymous access result types were treated as having the same accessibility level as typed results instead of having the level determined by the "master of the call" as per RM 3.10.2 (10). -- Source -- -- main.adb with Pack_12; use Pac

[Ada] Failure to detect trivial infinite recursion

2019-07-05 Thread Pierre-Marie de Rodat
This patch reimplements the detection of trivial infinite recursion to remove the implicit assumptions concenring the structure and contents of the enclosing subprogram statements. -- Source -- -- infinite.adb procedure Infinite with SPARK_Mode is function Func_1 (V

[Ada] Stabilization of Elaboration order v4.0

2019-07-05 Thread Pierre-Marie de Rodat
This patch introduces several changes to the new elaboration order mechanism: * Instantiations processed in the context of invocation graph encoding now yield a relation which is later transformed into an invocation edge. This ensures that the unit where the instantiation resides

[Ada] Spurious error reported by pragma Compile_Time_Error

2019-07-08 Thread Pierre-Marie de Rodat
The compiler may trigger spurious errors on pragmas Compile_Time_Error and Compile_Time_Warning when their boolean expression computes the size of a type. After this patch the following test compiles fine. with Interfaces; use Interfaces; package Types is type Arr is array (1 .. 6) of Unsigned_

[Ada] Arrange not to set DECL_ARTIFICIAL on elab procs

2019-07-08 Thread Pierre-Marie de Rodat
Unlike, say, clones created internally by the compiler, elab procs materialize specific user code and flagging them artificial now takes elab code away from gcov's analysis, a regression compared to previous releases. On the testcase below: package Gcov_Q is function F (X : Integer) return Int

[Ada] Crash on Image and Value attributes

2019-07-08 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby the creation of an enumeration within package where Default_Scalar_Storage_Order is in effect may lead to a crash when the attributes Image or Value are applied to objects of said type or the type directly. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-0

[Ada] Spurious visibility error on dynamic_predicate aspect in generic

2019-07-08 Thread Pierre-Marie de Rodat
This patch fixes a spurious error when verifying that the visibility of the expression of an aspect has not changed between the freeze point of the entity to which it applies, and the end of the enclosing declarative part. If the entity is a composite type its components must be made directly visib

[Ada] Semantics of Delete for fixed strings

2019-07-08 Thread Pierre-Marie de Rodat
This patch corrects a bug in the implementation of Delete in an unusual boundary case: the RM describes the semantics of Delete as equivalent to that of Replace_String with a null argument. As a result, deleting a null string that starts past the end of its argument is a noop and must not raise Ind

[Ada] Crash on timed entry call with a delay given by a type conversion

2019-07-08 Thread Pierre-Marie de Rodat
This patch fixes a compiler crash in the compiler on a timed entry call whose delay expression is a type conversion, when FLoat_Overflow checks are enabled. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-08 Ed Schonberg gcc/ada/ * exp_ch9.adb (Expand_N_Timed_Entry_Call): D

[Ada] Crash on named actual in postcondition for generic subprogram

2019-07-08 Thread Pierre-Marie de Rodat
This patch fixes a crash on compiling the postcondtion for a generic subprogram, when the postcondition is a call with both positional and named parameter associations. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-08 Ed Schonberg gcc/ada/ * sem_ch13.adb (Analyze_Aspect_S

[Ada] Set dummy Etype for the fake __HEAP entity in GNATprove

2019-07-08 Thread Pierre-Marie de Rodat
GNATprove represents reads and writes via pointers as operations on a fake __HEAP entity. This entity already had various properties set to dummy values (e.g. Scope set to Standard_Standard), so that it can be processed like other entities without crashing and not special-cased everywhere. Now it a

[Ada] Do not erase precise type on fixed-point real literal

2019-07-08 Thread Pierre-Marie de Rodat
Real literals of fixed-point type are expected to keep their precise fixed-point type in GNATprove. This is now correctly enforced. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-08 Yannick Moy gcc/ada/ * expander.adb (Expand): Do not re

[Ada] Fix crash on extension of private type with -gnatRj

2019-07-08 Thread Pierre-Marie de Rodat
This fixes a crash (or an assertion failure) during the processing done for -gnatRj on the declaration of an extension of a private type. Generally speaking, extension declarations are delicate in this context because the front-end does not duplicate the structure of the parent type, so the process

[Ada] Crash in interface derivation with null primitive

2019-07-08 Thread Pierre-Marie de Rodat
The frontend crashes processing the derivation of a tagged type whose ultimate ancestor is an interface type I1 that has a null primitive, implements another interface I2 derived from I2, and does not override the null primitive. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-08 Javie

[Ada] Assertion failure on validity check for Address

2019-07-08 Thread Pierre-Marie de Rodat
This patch corrects the verification of 'Address clauses to avoid processing a clause where the prefix of the attribute is a generic formal object. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-08 Hristian Kirtchev gcc/ada/ * sem_ch13.adb (Analyze_Attribute_Definition_Cla

[Ada] Remove dependency on Win32 GDI (Graphical Interface)

2019-07-08 Thread Pierre-Marie de Rodat
CommandLineToArgvW drags a dependency on SHELL32.DLL and thus GDI32.DLL. By loading GDI32.DLL some default GDI objects are allocated. On some Windows versions this cause the use of a lock on the graphical interface during process termination. This can impact parallelism significantly as termination

[Ada] Small overhaul in Repinfo unit

2019-07-08 Thread Pierre-Marie de Rodat
This creates a List_Type_Info procedure to deal with type entities other than arrays and records at top level and a List_Common_Type_Info procedure to handle the common part between them. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-08 Eric Botcazou gcc/ad

[Ada] Diagnostics for Elaboration order v4.0

2019-07-08 Thread Pierre-Marie de Rodat
This patch adds a missing case to the output of cycle diagnostics here a transition from an Elaborate_Body pair may reach a destination which is in the context of an active Elaborate_All. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-08 Hristian Kirtchev gcc/ada/ * bindo-

[Ada] Remove dead code from Enclosing_Package_Or_Subprogram routine

2019-07-08 Thread Pierre-Marie de Rodat
Calls to Scope always return unique entities, i.e. package/subprogram and not their bodies, so there is no need to expect them. Cleanup only; semantics unaffected. (This routine was only used in CCG and GNATprove backends anyway.) Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-08 Pio

[Ada] More data rates supported on Linux

2019-07-08 Thread Pierre-Marie de Rodat
This patch adds additional data rates to the GNAT.Serial_Communications package (Linux version). Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-08 Bob Duff gcc/ada/ * libgnat/g-sercom.ads, libgnat/g-sercom__linux.adb (Data_Rate): Support additional data rates.--- g

[Ada] Wrong evaluation of membership test

2019-07-08 Thread Pierre-Marie de Rodat
The code generated by the compiler erroneously evaluates to True membership tests when their left operand is a a class-wide interface object and the right operand is a tagged type that implements such interface type. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-08 Javier Miranda

[Ada] New algorithm for Elaboration order v4.0

2019-07-08 Thread Pierre-Marie de Rodat
This patch introduces several changes to the new elaboration order mechanism: * The concept of "strong" and "weak" edges is introduced. Strong edges are the byproduct of language-defined relations between units, such as with clauses. Weak edges are the byproduct of specilative in

[Ada] Issue error on illegal ownership in SPARK

2019-07-09 Thread Pierre-Marie de Rodat
Check for declaration of global variables prior to use in the ownership checking for SPARK. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-09 Yannick Moy gcc/ada/ * sem_spark.adb (Get_Perm_Or_Tree): Issue an error when encounteri

[Ada] Missing runtime range checks with -gnatVa

2019-07-09 Thread Pierre-Marie de Rodat
Under validity checking mode the compiler may silently skip generating code to perform runtime range checks. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-09 Javier Miranda gcc/ada/ * exp_util.adb (Remove_Side_Effects): Preserve the Do_Range_Check flag. gcc/tests

[Ada] Fix scopes for local variables in task/protected bodies

2019-07-09 Thread Pierre-Marie de Rodat
No impact on compilation with GCC. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-09 Ed Schonberg gcc/ada/ * sem_util.adb (Scope_Within_Or_Same): Handle properly task bodies and protected bodies, so that local variables within have their proper scopes after

[Ada] Make -gnatRj output strictly conforming JSON

2019-07-09 Thread Pierre-Marie de Rodat
This changes the -gnatRj output from a concatenation of entities to an array of entities, thus making it strictly conforming JSON and easier to be parsed by means of GNATColl or Python. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-09 Eric Botcazou gcc/ada/ * repinfo.ads

[Ada] Fix ownership checking for pointers in SPARK

2019-07-09 Thread Pierre-Marie de Rodat
Checking of the readable status of sub-expressions occurring in the target path of an assignment should occur before the right-hand-side is moved or borrowed or observed. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-09 Yannick Moy gcc/ada/

[Ada] Access to uninitialized memory by predicate check

2019-07-09 Thread Pierre-Marie de Rodat
This patch fixes an exception or erroneous execution, when the declaration for an object of a composite type that has a dynanic predicate is initialized with an aggregate that requires expansion into individual components. Prior to this patch the predicate check for the object appeared before intia

[Ada] Expand Enum_Rep attribute reference in GNATprove mode

2019-07-09 Thread Pierre-Marie de Rodat
In the special GNATprove mode for proof of programs, expand the Enum_Rep attribute reference so that a suitable static integer is in the AST where required by the rest of analysis. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-09 Yannick Moy gcc

[Ada] Prevent inconsistent state for inlining in GNATprove

2019-07-09 Thread Pierre-Marie de Rodat
In GNATprove mode, subprograms with a body to inline should have been filtered in Analyze_Subprogram_Body_Helper to match the conditions for inlining subprograms in GNATprove. Prevent a call to Set_Body_To_Inline in GNATprove mode that did not go through this filtering. There is no impact on compi

[Ada] Crash on 'Img attribute

2019-07-09 Thread Pierre-Marie de Rodat
This patch fixes and issue whereby applying 'Img to a constant enumerated character type would result in a compiler crash when assertions are enabled and infinite recursion when they are not. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-09 Justin Squirek gcc/ada/ * sem_e

[Ada] Elaboration order v4.0 and generic instantiations

2019-07-09 Thread Pierre-Marie de Rodat
This patch updates the library graph augmentation mechanism of the elaboration order v4.0 to emulate a particular behavior of the v3.0 scheme involving generic instantiations. If a unit without any elaboration code instantiates a generic without any elaboration code, the invocation edge from the in

[Ada] Spurious error when instance of generic is used as formal package

2019-07-09 Thread Pierre-Marie de Rodat
This patch removes a spurious bug on the use of the current instance of a generic package G as the actual in a nested instantiation of a generic unit GU that has a formal package whose generic_package name is G. This is only legal if G has no generic formal part, and the formal package declaration

[Ada] Wrong resolution of equality operator with overloaded operand

2019-07-09 Thread Pierre-Marie de Rodat
This patch fixes a code generation error on an equality operation one of whose operands is an overloaded call, and several equality operators are visible. The resolution would succes but in some cases the wrong entity was lwfton the equality node, leading to expansion with the wrong interpretation.

[Ada] Missing error on generic type with representation clause

2019-07-09 Thread Pierre-Marie de Rodat
The compiler does not report an error on a generic type that has a representation clause when its ultimate parent is not a generic formal. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-09 Javier Miranda gcc/ada/ * sem_ch13.adb (Rep_Item_Too_Early): Representation clauses

[Ada] Handle implicit moves in SPARK ownership pointer support

2019-07-09 Thread Pierre-Marie de Rodat
Allocator expressions and sub-expressions of (extension) aggregates are implicitly the source of assignments in Ada. Thus, they should be moved when of a deep type when checking ownership rules in SPARK. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07

[Ada] Elaboration order v4.0 activation

2019-07-09 Thread Pierre-Marie de Rodat
This patch enables the elaboration order v4.0 as the default elaboration order in GNATbind. The previous v3.0 elaboration order is now referred to as the "legacy elaboration order mechanism" and is available using binder switch -H. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-09 Hri

[Ada] Crash/infinite loop on program with multiple visibility errors

2019-07-09 Thread Pierre-Marie de Rodat
This patch fixes the behavior of the compiler on a program with multiple visibility errors. Previous to this fix the compiler would either crash or enter an infinite loop on a declaration for the formal in a subprogram declaration, when the parameter type was given by a selected component that does

[Ada] Warning needed on anonymous access type allocators

2019-07-09 Thread Pierre-Marie de Rodat
This patch enhances the compiler to add an optional warning for allocators of anonymous access types due to the somewhat confusing runtime accessibility checks that they generate. For more details see RM 3.10.2 sections 14/3, 14.1/3, and 14.2/3. These warnings can now be enabled with -gnatw_a, dis

[Ada] Reformat comments

2019-07-09 Thread Pierre-Marie de Rodat
Replace ". " (i.e. a period followed by two spaces) with ". "; this is meant to avoid distraction when reading comments, except for the license section, where apparently this makes the formating nicer. Some comments have been refilled, in particular those that could fit into fewer lines. Also, so

[Ada] Task-related circularities in Elaboration order v4.0

2019-07-09 Thread Pierre-Marie de Rodat
This patch adds another suggestion to the elaboration order diagnostics. An elaboration circularity involving a task activation may be resolved through pragma Restrictions (No_Entry_Calls_In_Elaboration_Code). -- Source -- -- no_entry_calls.txt pragma Restrictions (No_

[Ada] Expand type of static expressions in GNATprove mode

2019-07-09 Thread Pierre-Marie de Rodat
In the special mode for GNATprove, expand the type of static expressions like done during compilation, to both get suitable legality checks and increase the precision of the formal analysis. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-09 Yannick

[Ada] Missing escape of the double quote in JSON output

2019-07-09 Thread Pierre-Marie de Rodat
In Ada, the name of operators contains a pair of double quotes, which need to be properly escaped when the name appears in the JSON output of -gnatR. The change also ensures that formal parameters are not listed in the layout information, since this information is not back-annotated for them. Tes

[Ada] Use renamings in GNATprove mode for side-effects extraction

2019-07-10 Thread Pierre-Marie de Rodat
In the GNATprove mode for formal verification, prefer renamings over declaration of a constant to extract side-effects from expressions, whenever the constant could be of an owning type, as declaring a constant of an owning type has an effect on ownership which is undesirable. There is no impact o

[Ada] Elaboration order v4.0 and linker switches

2019-07-10 Thread Pierre-Marie de Rodat
This patch adds a missing functionality with respect to elaboration order v3.0. Units carry an attribute called Elab_Position which among other things controls the sorting of linker switches by gnatbind. Setting the proper position ensures the gnatbind will output the linker switches in an order c

[Ada] Spurious error on overloaded equality in postcondition

2019-07-10 Thread Pierre-Marie de Rodat
This patch fixes a spurious error in a postcondition in a nested instantiation when the expression includes an inherited equality and checks are enabled. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Ed Schonberg gcc/ada/ * sem_res.adb (Resolve_Equality_Op): Do not rep

[Ada] Fix crashes on ownership checking in SPARK

2019-07-10 Thread Pierre-Marie de Rodat
Code that violates the conditions for ownership checking should lead to error messages pointing to the violations instead of crashes. There is no impact on compilation, only GNATprove. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Yannick Moy gcc/ada/ * sem_spark.adb

[Ada] Missing implicit interface type conversion

2019-07-10 Thread Pierre-Marie de Rodat
The compiler skips adding an implicit type conversion when the interface type is visible through a limited-with clause. No small reproducer available. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Javier Miranda gcc/ada/ * exp_ch6.adb (Is_Class_Wide_Interface_Type): N

[Ada] The environ macro is broken on vxworks7r2 SR0610

2019-07-10 Thread Pierre-Marie de Rodat
In SR0610, the TCB is made private, so the task environ field used by the environ macro is no longer visible. Arguably this is a bug, however a more correct approach is to use accessor functions to retrieve this field and not use the environ macro, thus avoiding the problem. Tested on x86_64-pc-l

[Ada] Vxworks7r2 SR0610 coalesced some macro values

2019-07-10 Thread Pierre-Marie de Rodat
SR0600 and SR0610 cannot be differentiated by macro testing (arguably an oversight in header file version.h) so: The case statement testing for "file not found" is reformulated into an if/else series of statements to avoid a problem where two cases have identical values in SR0610, but different val

[Ada] Add contracts to Strings libraries

2019-07-10 Thread Pierre-Marie de Rodat
This patch adds contracts to Ada.Strings libraries, in order to remove warnings when using these libraries in SPARK. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Joffrey Huguet gcc/ada/ * libgnat/a-strbou.ads, libgnat/a-strfix.ads, libgnat/a-strunb.ads, libgna

[Ada] Elaboration order v4.0 and cycle detection

2019-07-10 Thread Pierre-Marie de Rodat
This patch introduces a new cycle detection algorithm which is based on Tarjan's "Enumeration of the Elementary Circuits of a Directed Graph" algorithm, with several ideas borrowed from Jonson's "Finding all the Elementary Circuits of a Directed Graph" algorithm. No need for a test because the new

[Ada] sysdep.c: correct include directives ordering

2019-07-10 Thread Pierre-Marie de Rodat
Some VxWorks headers are relying on types that are defined in `vxWorks.h` but do not include it themselves, we move the include directive for `vxWorks.h` at the top of the include directives. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Corentin Gay gcc/ada/ * sysdep.

[Ada] Spurious error on case expression with limited result

2019-07-10 Thread Pierre-Marie de Rodat
This patch modifies the expansion of case expressions to prevent a spurious error caused by the use of assignment statements to capture the result of the case expression when the associated type is limited. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Hristian Kirtchev gcc/ada

[Ada] Improve support for tuning branch probability heuristics

2019-07-10 Thread Pierre-Marie de Rodat
This adds a new GNAT.Branch_Prediction package to make it possible to tune the branch probability heuristics more finely. This package contains the equivalent of __builtin_expect in C/C++ plus a couple of specializations. The following program gives a summary of the usage: package Q is I : In

[Ada] Allow multiple units per file in GNATprove

2019-07-10 Thread Pierre-Marie de Rodat
For analysis tools that rely on information generated in ALI files, but do not generate object files, the frontend did not generate the special extension names like file~2.ali for unit 2 in the file. This is needed to be able to analyze files with multiple units. Now fixed. There is no impact on c

[Ada] Spelling mistakes in error messages

2019-07-10 Thread Pierre-Marie de Rodat
This patch updates certain error messages to eliminate spelling mistakes. No need for a test as this is a minor cosmetic fix. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Hristian Kirtchev gcc/ada/ * sem_ch3.adb (Check_Nonoverridable_Aspects): Correct the spel

[Ada] Entity names are not unique

2019-07-10 Thread Pierre-Marie de Rodat
This patch updates the Unique_Name procedure in order to prefix the string "ada___" to child units that have a nested subprogram or package, so that they do not clash with a parent package of the same name. This is for GNATprove only and does not affect regular compilation. Tested on x86_64-pc-li

[Ada] Fix spurious messages on global variables for SPARK pointer support

2019-07-10 Thread Pierre-Marie de Rodat
Pointer support in GNATprove leads to spurious messages about global variables, with local variables declared in local packages and protected components. Now fixed. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Yannick Moy gcc/ada/ *

[Ada] Fix possible crashes in GNATprove analysis of pointers

2019-07-10 Thread Pierre-Marie de Rodat
The new analysis of SPARK pointer rules could crash on some constructs. Now fixed. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Claire Dross gcc/ada/ * sem_spark.adb (Check_Expression): Allow digits constraints as input.

[Ada] Spurious error on discriminant of incomplete type

2019-07-10 Thread Pierre-Marie de Rodat
This patch corrects the conformance verification of discriminants to provide symmetry between the analysis of incomplete and full view discriminants. As a result, types of discriminants always resolve to the proper view. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Hristian Kirtc

[Ada] Spurious run-time error with 64-bit modular types

2019-07-10 Thread Pierre-Marie de Rodat
As a lexical element an integer literal has type Universal_Integer, i.e is compatible with any integer type. This is semantically consistent and simplifies type checking and subsequent constant folding when applicable. An exception is caused by 64-bit modular types, whose upper bound is not repres

[Ada] Crash on aggregate for limited type in extended return

2019-07-10 Thread Pierre-Marie de Rodat
This patch fixes a compiler abort on an extended return statement whose expression is an aggregate (to be built in place) for a discriminated record with a limited component. The build-in-place mechanism creates an access type and a renaming declaration through which individual components are assi

[Ada] System.Strings.Stream_Ops: do not depend on Stream_IO

2019-07-10 Thread Pierre-Marie de Rodat
Dependence was only from Ada.Streams.Stream_IO.End_Error exception which is renaming of the Ada.IO_Exceptions.End_Error. Use Ada.IO_Exceptions.End_Error directly. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Dmitriy Anisimkov gcc/ada/ * libgnat/s-ststop.adb: Remove Sy

[Ada] Do not attempt to re-arm guard page on x86_64-vx7(r2)

2019-07-10 Thread Pierre-Marie de Rodat
A change in the API prohibits accessing Tcb fields directly. The bug in VxWorks7 (failure to re-arm the guard page) now appears to be fixed, so this is no long necessary. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-10 Doug Rupp gcc/ada/ * init.c: Do not attempt to re-ar

[Ada] No warning for guaranteed accessibility check failures

2019-07-11 Thread Pierre-Marie de Rodat
This patch corrects the generation of dynamic accessibility checks which are guaranteed to trigger errors during run time so as to give the user proper warning during unit compiliation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-11 Justin Squirek gcc/ada/ * checks.adb

[Ada] Avoid spurious warning on wrong order of operator call arguments

2019-07-11 Thread Pierre-Marie de Rodat
GNAT issues a warning under -gnatwa when actuals for a call are named like the formals, but in a different order. This is inappropriate for calls to operators in infix form, when e.g. Right <= Left is in general the intended order. Special case calls to operators to avoid that spurious warning. Te

[Ada] Compile-time evaluation of predicate checks

2019-07-11 Thread Pierre-Marie de Rodat
This patch recognizes case of dynamic predicates on integer subtypes that are simple enough to be evaluated statically when the argument is itself a literal. Even though in many cases such predicate checks will be removed by the back-end with any level of optimization, it is preferable to perform t

[Ada] New Repinfo.Input unit to read back JSON representation info.

2019-07-11 Thread Pierre-Marie de Rodat
For some time the Repinfo unit has been able to output the representation information in the JSON data interchange format in addition to the usual text and binary formats. The new Repinfo.Input unit makes it possible to read back this information under this format and make it available to clients,

[Ada] Fix crash on dynamic predicate when generating SCOs

2019-07-11 Thread Pierre-Marie de Rodat
A pragma Check for Dynamic_Predicate does not correspond to any source construct that has a provisionally-disabled SCO. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-11 Thomas Quinot gcc/ada/ * sem_prag.adb (Analyze_Pragma, case pragma Check): Do not call Set_SCO_

[Ada] Avoid spurious errors on dimensionality checking in GNATprove

2019-07-11 Thread Pierre-Marie de Rodat
In the special GNATprove mode of the frontend, automatic inlining is performed, which may lead to spurious errors on dimensionality checking. Avoid performing this checking on inlined code, which has already been checked for dimensionality errors. There is no impact on compilation. Tested on x86_

[Ada] Elaboration order v4.0 and infinite loops

2019-07-11 Thread Pierre-Marie de Rodat
This patch introduces binder switch -d_S which prompts the various phases of the elaboration order mechanism to output a short message concerning their commencement and completion. The output is useful when trying to determine whether a phase is stuck in an infinite loop. -- Source --

[Ada] Infinite loop on illegal declaration

2019-07-11 Thread Pierre-Marie de Rodat
This patch updates predicate Null_Status to prevent an infinite recursion when the argument is an illegal object declaration of an access type. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-11 Hristian Kirtchev gcc/ada/ * sem_util.adb (Null_Status): Assume that an erroneo

[Ada] Pragma Unreferenced triggers undefined reference

2019-07-11 Thread Pierre-Marie de Rodat
This patch corrects the generation of protected body declarations so that instances of pragma Unreferenced applied to formals don't falsly trigger undefined references. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-11 Justin Squirek gcc/ada/ * exp_ch9.adb (Build_Private_P

[Ada] Internal crash on illegal renaming

2019-07-11 Thread Pierre-Marie de Rodat
This patch updates the retrieval of the renamed object name of an object renaming declaration to handle various name forms. No need for a test because one already exists, and reproducing requires a compiler built with assertions. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-11 Hris

[Ada] Fix inconsistent documentation for gnatmetric

2019-07-11 Thread Pierre-Marie de Rodat
One part said all metrics are enabled by default (which is now true), and another part said the coupling metrics are disabled by default (which is no longer true). Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-11 Bob Duff gcc/ada/ * doc/gnat_ugn/gnat_utility_programs.rst:

<    18   19   20   21   22   23   24   25   26   27   >