[Ada] No Storage_Error for an oversized disabled ghost array object

2019-09-18 Thread Pierre-Marie de Rodat
In some cases where the size computation for an object declaration will unconditionally overflow, the FE generates code to raise Storage_Error at the point of the object declaration (and may generate an associated warning). Don't do this if the object declaration is an ignored (i.e., disabled) ghos

[Ada] Improve efficiency of copying bit-packed slices

2019-09-18 Thread Pierre-Marie de Rodat
This patch substantially improves the efficiency of copying large slices of bit-packed arrays, by copying 32 bits at a time instead of 1 at a time. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-18 Bob Duff gcc/ada/ * exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield): The

[Ada] Crash on universal case expression in fixed-point division

2019-09-18 Thread Pierre-Marie de Rodat
This patch fixes a compiler abort on a case expression whose alternatives are universal_real constants, when the case expression is an operand in a multiplication or division whose other operand is of a fixed-point type. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-18 Ed Schonberg

[Ada] Refine type of Get_Homonym_Number result

2019-09-18 Thread Pierre-Marie de Rodat
Routine Get_Homonym_Number always returns a positive number. This is explained in its comment and is evident from its body. No test attached, because semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-18 Piotr Trojanek gcc/ada/ * exp_dbug.ads, exp_dbug

[Ada] Fix spurious alignment warning on simple address clause

2019-09-18 Thread Pierre-Marie de Rodat
This eliminates a spurious alignment warning given by the compiler on an address clause when the No_Exception_Propagation restriction is in effect and the -gnatw.x switch is used. In this configuration the address clauses whose expression is itself of the form X'Address would not be sufficiently an

[Ada] Implement AI12-0086's rules for discriminants in aggregates

2019-09-18 Thread Pierre-Marie de Rodat
In Ada2012, a discriminant value that governs an active variant part in an aggregate had to be static. AI12-0086 relaxes this restriction - if the subtype of the discriminant value is a static subtype all of whose values select the same variant, then that is good enough. Tested on x86_64-pc-linux-

[Ada] Fix portability issues in access to subprograms

2019-09-18 Thread Pierre-Marie de Rodat
This patch improves the portability of the code generated by the compiler for access to subprograms. Written by Richard Kenner. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-18 Javier Miranda gcc/ada/ * exp_ch4.adb (Expand_N_Op_Eq): The frontend assumes that we can

[Ada] Crash on aggregate with dscriminant in if-expression as default

2019-09-18 Thread Pierre-Marie de Rodat
This patch fixes a crash on a an aggregate for a discriminated type, when a component of the aggregate is also a discriminated type constrained by a discriminant of the enclosing object, and the default value for the component is a conditional expression that includes references to that outer discr

[Ada] Fix sharing of expression in array aggregate with others choice

2019-09-18 Thread Pierre-Marie de Rodat
This change fixes a long-standing issue in the compiler that is generally silent but may lead to wrong code generation in specific circumstances. When an others choice in an array aggregate spans multiple ranges, the compiler may generate multiple (groups of) assignments for the ranges. The probl

[Ada] Avoid gnatbind regression caused by Copy_Bitfield

2019-09-18 Thread Pierre-Marie de Rodat
The recent Copy_Bitfield change caused gnatbind to change elaboration order, causing different error messages. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-18 Bob Duff gcc/ada/ * exp_ch5.adb (Expand_Assign_Array_Loop_Or_Bitfield): Move call to RTE_Available later

[Ada] Skip entity name qualification in GNATprove mode

2019-09-18 Thread Pierre-Marie de Rodat
GNATprove was using the qualification of names for entities with local homonyms in the same scope, requiring the use of a suffix to differentiate them. This caused problems for correctly identifying primitive equality operators. This case is now handled like the rest of entities in GNATprove, by in

[Ada] Use static discriminant value for discriminated task record

2019-09-18 Thread Pierre-Marie de Rodat
This patch allows the construction of a static subtype for the generated constrained Secondary_Stack component of a task for which a stack size is specified, when compiling for a restricted run-time that forbids dynamic allocation. Needed for LLVM. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] Spurious ineffective use_clause warning

2019-09-18 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby expansion of post conditions may lead to spurious ineffective use_clause warnings when a use type clause is present in a package specification and a use package clause exists in the package body on the package containing said type. Tested on x86_64-pc-linux-gnu, c

