[Ada] Dependence clause with multiple parenthesis produces misleading errors

2014-02-06 Thread Arnaud Charlet
This patch modifies the analysis of aspect/pragma [Refined_]Depends to catch clauses that contain multiple parenthesis as this is not allowed by the syntax of the aspect/pragma. -- Source -- -- multi_parents.ads pragma SPARK_Mode; package Multi_Parents with

[Ada] Order of evaluation between precondition and 'Old

2014-02-06 Thread Arnaud Charlet
This patch modifies the expansion of attribute 'Old to insert the generated temporary that captures the value of the prefix before routine _Postconditions. As a result, the precondition of a subprogram will be evaluated first, before any postcondition-related code is executed. --

[Ada] Adjust documentation of Pragma Optimize_Alignment

2014-02-06 Thread Arnaud Charlet
This adjusts the documentation of Pragma Optimize_Alignment by mentioning that the pragma also has an effect on individual objects in addition to types. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-02-06 Eric Botcazou ebotca...@adacore.com * gnat_rm.texi (Pragma

[Ada] Configuration options lost after processing of separate unit

2014-02-06 Thread Arnaud Charlet
this patch updates the analysis of package body stubs and subprogram body stubs to maintain the configuration options of the enclosing context in a stack-like fasion. This ensures that options pertaining to the proper body do not govern the options of the enclosing context. -- Source

[Ada] Loops over containers without variable indexing

2014-02-04 Thread Arnaud Charlet
This patch adds a legality check that in a loop over a container that only has a constant indexing aspect, elements are constant within the loop, and attempts to modify them are appripriately rejected. Compiling p.adb must yield: p.adb:15:07: left hand side of assignment must be a variable

[Ada] Mark intrinsic subprograms as Pure

2014-02-04 Thread Arnaud Charlet
Intrinsic subprograms in Pure packages were not marked as Pure, which was actually unintended. The spec of einfo was also not up-to-date, which is now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-02-04 Arnaud Charlet char...@adacore.com * g-souinf.ads: Subprograms

[Ada] Fix problem with misclassification of references

2014-01-31 Thread Arnaud Charlet
This patch fixes a problem in the compiler of confusing references with modifications in the xref listing. This is now fixed properly. The following program 1. procedure TooManyXrefs is 2.type r is record 3. a : integer; 4.end record; 5.type v is array

[Ada] Add restrictions to the use of s-tposen

2014-01-31 Thread Arnaud Charlet
The package s-tposen is used to implement protected objects (with one entry) in the ravenscar profile. In fact, only a subset of the ravenscar profile is required to trigger the use of this package (instead of s-tpoben). This patch adds a restriction to the triggering conditions, in order to

[Ada] Unchecked_Deallocation fails to free a class-wide object

2014-01-31 Thread Arnaud Charlet
This patch corrects the treatment of a deallocation call where the designated type is class-wide and also acts as a generic actual in an instantiation, to perform a runtime check when trying to determine the controlled-ness of the deallocated object. -- Source -- --

[Ada] Warn on barrier functions that depend on global data

2014-01-31 Thread Arnaud Charlet
This patch adds a warning to a barrier function in an entry body, when the barrier mentions data that is not private to the protected object, and subject to external modification by unsynchronized actions, which can lead to hard-to- diagnose race conditions. Compiling

[Ada] Generated name of task that is a record component

2014-01-29 Thread Arnaud Charlet
This patch removes a spurious initialization on the string that builds the name of task that is a record component, when Initialize_Scalars is enabled. This is both efficient, and prevents anomalies in the handling of dynamic objects on the secondary stack, that would result in a mangled name for

[Ada] Implement new rules for pragma SPARK_Mode

2014-01-29 Thread Arnaud Charlet
The rules for pragma SPARK_Mode have changed. In particular, the mode is not inherited anymore from a the spec to the body, and the body should not have a mode if the spec did not have one. These new rules are checked now. A minor change is that SPARK_Mode is set even on subprograms for which

[Ada] Remove Complete_Single_Entry_Body

2014-01-29 Thread Arnaud Charlet
This procedure was empty, so no need to insert a call to it. No functional change. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-29 Tristan Gingold ging...@adacore.com * exp_ch9.adb (Build_Protected_Entry): Do not call Complete_Entry_Body anymore. *

[Ada] Crash with big strings in System.OS_Lib.Normalize_Pathname

2014-01-29 Thread Arnaud Charlet
This patch prevents the copy of too big names to fixed-size buffers from overflowing. Instead, when too big strings are provided, treat them as invalid and return an empty string. The execution of the following example must print OK: $ gnatmake foo ./foo with Ada.Text_IO; use Ada.Text_IO; with

[Ada] Analyze instance with SPARK_Mode at point of instantiation

2014-01-29 Thread Arnaud Charlet
A generic instance should be analyzed with the value of SPARK_Mode defined at the point of instantiation. Now, the following code compiles without errors: $ gcc -c -gnatec=test.adc pinst.adb -- test.adc 1. pragma SPARK_Mode (On); -- pinst.ads 1. with

[Ada] Generate optimized code for protected subprograms if no exceptions.

2014-01-29 Thread Arnaud Charlet
If exceptions aren't propagated, the optimized path of Exp_Ch9.Build_Protected_Subprogram_Body could be used. No functional change, so no testcase. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-29 Tristan Gingold ging...@adacore.com * exp_ch9.adb (Is_Exception_Safe):

[Ada] gnatmake, aggregate and aggregate library projects

2014-01-29 Thread Arnaud Charlet
gnatmake, gnatclean, gnatname and the gnat driver now fail immediately if the main project is an aggregate project or if there is an aggregate library project in the project tree. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-29 Vincent Celier cel...@adacore.com *

[Ada] Include constant objects in SPARK cross references

2014-01-27 Thread Arnaud Charlet
The cross references generated for formal verification in GNATprove mode did not include constant objects. The needs have changed, and these should be included now, with a specific type character 'c' to distinguish them from references to non-constant objects. Tested on x86_64-pc-linux-gnu,

[Ada] Fix incorrect reason in exception information for range check

2014-01-27 Thread Arnaud Charlet
When a dynamic run-time range check was generated to check the bounds of an aggregate, the reason was wrong, resulting in an exception message saying length check failed instead of range check failed. The following test: 1. with Ada.Exceptions; use Ada.Exceptions; 2. with Ada.Text_IO;

[Ada] Assign and Copy do not work for ordered and hashed maps

2014-01-27 Thread Arnaud Charlet
Subprograms Assign and Copy in Containers.Ordered_Maps and Containers.Hashed_Maps were not assigning or copying anything. This patch fixes that. The test is to use these subprograms with a non empty Source map and to check that the Target map is not empty. Tested on x86_64-pc-linux-gnu, committed

[Ada] Fix irregularity in tree generated for SPARK

2014-01-27 Thread Arnaud Charlet
The compiler now uses Replace instead of Rewrite, when the semantic analyzer discovers that what looked like a selected component was in factt a function call. This avoids a special case in ASIS for handling an undecorated original node. This is an internal change only with no functional effect

[Ada] Refined external states

2014-01-27 Thread Arnaud Charlet
This patch implements the following rules concerning the refinement of external abstract states: * A state abstraction that is not specified as External shall not have constituents which are External states. * An External state abstraction shall have at least one constituent that is External

[Ada] Do not service entries after a protected function call (with -gnatp).

2014-01-27 Thread Arnaud Charlet
For single entry protected objects, the entry was served (in case of pending call and when compiled without checks) after a function call. This is useless, and not coherent with code generated without -gnatp. The following program displays 'Barrier called' only three times: gnatmake -gnatp main

[Ada] Only functions can have Ghost convention

2014-01-27 Thread Arnaud Charlet
This implements the rule in SPARK RM 6.1.6 which specifies that only functions may have convention Ghost explicitly specified. This test program shows error messages not previously given (compiled with -gnatc -gnatj60) 1. package Ghost_Illegal_1 2. with SPARK_Mode 3. is 4.

[Ada] Fix crash for bad Depends operand

2014-01-24 Thread Arnaud Charlet
This fixes a failure to properly diagnose a bad Depends operand. The following program used to provoke this crash: 1. procedure DependsCrash is 2.type R is record 3. B : Boolean; 4.end record; 5. 6.procedure Test (X : R; B : out Boolean)

[Ada] Turn off SPARK_Mode for generated subprograms

2014-01-24 Thread Arnaud Charlet
SPARK_Mode should always be off for internally generated subprograms When the following is compiled with -gnatdt: 1. package IntSPARK is 2.pragma SPARK_Mode (ON); 3.type R is record 4. X : Integer := 4; 5. Y : Integer := 5; 6.end record;

[Ada] Duplicate projects not detected

2014-01-24 Thread Arnaud Charlet
When the project path specified with environment variables ADA_PROJECT_PATH or GPR_PROJECT_PATH, or with switch -aP includes a directory where one project is found, this project may be used incorrectly when imported instead of the project with a similar name in the directory of the importing

[Ada] Protect against potentially uninitialized source information

2014-01-24 Thread Arnaud Charlet
Some tools that use the project manager might be creating a project on the fly (no reference to an actual project file), which could result in a Constraint_Error in this code. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-24 Emmanuel Briot br...@adacore.com * prj-nmsc.adb

[Ada] Fix problem with run-time library units and SPARK mode

2014-01-24 Thread Arnaud Charlet
The test for library units was wrong, resulting in run-time library units being incorrectly marked with SPARK_Mode on when a configuration pragma file had pragma SPARK_Mode (ON). The following program 1. with Ada.Text_IO; use Ada.Text_IO; 2. procedure SPragLib is 3. begin 4.

[Ada] Missing error for derived task not overriding primitive

2014-01-24 Thread Arnaud Charlet
The compiler does not report an error when a task type does not define an entry or a procedure to cover a primitive inherited from an interface type. After this patch the following test compiles with an error: package Progenitor is type Progenitor_T is synchronized interface; procedure

[Ada] Fix some missing cases of floating-point validity checks

2014-01-24 Thread Arnaud Charlet
When a program is compiled with -gnatVaf, all floating-point results of operators must be checked, since they might yield infinite or NaN results. Some cases of required checks, notably the result of object declarations with initialization expressions were not being checked. The following

[Ada] Allow raise expression in return statement

2014-01-24 Thread Arnaud Charlet
In Ada 2012, a neat way to write a function that is stubbed and just raises an exception is to write return raise excep-name, where the return expression is a raise expression. But the parser did not allow that (legal) construct. This is now fixed. The following program: 1. procedure

[Ada] Fix function Prj.Env.Ada_Objects_Path

2014-01-24 Thread Arnaud Charlet
Function Prj.Env.Ada_Objects_Path was no conform to its documentation, in particular, the second call was returning the same value even if parameter Including_Libraries was different. This patch corrects this. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-24 Vincent Celier

[Ada] Semantic checks on iterator specifications.

2014-01-24 Thread Arnaud Charlet
An iterator specification can include a subtype indication in the case of an array- or container-element iterator. This patch verifies that the subtype indication matches the element type of the array or container. Compiling the following must yield: range_in_iterator.adb:14:12: subtype

[Ada] Document check flags use in semantic analysis and expander

2014-01-24 Thread Arnaud Charlet
Document which check flags are completely set by semantic analysis, including in ASIS mode and GNATprove mode, and which check flags are only partially set. Analysis tools based on a tree obtained by semantic analysis only should thus rely only on the first category of flags to be set in the tree.

[Ada] Discriminant checks on view conversions

2014-01-24 Thread Arnaud Charlet
This patch adds a discriminant check on actuals in a call, that are type conversions of a constrained discriminated object to a constrained type. Compiling and executing discr.adb must yield: discr.adb:12:11: warning: incorrect value for discriminant J discr.adb:12:11: warning:

[Ada] Failure to detect redeclaration of constant with initial aggregate value

2014-01-24 Thread Arnaud Charlet
This patch fixes an omission in the detection of illegal redeclarations of constants whose previous full declaration includes an expression that is an aggregate. Compiling double.adb must be rejected with: double.adb:5:04: Data_1 conflicts with declaration at line 3 --- procedure Double is

[Ada] Remove unused node N_Subprogram_Info

2014-01-23 Thread Arnaud Charlet
This is an internal change only, does not affect functionality, so no test needed. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-23 Robert Dewar de...@adacore.com * exp_util.adb, sinfo.adb, sinfo.ads, sem.adb, sem_res.adb, expander.adb, exp_ch11.adb, exp_ch11.ads,

[Ada] Fix detection of unmodified variables in -gnatc mode

2014-01-23 Thread Arnaud Charlet
For an implicit dereference such as J.K where J is of an access type, the compiler incorrectly assumed that an assignment to J.K would modify J if operating in semantics only (-gnatc) mode. The following example gives the warning indicated if compiled with -gnatwa with or without -gnatc 1.

[Ada] Restrictions on 'Old in a postcondition.

2014-01-23 Thread Arnaud Charlet
RM 6.1.1 (26/3) specifies that if the prefix of 'Old wihin a postcondition is potentially unevaluated, as in the right-hand side of a short-circuit operation then the prefix can only be an entity name. Compiling main.adb must yield: p.ads:5:44: prefix that is potentially unevaluated must

[Ada] Fix problem in save/restore of SPARK_Mode

2014-01-23 Thread Arnaud Charlet
The previous checkin for saving and restoring SPARK_Mode was not complete, and as a result the SPARK_Mode_Pragma was not properly set in some cases. The following test program: 1. package Pack_Size1 is 2.pragma SPARK_Mode (On); 3.procedure P; 4. end Pack_Size1;

[Ada] Eliminate false positives on no entities ... message

2014-01-22 Thread Arnaud Charlet
This change avoids issuing the no entities .. message for a with'ed package if serious errors have been found. This eliminates some annoying false positives, as shown by the following example, compiled with -gnatwa 1. with System; use System; 2. package WarnNoEnt is 3.X :

[Ada] Early finalization of temporary variable when using -gnatE

2014-01-22 Thread Arnaud Charlet
This change removes specialized code for insertion of dynamic elaboration checks (-gnatE) that caused a temporary of a controlled type to be finalized too early when passed as actual parameter to a subprogram through a named parameter association. The following compilation must be accepted and

[Ada] Improved error message for invalid concatenation operands.

2014-01-22 Thread Arnaud Charlet
For practitioners of other languages it is useful to indicate that an access value is not a legal operand of predefined concatenation. Compiling foo.adb must yield: foo.adb:5:33: invalid operand types for operator foo.adb:5:33: left operand is access type foo.adb:6:35: invalid operand

[Ada] Visibility issue for expanded name in a proper body

2014-01-22 Thread Arnaud Charlet
This patch fixes a rare visibility issue that arises when an expanded name in a proper body has a prefix which is a package that appears in a with_clause of the proper body, when there is a homonym of the package declared in the parent of the subunit. Previous to this patch a (spurious) error was

[Ada] Check that Storage_Pool/Storage_Size not both given for same entity

2014-01-22 Thread Arnaud Charlet
This patch implements fully the rule of 13.11(3) that forbids having both a Storage_Pool and Storage_Size attribute specified for the same type, as shown by the following example: 1. with System.Storage_Elements; use System.Storage_Elements; 2. with System.Storage_Pools;use

[Ada] Handle new inequality errors in Ada 2012 more completely

2014-01-22 Thread Arnaud Charlet
This patch does two things with respect to the new illegalities in Ada 2012 regarding late declaration of equality for untagged types. First these errors can be converted to warnings using the -gnatd.E switch. Second, in earlier versions of Ada, if the -gnatwy switch is set (warn on Ada

[Ada] Check SPARK restriction on recursive call

2014-01-22 Thread Arnaud Charlet
In SPARK 2005, a subprogram may not contain a direct call to itself. This patch checks this if SPARK_05 restriction is set as shown in the following example: 1. pragma Restrictions (SPARK_05); 2. package SPARKRec is 3.procedure p1 (X : Boolean; Y : Integer); 4. end

[Ada] Crash on constant declaration with variable size with generics

2014-01-22 Thread Arnaud Charlet
This change fixes a compiler crash occurring in some cases of constant declarations initialized with a call to an instance of a generic function, when the returned type is an array of dynamically sized elements. The following compilation must be accepted quietly: $ gcc -c p.adb package Q is

[Ada] Do not assume that a volatile variable is valid

2014-01-22 Thread Arnaud Charlet
Volatile variables are never considered valid for the purposes of validity checking, since the assumption is they could change unexpectedly at any time. The following program, compiled with -gnatVa -gnatG 1. procedure ValidVolatile is 2.type R is new Integer range 1 .. 10; 3.

[Ada] Visiblity of formals of formal packages in an instance

2014-01-22 Thread Arnaud Charlet
This patch fixes a visibility problem in the presence of formal packages that have themselves formal packages declared with a box. In a generic unit the formals of such packages are visible, and this visibility must be properly reflected when compiling an instance. The following must compile

[Ada] Expression functions as fully private protected operations

2014-01-22 Thread Arnaud Charlet
An expression function that is not a completion can appear in a protected body and requires the same renaming declarations as other protected operations. The following must compile quietly: --- with Private_Types; procedure Main is package Integer_Buffer is new Private_Types (Element =

[Ada] Implement SPARK_05 rule about calls before bodies

2014-01-22 Thread Arnaud Charlet
In SPARK 2005, it is not permitted to have a call to a subprogram in the same unit as the subprogram if the body occurs later on. This implements that rule if restriction SPARK_05 is active as shown by the following example: 1. pragma Restrictions (SPARK_05); 2. package SPARKRec2 is

[Ada] Adjust internal flags for Do_Discrminant_Check

2014-01-21 Thread Arnaud Charlet
This is a preliminary internal change for setting Do_Discriminant_Check flags properly in the tree. No functional effect, so no test needed Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-21 Robert Dewar de...@adacore.com * sinfo.ads, sinfo.adb: Change Do_Discriminant_Check

[Ada] Spurious visibility error for operator in pre-condition

2014-01-21 Thread Arnaud Charlet
If a user-defined operator renames a predefined one, a use of that operator is rewritten with the predefined one, because the back-end requires it. This transformation must not be performed when analyzing the expression in a pre- or postcondition aspect or pragma, because the expression will be

[Ada] Spurious visibility error with nlined subprogram in with-clauses

2014-01-21 Thread Arnaud Charlet
A compilation unit that is a subprogram is rewritten as a package (the wrapper package) containing the body of the actual subprogram instance. The wrapping happens when the unit is compiled upon its appearance in the context of some unit. If it appears in several such contexts, and the subprogram

[Ada] Update spec for Compile_Time_Known_Value

2014-01-21 Thread Arnaud Charlet
This is an internal change to documentation, and the interface to one function in the compiler. No functional effect, so no test needed. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-21 Robert Dewar de...@adacore.com * sem_eval.adb (Compile_Time_Known_Value): Add

[Ada] Allow to extend a project imported only by extended projects

2014-01-21 Thread Arnaud Charlet
A project that is imported by an extended project was not allowed to be extended. This patch fixes this. Invoking gnatmake -P test_util.gpr should not result in an error such as cannot extend an already imported project file or cannot import an already extended project file with

[Ada] Work on pragma SPARK_Mode

2014-01-21 Thread Arnaud Charlet
This patch redoes the data structures for pragma SPARK_Mode so that the tree captures full information on the SPARK_Mode setting in all cases, so that it can easily be accessed by gnat2why. It also fully implements the error checking on monotonicity of SPARK_Mode settings, and also properly

[Ada] Change SPARK_Mode into GNATprove_Mode, and avoid expansion

2014-01-20 Thread Arnaud Charlet
The use of SPARK_Mode to refer to GNAT being called in the context of formal verification was confusing, because of the recent addition of a new pragma SPARK_Mode with a different meaning. This mode of the frontend has been renamed GNATprove_Mode, to refer to the tool it is used in. (This is

[Ada] Remove obsolete mode Full_Expander_Active

2014-01-20 Thread Arnaud Charlet
With the rewriting of the GNATprove mode of the frontend, the pseudo-flag Full_Expander_Active is now the same as Expander_Active, so remove it. Also, the special rewriting of renamings into renamed subprograms for each call done in GNATprove mode is now moved to the GNATprove backend.

[Ada] Abstract views of states and variables

2014-01-20 Thread Arnaud Charlet
This patch implements abstract views of states and variables defined as: State abstractions are visible in the limited view of packages in SPARK 2014. The notion of an abstract view of a variable declaration is also introduced, and the limited view of a package includes the abstract view of any

[Ada] Memory corruption in GNAT.Array_Split (and String_Split)

2014-01-20 Thread Arnaud Charlet
Use a copy-on-write scheme to ensure that a Slice_Set is not deallocated twice. The following program must execute under valgrind without error: with Ada.Text_IO; use Ada.Text_IO; with GNAT.String_Split; use GNAT.String_Split; procedure Gspl is C, C2 : Slice_Set; begin declare S :

[Ada] Preliminary work to support ARM unwinder

2014-01-20 Thread Arnaud Charlet
Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-20 Tristan Gingold ging...@adacore.com * raise-gcc.c (exception_class_eq): New function. (is_handled_by): Use it to compare exception classes. (PERSONALITY_STORAGE): Define. (continue_unwind): New function to

[Ada] Cleanup of aspect/pragma Refined_Post

2014-01-20 Thread Arnaud Charlet
This patch adds logic to verify that the expression of aspect/pragma Refined_Post mentions 'Result and introduces a post-state when applied to a function. -- Source -- -- result_and_post.ads package Result_And_Post is function OK (Formal : Integer) return Integer;

[Ada] Missing finalization of transient result with exception

2014-01-20 Thread Arnaud Charlet
This patch corrects the finalization machinery to ensure that a controlled transient result is finalized when the related context raises an exception. -- Source -- -- pack.ads with Ada.Finalization; use Ada.Finalization; package Pack is type Ctrl is new Controlled

[Ada] Aspects Depends and Global on subprogram body stubs

2014-01-20 Thread Arnaud Charlet
This patch corrects the relocation of aspects related to a subprogram body stub that also acts as a spect. -- Source -- -- stubs.ads package Stubs is procedure S1 (L, R : in out Integer) with Depends = (L = R, R = L); procedure Error1 (L, R : in out

[Ada] New pragma Allow_Integer_Address

2014-01-20 Thread Arnaud Charlet
The new configuration pragma Allow_Integer_Address sets a mode in which expressions of an integer type may be used in constructs that normally require an expression of type System.Address. The effect is to introduce an implicit unchecked conversion from the integer type to type Address. This mode

[Ada] Enabling assertions in predefined units

2014-01-20 Thread Arnaud Charlet
Some configuration switches that usually do not apply to predefined units, such as enabling assertion checking, can be applied to such a unit when they are the main unit and the switch is provided in the compilation command. When such a unit is a package body, the switch setting must apply as well

[Ada] Refinements for pragma Allow_Integer_Address

2014-01-20 Thread Arnaud Charlet
The switch -gnates is no longer available, this mode must be set using the configuration pragma, or -gnatd.M or is set automatically in CodePeer mode. The pragma is now only allowed if Address is a private type (since otherwise it makes no sense), and finally an error is corrected which caused the

[Ada] 'use all type' syntax error

2014-01-20 Thread Arnaud Charlet
This patch detects a syntax error when use all is not followed by type. The following test must get an error: gcc -c use_all_type_syntax.adb use_all_type_syntax.ads:3:12: type expected package Use_All_Type_Syntax is use all TYP Boolean; -- syntax error end Use_All_Type_Syntax; Tested on

[Ada] Fully initialized types

2014-01-20 Thread Arnaud Charlet
This patch adds an enumeration type and a function to determine the default initialization kind of an arbitrary type. These facilities are intended for formal verification proofs. No applicable test. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-20 Hristian Kirtchev

[Ada] Better handling of exponentiation range check

2014-01-20 Thread Arnaud Charlet
This corrects the problem of failing to set the Do_Range_Check flag for the right operand of integer exponentiation when needed. It supercedes the special check previously made in checks to unconditionally set the flag in gnatprove mode. The flag is now properly set, with proper range analysis, in

[Ada] Uniform trees for certain aspects and corresponding source pragmas

2014-01-20 Thread Arnaud Charlet
This patch ensures that the sole argument of pragmas Abstract_State, Contract_Cases, Depends, Global, Initializes, Refined_Depends, Refined_Global and Refined_State is always an aggregate unless it is null. The end result of this change is a uniform tree in both aspect specifications and pragmas.

[Ada] Free debug flags used for GNATprove mode

2014-01-20 Thread Arnaud Charlet
Debug flags used during initial development of GNATprove are now freed, at the exception of -gnatd.F, which stays as a pure debug flag to emulate the behavior of the frontend in GNATprove mode. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-20 Yannick Moy m...@adacore.com *

[Ada] Missing return statement is illegal in GNATprove mode

2014-01-20 Thread Arnaud Charlet
This patch makes the missing return statement illegal in GNATprove mode as required by official SPARK 2014 syntax/semantics. The following program is compiled with -gnatd.F 1. package Various is 2.subtype Index_Type is 3. Positive range 1 .. 10; 4.type

[Ada] Test SPARK_Mode instead of GNATProve_Mode for warnings

2014-01-20 Thread Arnaud Charlet
This changes the handling of cases in which warnings are normally given for constructs that are bound to raise run time exceptions if executed. Previously we converted these to errors unconditionally in GNATProve mode, but that caused trouble with non-SPARK code, notably s-scaval from the run-time

[Ada] Add flags for front-end (internal change only)

2014-01-20 Thread Arnaud Charlet
This patch adds a new Flags array parallel to the Nodes array, and uses it to provide four new flags Flag0,1,2,3 available in all nodes and entities. There is room for four more flags in every node, for use later And also space for five extra bytes in every entity, should we ever need it. No

[Ada] Remove special case in GNATprove mode that ignored potential errors

2014-01-20 Thread Arnaud Charlet
When run in GNATprove mode, the frontend should still issue errors related to wrong sizes for representation clauses and pragma Pack. As the target machine can be specified with -gnatet, there is no need to ignore such errors anymore. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-21

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-18 Thread Arnaud Charlet
Yes, it passed all tests with -m32, -mx32, -m64 on Linux/x86-64. Installed on trunk. Is this OK to backport to 4.8 branch after a few days? Actually there are two issues with your change: Using time_t for tv_nsec looks actually wrong, the definition on (my) linux is: struct timespec {

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-18 Thread Arnaud Charlet
Actually there are two issues with your change: Using time_t for tv_nsec looks actually wrong, the definition on (my) linux is: struct timespec { __kernel_time_t tv_sec; /* seconds */ longtv_nsec;/* nanoseconds */ }; As you

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-18 Thread Arnaud Charlet
struct timespec { __kernel_time_t tv_sec; /* seconds */ longtv_nsec;/* nanoseconds */ }; This is wrong for x32 where tv_nsec is long long, not long. There are a couple places where long should be long long for x32. Well

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-18 Thread Arnaud Charlet
Ada was using long for time_t and type timeval is array (1 .. 2) of C.long It assumes that the type of tv_nsec is the same as tv_sec. Yes, and that was indeed wrong/dangerous. --- s-osinte-solaris-posix.ads (revision 298928) +++ s-osinte-solaris-posix.ads (working copy) @@ -513,7

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-18 Thread Arnaud Charlet
__syscall_slong_t is a Linux specific type. We can add tv_nsec_t, which should be the same as time_t for all the current targets. Introducing tv_nsec_t looks reasonable to me. Can you make the change? Thanks. Not right now, I have lots of other things to do. Arno

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-15 Thread Arnaud Charlet
This is what I got. I added s-posix-time.ads which declares System.OS_Time.time_t. I use it instead long for time_t. I didn't add time_t to s-linux.ads since it isn't used by s-osprim-posix.adb. Adding s-posix-time.ads isn't desirable, too intrusive. Better to use time_t (only) from

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-15 Thread Arnaud Charlet
This is what I got. I added s-posix-time.ads which declares System.OS_Time.time_t. I use it instead long for time_t. I didn't add time_t to s-linux.ads since it isn't used by s-osprim-posix.adb. Adding s-posix-time.ads isn't desirable, too intrusive. Better to use time_t (only)

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-15 Thread Arnaud Charlet
Looks better now, but please do not add a dependency on System.Linux in s-taprop-linux.adb, and instead use: type timeval is array (1 .. 2) of System.OS_Interface.time_t; Arno

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-15 Thread Arnaud Charlet
Looks better now, but please do not add a dependency on System.Linux in s-taprop-linux.adb, and instead use: type timeval is array (1 .. 2) of System.OS_Interface.time_t; Arno It doesn't work: s-taprop.adb:630:60: time_t is not a visible entity of OS_Interface Right, time_t

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-15 Thread Arnaud Charlet
Here is the new patch. Does it look OK? Assuming you can successfully build on e.g. x86-linux and x32-linux, this looks OK to me, thanks for your efforts! Arno

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-15 Thread Arnaud Charlet
Yes, it passed all tests with -m32, -mx32, -m64 on Linux/x86-64. Installed on trunk. Is this OK to backport to 4.8 branch after a few days? I would wait one or two weeks, to let time for people to report build failures on other configs which is always possible when doing this kind of delicate

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-14 Thread Arnaud Charlet
FAIL: gnat.dg/memtrap.adb (test for excess errors) FAIL: gnat.dg/memtrap.adb scan-assembler __gnat_begin_handler|__gnat_raise_nodefer FAIL: gnat.dg/specs/addr1.ads (test for bogus messages, line 24) FAIL: gnat.dg/specs/atomic1.ads (test for errors, line 9) FAIL: gnat.dg/specs/atomic1.ads

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-14 Thread Arnaud Charlet
No, introducing all these extra/almost duplicated files is not OK, you'd need to find a way to share the existing files instead, thanks. I am not familiar with Ada. Can you recommend how to fix it? Can you send a diff between the *-linux files and your new files? This should help giving

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-14 Thread Arnaud Charlet
I am not familiar with Ada. Can you recommend how to fix it? Can you send a diff between the *-linux files and your new files? This should help giving some options. This is the total diff. OK so I would declare a new type in System.Linux (e.g. time_t), have a new variant of s-linux

Re: [PATCH] PR ada/54040: [x32] Incorrect timeval and timespec

2013-11-14 Thread Arnaud Charlet
I also changed s-osinte-posix.adb and s-osprim-posix.adb for x32. They aren't Linux specific. What should I do with them? I would use the time_t type defined in s-osinte* (all POSIX implementations of s-osinte* have such definition, or if they don't, it's easy to add), and in the

[Ada] Clean ups in SPARK mode

2013-10-17 Thread Arnaud Charlet
1) Remove special expansion of NOT IN operator in SPARK verification The special expansion for NOT IN operator in the SPARK formal verification mode is not needed anymore. Now removed. 2) Document additional requirements on tree for SPARK verification Formal verification of SPARK code is done

[Ada] Fix generation of references for SPARK formal verification

2013-10-17 Thread Arnaud Charlet
The generation of references for SPARK formal verification was missing some write references through renamings. This is now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-10-17 Yannick Moy m...@adacore.com * sem_ch8.adb (Find_Direct_Name): Keep track of assignments for

[Ada] Remove useless special handling for SPARK verification

2013-10-17 Thread Arnaud Charlet
The use of a specific light expansion for SPARK verification has rendered obsolete a number of special handling cases only triggered in the normal full expansion. Remove these useless cases now. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-10-17 Yannick Moy m...@adacore.com

[Ada] Add switch to output reason why spec requires body

2013-10-17 Thread Arnaud Charlet
The warning switch -gnatw.y(.Y) activates(deactivates) a mode in which information messages are given that show why a package spec requires a body. This can be useful if you have a large package which unexpectedly requires a body. 1. package ReqBody is | info:

[Ada] Scalar_Storage_Order consistency for nested composites

2013-10-17 Thread Arnaud Charlet
Scalar_Storage_Order must be consistent between any component of a composite type (array or record) and the composite type itself. We already enforced this in the case where the enclosing type has a Scalar_Storage_Order attribute definition, and the component type has none. We now also do so also

[Ada] Check for illegal global refs to abstract state when refinement visible

2013-10-17 Thread Arnaud Charlet
This implements the rule in SPARK RM (6.1.5(4)): A global item shall not denote a state abstraction whose refinement is visible (a state abstraction cannot be named within its enclosing package's body other than in its refinement). The following is compiled with -gnatd.V 1. package

<    7   8   9   10   11   12   13   14   15   16   >