[Ada] Raise exception on call to Expect for a dead process

2019-09-18 Thread Pierre-Marie de Rodat
Call to Expect for a dead process results in SIGBUS signal on Linux systems. Process_Died exception is raised in this case now. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-18 Vadim Godunko gcc/ada/ * libgnat/g-expect.adb (Expect_Internal): Don't include invalid

[Ada] Code cleanup of alignment representation clauses in dispatch tables

2019-09-18 Thread Pierre-Marie de Rodat
This patch does not modify the functionality of the compiler; it avoids generating non-required alignment representation clauses for dispatch tables. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-18 Javier Miranda gcc/ada/ * exp_disp.adb (Make_DT, Make_Secondary_DT): Remo

[Ada] Infinite loop with concatenation and aspect

2019-09-19 Thread Pierre-Marie de Rodat
This patch fixes a bug where an array object initialized with a concatenation, and that has an aspect_specification for Alignment, causes the compiler goes into an infinite loop. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-19 Bob Duff gcc/ada/ * exp_ch3.adb (Rewrite_As_

[Ada] Improve handling of explicit by-reference mechanism

2019-09-19 Thread Pierre-Marie de Rodat
This improves the handling of an explicit by-reference passing mechanism specified by means of the GNAT pragma Export_Function. This device sort of circumvents the rules of the language for the by-reference passing mechanism and it's then up to the programmer to ensure that the actual parameter is

[Ada] gnatxref: infinite loop on symbols not found

2019-09-19 Thread Pierre-Marie de Rodat
This patch fixes a bug in which if a symbol is not found, gnatxref can sometimes enter an infinite loop. No impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-19 Bob Duff gcc/ada/ * xref_lib.adb (Get_Symbol_Name): If we reach EOF in the first loo

[Ada] Fix fallout of previous change for bit-packed arrays

2019-09-19 Thread Pierre-Marie de Rodat
This fixes a regression introduced by the previous change that improved the handling of explicit by-reference mechanism. For the very specific case of a component of a bit-packed array, the front-end still needs to insert a copy around the call because this is where the rewriting into the sequence

[Ada] Allow constants of access type in Global contracts

2019-09-19 Thread Pierre-Marie de Rodat
Now that SPARK supports access types, global constants of access type may appear as outputs of a subprogram, with the meaning that the underlying memory can be modified (see SPARK RM 3.10). Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-19 Yannick Moy gcc/ada/ * sem_prag.a

[Ada] Implement Machine_Rounding attribute in line when possible

2019-09-19 Thread Pierre-Marie de Rodat
GNAT implements Machine_Rounding as an alias for Rounding but, whereas the implementation of the latter is in line when possible, that of the former is always out of line, which is not aligned with the intent of the Ada RM. This changes the compiler to using for Machine_Rounding the same in line i

[Ada] Streamline comparison for equality of 2-element arrays

2019-09-19 Thread Pierre-Marie de Rodat
In the general case, the comparison for equality of array objects is implemented by a local function that contains, among other things, a loop running over the elements, comparing them one by one and exiting as soon as an element is not the same in the two array objects. For the specific case of c

[Ada] Suppress GNAT FE up-level reference transformation for GNAT-LLVM

2019-09-19 Thread Pierre-Marie de Rodat
In the case of GNAT-LLVM, the GNAT FE no longer does expansion of up-level references identified by the subprogram unnesting machinery into activation record references. This is now only done by the FE when generating C code. This expansion is already taken care of by the gnat-llvm middle phase, so

[Ada] Emit DW_AT_GNU_bias with -fgnat-encodings=gdb

2019-09-19 Thread Pierre-Marie de Rodat
Emit DW_AT_GNU_bias with -fgnat-encodings=gdb. gdb implements this, but not the encoded variant. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-19 Tom Tromey gcc/ada/ * gcc-interface/misc.c (gnat_get_type_bias): Return the bias when -fgnat-encodings=gdb. gcc/test

[Ada] Fix spurious type mismatch failure on nested instantiations

2019-09-19 Thread Pierre-Marie de Rodat
This fixes a spurious type mismatch failure reported between formal and actual of a call to a subprogram that comes from the instantiation of a child generic unit that itself contains an instantiation of a slibling child generic unit, when the parent is itself a generic unit with private part. The

[Ada] Fix run-time segfault with derived access-to-subprogram type

2019-09-19 Thread Pierre-Marie de Rodat
This fixes a segfault at run time for the call to a local subprogram through an access value if the type of this access value is derived from an initial access-to-subprogram type and the access value was originally obtained with the initial type. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] Memory leak with 'Range of a function call in a loop

2019-09-19 Thread Pierre-Marie de Rodat
If a for loop starts with "for X in F (...)'Range loop", where F is a function returning an unconstrained array, then memory is leaked. This patch fixes that bug. Running these commands: gnatmake -q -f main.adb main On the following sources: with Text_IO; use Text_IO; package P is funct

[Ada] Fix copy operation with private discriminated record type

2019-09-19 Thread Pierre-Marie de Rodat
This prevents the object code from reading too many bytes from the source for a copy operation involving a private discriminated record type with default discriminants and generated for the assignment of an aggregate to a variable or the initialization of a constant. The front-end already knows th

[Ada] Disable inlining of traversal function in GNATprove

2019-09-19 Thread Pierre-Marie de Rodat
Traversal functions as defined in SPARK RM 3.10 should not be inlined for analysis in GNATprove, as this changes the ownership behavior. Disable the inlining performed in GNATprove on functions which could be interpreted as such. There is no impact on compilation and thus no test. Tested on x86_6

[Ada] Get rid of useless temporary for slice in overaligned record type

2019-09-19 Thread Pierre-Marie de Rodat
This fixes a recent code quality regression for targets that do not require the strict alignment of memory accesses: the compiler would generate a useless temporary for a slice of an array component in an overaligned record type. Running these commands: gcc -c p.adb -gnatws -gnatD grep loop p

[Ada] Fix bogus "too late" error with nested generics and inlining

2019-09-19 Thread Pierre-Marie de Rodat
This prevents the compiler from issuing a bogus error about a constant whose full declaration appears too late, if it is declared in a nested generic package and instantiated in another nested instantiation, when the instantiations are done in a unit withed from the main unit and containing an inli

[Ada] Accept concatentation arguments to pragma Annotate

2019-09-19 Thread Pierre-Marie de Rodat
In cases where pragma Annotate accepts a string literal as an argument, we now also accept a concatenation of string literals. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-19 Steve Baird gcc/ada/ * sem_prag.adb (Preferred_String_Type): A new function. Given an ex

[Ada] New routine GNAT.Sockets.Create_Socket_Pair

2019-09-19 Thread Pierre-Marie de Rodat
New routine to create 2 connected sockets. This routine is analog of the UNIX system call socketpair. On UNIX platforms it is implemented on the base of socketpair. On other platforms it is implemented by conecting network sockets over loopback interface. Tested on x86_64-pc-linux-gnu, committed o

[Ada] Remove duplicated routines for getting homonym number

2019-09-19 Thread Pierre-Marie de Rodat
Routines Homonym_Number and Get_Homonym_Number were exactly the same, except for minor style differences. Keep the one in Exp_Util; remove the one in Exp_Dbug. No test attached, because semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-19 Piotr Trojanek gcc/ad

[Ada] Crash on predicate in full view in a generic unit

2019-09-19 Thread Pierre-Marie de Rodat
This patch fixes a compiler abort on a dynamic predicate applied to the full view of a type in a generic package declaration, when the expression for the predicate is a conditionql expression that contains references to components of the full view of the type. Tested on x86_64-pc-linux-gnu, commit

[Ada] Move SPARK borrow-checker to gnat2why codebase

2019-09-19 Thread Pierre-Marie de Rodat
Unit sem_spark was implementing the borrow-checker for the support of ownership pointers in SPARK. It has been moved to gnat2why codebase to facilitate its evolution and allow the more powerful flow analysis to provide its results for better analysis on pointers. Tested on x86_64-pc-linux-gnu, com

[Ada] Use declared type for deciding on SPARK pointer rules

2019-09-19 Thread Pierre-Marie de Rodat
A constant of pointer type is considered as mutable in SPARK, according to SPARK RM 3.10, but this should be based on the declared type of the constant instead of its underlying type. There is no impact on compilation hence no test. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-19 Y

[Ada] Fix bogus visibility error with nested generics and inlining

2019-09-19 Thread Pierre-Marie de Rodat
This prevents the compiler from issuing a bogus error about the visibility of an operator in an instantiation of a nested generic package which is itself used as an actual of an instantiation of another generic package, when the instantiations are done in a unit withed from the main unit and contai

[Ada] Lingering loop for ignored Ghost assignment

2018-11-14 Thread Pierre-Marie de Rodat
The following patch ensures that loops generated for aggregates as part of ignored Ghost assignments are correctly eliminated from the generated code. -- Source -- -- pack.ads package Pack is type addr4k is new Integer range 0 .. 100 with Size => 32; type Four_K

[Ada] Crash on tagged equality

2018-11-14 Thread Pierre-Marie de Rodat
This patch corrects the retrieval of the equality function when it is inherited from a parent tagged type. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-11-14 Hristian Kirtchev gcc/ada/ * exp_ch4.adb (Expand_N_Op_Eq): Remove duplicated code and use routine Find_Equal

[Ada] Record components do not appear in the Global contract

2018-11-14 Thread Pierre-Marie de Rodat
In the Global contract there can be only entire objects, which are represented either as N_Identifier or N_Expanded_Name. The test for record components was dead. Now removed. Semantics unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-11-14 Piotr Trojanek gcc/ada/ *

[Ada] Fix handling of generic actuals with default expression in SPARK

2018-11-14 Thread Pierre-Marie de Rodat
Both in the GNAT frontend and in the GNATprove backend we have several checks related to generic actuals of mode IN that rely on the Corresponding_Generic_Association flag. However, this flag was only set for actuals with explicit expressions from the generic instance and unset for actuals with imp

[Ada] Improper extension of bounds of fixed-point type

2018-11-14 Thread Pierre-Marie de Rodat
If the given Delta of an ordinariy fixed-point type is not a machine number and there is no specified 'Small for the type, the compiler chooses the actual bounds of the type using the nearest model numbers that include the given bounds, but it is free to exclude those bounds if a size clause restri

[Ada] Limited function violates No_Exception_Propagation

2018-11-14 Thread Pierre-Marie de Rodat
This patch suppresses the generation of raise statements in the context of build-in-place and elaboration checks for primitives of tagged types when exceptions cannot be used. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-11-14 Hristian Kirtchev gcc/ada/ * checks.adb (Instal

[Ada] Unnesting transformations for blocks in package bodies

2018-11-14 Thread Pierre-Marie de Rodat
The declarations in the package body may have created blocks with nested subprograms. Such a block must be transformed into a procedure followed by a call to it, so that unnesting can handle uplevel references within these nested subprograms (typically generated subprograms to handle finalization a

[Ada] Visibility error on used enumerated type

2018-11-14 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby the freezing of a nested package containing an enumerated type declaration would cause visibility errors on literals of such type when a use_all_type_clause for it appears within the same declarative region. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-

[Ada] Crash on ignored Ghost assignment

2018-11-14 Thread Pierre-Marie de Rodat
This patch modifies the way analysis determine whether an assignment is an ignored Ghost assignment. This is now achieved by preanalyzing a copy of the left hand side in order to account for potential code generated by the left hand side itself. No small reproducer possible. Tested on x86_64-pc-l

[Ada] System'To_Address not always static

2018-11-14 Thread Pierre-Marie de Rodat
System'To_Address is supposed to be static when its parameter is static. This patch fixes a bug in which it is considered nonstatic when used as the initial value of a variable with the Thread_Local_Storage aspect, so the compiler incorrectly gives an error when initializing such a variable with Sy

[Ada] Renamed equality leads to spurious errors

2018-11-14 Thread Pierre-Marie de Rodat
The following patch corrects the search for the equality function to handle cases where the equality could be a renaming of another routine. No simple reproducer possible because this requires PolyORB. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-11-14 Hristian Kirtchev gcc/ada/

[Ada] Enhance constraints propagation to ease the work of optimizers

2018-11-14 Thread Pierre-Marie de Rodat
This patch recognizes additional object declarations whose defining identifier is known statically to be valid. This allows additional optimizations to be performed by the front-end. Executing: gcc -c -gnatDG p.ads On the following sources: with G; With Q; package P is Val : constan

[Ada] Compiler crash on decl. with limited aggregate and address clause

2018-11-14 Thread Pierre-Marie de Rodat
This patch fixes a compiler abort on an object declaration whose expression is an aggregate, when the type of the object is limited and the declaration is followed by an address clause for the declared object. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-11-14 Ed Schonberg gcc/ada/

[Ada] Fix assertion failure on pragma Compile_Time_Error in generic unit

2018-11-14 Thread Pierre-Marie de Rodat
There is no point in validating 'Alignment or 'Size of an entity declared in a generic unit after the back-end has been run, since such an entity is not passed to the back-end, and this can even lead to an assertion failure. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-11-14 Eric Botca

[Ada] Crash on use of generic formal package

2018-11-14 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby a complicated set of generic formal packages in conjunction with use_clauses may cause a crash during visibility checking due to a homonym being out of scope during the checking stage. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-11-14 Justin Squirek

[Ada] Missing constraint check on if-expression returning a string

2018-11-14 Thread Pierre-Marie de Rodat
If the context of an if-expression is constrained, its dependent expressions must obey the constraints of the expected type. Prior to this patch, this check was performed only for scalar types, by means of an added conversion. This is now enforced on all types by means of a qualified expression on

[Ada] Use of Suppress_Initialization with pragma Thread_Local_Storage

2018-11-14 Thread Pierre-Marie de Rodat
This patch allows for aspect/pragma Suppress_Initialization to be an acceptable form of missing initialization with respect to the semantics of pragma Thread_Local_Storage. -- Source -- -- gnat.adc pragma Initialize_Scalars; -- pack.ads with System; package Pack is

[Ada] More complete information level for -gnatR output

2018-11-14 Thread Pierre-Marie de Rodat
This adds a 4th information level for the -gnatR output, where relevant compiler-generated types are listed in addition to the information already output by -gnatR3. For the following package P: package P is type Arr0 is array (Positive range <>) of Boolean; type Rec (D1 : Positive; D2 :

[Ada] Crash on interface equality covered by a renaming declaration

2018-11-14 Thread Pierre-Marie de Rodat
The frontend crashes processing a tagged type that implements an interface which has an equality primitive (that is, "=") and covers such primitive by means of a renaming declaration. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-11-14 Javier Miranda gcc/ada/ * exp_disp.adb

[Ada] Spurious error on Ghost null procedure

2018-11-14 Thread Pierre-Marie de Rodat
This patch modifies the analysis (which is really expansion) of null procedures to set the Ghost mode of the spec when the null procedure acts as a completion. This ensures that all nodes and entities generated by the expansion are marked as Ghost, and provide a proper context for references to Gh

[Ada] Remove couple of recently added dead tests

2018-11-14 Thread Pierre-Marie de Rodat
N_Quantified_Expression and N_Iterated_Component_Association are unrelated nodes that cannot appear in the same context: the former can appear wherever an expression node is acceptable whereas the latter can appear only as an element of a component association list. So a test combining both most l

[Ada] Fix small regression with others choice in array aggregate

2018-11-14 Thread Pierre-Marie de Rodat
This change is aimed at fixing a fallout of bumping the default value of the Max_Others_Replicate parameter of the Convert_To_Positional routine. This parameter is responsible for taming the duplication of the expression of an others choice in an array aggregate so that it doesn't result in a code

[Ada] Problem with boundary case of XOR operation and unnesting

2018-11-14 Thread Pierre-Marie de Rodat
The XOR operation applied to a boolean array whose component type has the range True .. True raises constraint error. Previous to this patch, the expansion of the operation could lead to uplevel references that were not handled properly when unnesting is in effect. Tested on x86_64-pc-linux-gnu, c

[Ada] Compiler abort on use of Invalid_Value on numeric positive subtype

2019-07-01 Thread Pierre-Marie de Rodat
Invalid_Value in most cases uses a predefined numeric value from a built-in table, but if the type does not include zero in its range, the literal 0 is used instead. In that case the value (produced by a call to Get_Simple_Init_Val) must be resolved for proper type information. The following must

[Ada] Crash due to missing freeze nodes in transient scope

2019-07-01 Thread Pierre-Marie de Rodat
The following patch updates the freezing of expressions to insert the generated freeze nodes prior to the expression that produced them when the context is a transient scope within a type initialization procedure. This ensures that the nodes are properly interleaved with respect to the constructs t

[Ada] Revert "Global => null" on calendar routines that use timezones

2019-07-01 Thread Pierre-Marie de Rodat
Some routines from the Ada.Calendar package, i.e. Year, Month, Day, Split and Time_Off, rely on OS-specific timezone databases that are kept in files (e.g. /etc/localtime on Linux). In SPARK we want to model this as a potential side-effect, so those routines can't have "Global => null". Tested on

[Ada] gprbuild fails to find ghost ALI files

2019-07-01 Thread Pierre-Marie de Rodat
This patch fixes a bug where if a ghost unit is compiled with ignored-ghost mode in a library project, then gprbuild will fail to find the ALI file, because the compiler generates an empty object file, but no ALI file. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-01 Bob Duff gcc/

[Ada] Cleanup references to LynuxWorks in docs and comments

2019-07-01 Thread Pierre-Marie de Rodat
Apparently the company behind LynxOS is now called Lynx Software Technologies (formerly LynuxWorks). Use the current name in user docs and the previous name in developer comment (to hopefully reflect the company name at the time when the patchset mentioned in the comment was released). Tested on

[Ada] Remove a SPARK rule about implicit Global

2019-07-01 Thread Pierre-Marie de Rodat
A rule about implicit Global contract for functions whose names overload an abstract state was never implemented (and no user complained about this). It is now removed, so references to other rules need to be renumbered. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-01 Piotr Trojanek

[Ada] Spurious error private subtype derivation

2019-07-01 Thread Pierre-Marie de Rodat
This patch fixes a spurious error on a derived type declaration whose subtype indication is a subtype of a private type whose full view is a constrained discriminated type. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-01 Ed Schonberg gcc/ada/ * sem_ch3.adb (Build_Derived

[Ada] Crash on improper pragma Weak_External

2019-07-01 Thread Pierre-Marie de Rodat
This patch adds a guard on the use of pragma Weak_External. This pragma affects link-time addresses of entities, and does not apply to types. Previous to this patch the compiler would abort on a misuse of the pragma. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-01 Ed Schonberg gc

[Ada] Wrong code with -gnatVa on lock-free protected objects

2019-07-01 Thread Pierre-Marie de Rodat
This patch fixes the handling of validity checks on protected objects that use the Lock-Free implementation when validity checks are enabled, previous to this patch the compiler would report improperly that a condition in a protected operation was always True (when comoipled with -gnatwa) and would

[Ada] Improve error message on mult/div between fixed-point and integer

2019-07-01 Thread Pierre-Marie de Rodat
Multiplication and division of a fixed-point type by an integer type is only defined by default for type Integer. Clarify the error message to explain that a conversion is needed in other cases. Also change an error message to start with lowercase as it should be. Tested on x86_64-pc-linux-gnu, c

[Ada] More permissive use of GNAT attribute Enum_Rep

2019-07-01 Thread Pierre-Marie de Rodat
This patch allows the prefix of the attribute Enum_Rep to be an attribute referece (such as Enum_Type'First). A recent patch had restricted the prefix to be an object of a discrete type, which is incompatible with orevious usage. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-01 Ed Sc

[Ada] Spurious error on inst. of partially defaulted formal package

2019-07-01 Thread Pierre-Marie de Rodat
This patch removes a spurious error on an instantiation whose generic unit has a formal package where some formal parameters are box-initialiaed. Previously the code assumed that box-initialization for a formal package applied to all its formal parameters. Tested on x86_64-pc-linux-gnu, committed

[Ada] Implement GNAT.Graphs

2019-07-01 Thread Pierre-Marie de Rodat
This patch introduces new unit GNAT.Graphs which currently provides a directed graph abstraction. -- Source -- -- operations.adb with Ada.Text_IO; use Ada.Text_IO; with GNAT;use GNAT; with GNAT.Graphs; use GNAT.Graphs; with GNAT.Sets; use GNAT.Sets; procedur

[Ada] Spurious error on dynamic predicate in a generic context

2019-07-03 Thread Pierre-Marie de Rodat
This patch fixes a spurious error on the conformance checking between the expression for an aspect analyzed at the freeze point of the type, and the analysis of a copy of the expression performed at the end of the enclosing list of declarationss. In a generic context the first may not have been ana

[Ada] Make loop labels unique for front-end inlined calls

2019-07-03 Thread Pierre-Marie de Rodat
This patch transforms loop labels in the body of subprograms that are to be inlined by the front-end, to prevent accidental duplication of loop labels, which might make the resulting source illegal. Source program: package P is procedure Get_Rom_Addr_Offset with Inline_Always; en

[Ada] Fix bogus error on array with overaligned scalar component

2019-07-03 Thread Pierre-Marie de Rodat
The compiler would wrongly reject an alignment clause larger than 8 on the component type of an array of scalars, which is valid albeit pathological. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-03 Eric Botcazou gcc/ada/ * layout.adb (Layout_Type): Do not set the compone

[Ada] Spurious error on predicate of subtype in generic

2019-07-03 Thread Pierre-Marie de Rodat
This patch fixes a spurious error on a dynamic predicate of a record subtype when the expression for the predicate includes a selected component that denotes a component of the subtype. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-03 Ed Schonberg gcc/ada/ * sem_ch8.adb (

[Ada] Spurious error with static predicate in generic unit

2019-07-03 Thread Pierre-Marie de Rodat
This patch fixes a spurious error in a generic unit that invludes a subtype with a static predicate, when the type is used in a case expression. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-03 Ed Schonberg gcc/ada/ * sem_ch13.adb (Build_Predicate_Functions): In a generic

[Ada] Extend -gnatw.z warning to array types

2019-07-03 Thread Pierre-Marie de Rodat
The -gnatw.z switch causes the compiler to issue a warning on record types subject to both an alignment clause and a size clause, when the specified size is not a multiple of the alignment in bits, because this means that the Object_Size will be strictly larger than the specified size. It makes se

[Ada] Style check for mixed-case identifiers

2019-07-03 Thread Pierre-Marie de Rodat
This patch implements a new switch, -gnatyD, enables a style check that requires defining identifiers to be in mixed case. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-03 Bob Duff gcc/ada/ * par-ch3.adb (P_Defining_Identifier): Call Check_Defining_Identifier_Casi

[Ada] New routine to access file on command line

2019-07-03 Thread Pierre-Marie de Rodat
This patch adds a new routine to query the first file argument of the commandline without moving to the next file. This is needed in SPARK. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-03 Johannes Kanig gcc/ada/ * osint.ads, osint.adb

[Ada] SPARK pointer support extended to local borrowers and observers

2019-07-03 Thread Pierre-Marie de Rodat
SPARK rules allow local borrowers and observers to be declared. During their lifetime, the access to the borrowed/observed object is restricted. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-03 Yannick Moy gcc/ada/ * sem_spark.adb: Add

[Ada] Improve warnings about infinite loops

2019-07-03 Thread Pierre-Marie de Rodat
The compiler now has fewer false alarms when warning about infinite loops. For example, a loop of the form "for X of A ...", where A is an array, cannot be infinite. The compiler no longer warns in this case. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-03 Bob Duff gcc/ada/

[Ada] Suppress warnings in generic instantiations with pragma Warnings

2019-07-03 Thread Pierre-Marie de Rodat
Warnings issued by GNAT or GNATprove inside generic instantiations can now be suppressed by using pragma Warnings Off/On around the instance. This has mostly an effect on GNATprove, since GNAT typically does not issue warnings on instantiations, only on the generic code itself. Tested on x86_64-pc

[Ada] Crash on anonymous access-to-class-wide with tasks

2019-07-03 Thread Pierre-Marie de Rodat
This patch fixes a bug in which if an object declaration is of an anonymous access type whose designated type is a limited class-wide type (but not an interface), and the object is initialized with an allocator, and the designated type of the allocator contains tasks, the compiler would crash. Tes

[Ada] Missing consistency check for constant modifier

2019-07-03 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby instantiations of generic packages were incorrectly allowed despite formal and actual subprograms not having matching declarations with anonymous constant access type parameters. -- Source -- -- gen1.ads package Gen1 is generic

[Ada] Crash on front-end inlining of subp. with aspect specifications

2019-07-03 Thread Pierre-Marie de Rodat
This patch fixes a gap in the handling of formals when inlining a call to a subprogram marked Inline_Always. For the inlining, the formals are replaced by the actuals in the block constructed for inlining, The traversal that performs this replacement does not apply to aspect specifications that may

[Ada] Incorrect expansion on renamings of formal parameters

2019-07-03 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby a renaming of an unconstrained formal parameter leads to spurious runtime errors; manifesting either as a storage or constraint error due to incorrect bounds being assumed. This issue also occurs when the renamings are implicit such as through generic instantiatio

[Ada] Spurious visibility error in inlined function

2019-07-03 Thread Pierre-Marie de Rodat
This patch corrects the use of tree replication when inlining a function that returns an unconstrained result, and its sole statement is an extended return statement. The use of New_Copy_Tree ensires that global references saved in a generic template are properly carried over when the function is i

[Ada] Forced elaboration order in Elaboration order v4.0

2019-07-03 Thread Pierre-Marie de Rodat
This patch refactors the forced elaboration order functionality, reintegrates it in Binde, and impelements it in Bindo. -- Source -- -- server.ads package Server is end Server; -- client.ads with Server; package Client is end Client; -- main.adb with Client; pr

[Ada] Skip code not in SPARK for ownership analysis

2019-07-04 Thread Pierre-Marie de Rodat
Ownership rules for pointer support should only apply to code marked in SPARK. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Yannick Moy gcc/ada/ * sem_spark.adb (Check_Package_Spec, Check_Package_Body): Only analyze parts of

[Ada] Keep assertions in internal units enabled for GNATprove

2019-07-04 Thread Pierre-Marie de Rodat
In GNATprove mode the assertion policy is now always enabled, even when analysing internal units. Otherwise, assertion expressions (e.g. Default_Initial_Condition) in internal units (e.g. Ada.Text_IO) disappear in the semantic analysis phase of the frontend and the GNATprove backend can't see them.

[Ada] Spurious dimensionality error on aggregate with "others" assoc.

2019-07-04 Thread Pierre-Marie de Rodat
This patch fixes a spurious dimensionality error on an array aggregate with a single "others' clause whose expression is a dimensioned entity, The expansion of the aggregate may create copies of the expression, and the dimensionality check must use the type of the expression to retrieve the proper

[Ada] Fix crash in SPARK ownership checking

2019-07-04 Thread Pierre-Marie de Rodat
Analysis could crash on extended return of a non-deep type, now fixed. This has no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Yannick Moy gcc/ada/ * sem_spark.adb (Check_Statement): Only check permission of object in extended return wh

[Ada] Assertion failure on Default_Initial_Condition

2019-07-04 Thread Pierre-Marie de Rodat
This patch prevents the association of a Default_Initial_Condition with an incomplete type whose full view is the private type or private extension subject to the aspect/pragma. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Hristian Kirtchev gcc/ada/ * sem_util.adb (Pr

[Ada] Management of internal data structures in Sem_Elab

2019-07-04 Thread Pierre-Marie de Rodat
This patch modifies the timing of Sem_Elab's internal data structure creation and destruction, and adds the concept of "active" elaboration compiler phase. The elaboration phase of the compiler is active after the frontend initializes Sem_Elab. It is at this point that all internal data structures

[Ada] Spurious error on instantiation and limited_with_clause

2019-07-04 Thread Pierre-Marie de Rodat
This patch fixes a spurious error during the construction of an instance body in the inlining phase of the frontend, when the package declaration for the main unit has a limited_with_clause on some unit P, and the main unit itself does not have a corresponding regular with_clause, but some other un

[Ada] Better error messages for ownership errors in SPARK

2019-07-04 Thread Pierre-Marie de Rodat
When SPARK code does not follow the ownership rules of SPARK RM 3.10, the error message now points to a location explaining why the object has a more restricted permission than the expected one. There is no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Yann

[Ada] Synchronized object definition in SPARK updated

2019-07-04 Thread Pierre-Marie de Rodat
The definition of what types yield synchronized objected in SPARK has been updated to see through the privacy boundary. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-07-04 Yannick Moy gcc/ada/ * sem_util.adb (Yields_Synchronized_Object): Adapt to new SPARK rule. gcc

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