[Ada] Crash on unconstrained unchecked union declaration

2014-10-20 Thread Arnaud Charlet
When an object declaration as an indefinite type, the actual subtype of the object is constructed from the expression itself. If the type is an unchecked union such a subtype cannot be constructed because discriminants cannot be retrieved from the expression. In this case, rewrite declaration as a

[Ada] Slices of parameterless calls

2014-10-20 Thread Arnaud Charlet
This patch handles correctly constructs of the forms F (T) where F denotes a possibly overloaded function that can be invoked without actual parameters, and T denotes a discrete type. The construct is parsed as an indexed component but must be rewritten and analyzed as a slice of a parameterless

Re: Please revert the patches in bug #54040 and #59346 and special case x32

2014-04-09 Thread Arnaud Charlet
What do you think, Arno? I think that the POSIX breakage (and its fallout for the other Unices) is ugly and worth the additional complication. Yes, your patch looks good to me. Arno

Re: [RFC] Add aarch64 support for ada

2014-04-16 Thread Arnaud Charlet
The Makfile.in and init.c changes are OK. The types.h change is likely more controversial and may be problematic, I'll let Eric comment. + system.adssystem-linux-x86_64.ads IMO, this should really be called system-linux-lp64.ads, and should be usable for any 64-bit target that uses full

Re: [ada, build] Ignore cp -p failures during Ada make install

2014-04-25 Thread Arnaud Charlet
It seems to me that (as already done in one of three cases in the install-gnatlib target) $(INSTALL_DATA_DATE) errors should be ignored, to allow for such a case. The following patch does just that and allowed the make install to complete. Ok for mainline? No, it's not OK to ignore all

Re: [PATCH] Add support for GNU/Hurd in gnat-4.9

2014-05-19 Thread Arnaud Charlet
The build went fine. Is something still missing? We never keep commented out code, except with a ??? comment explaining why. We don't use 'FIXME', we use ??? instead. Also, some of the comments seem to be copy/paste from freebsd, which is likely not appropriate for GNU Hurd, so need to be

Re: [PATCH] Add support for GNU/Hurd in gnat-4.9

2014-05-19 Thread Arnaud Charlet
Do you want me to remove all GNU/Hurd specific header file info? No, I want you to remove commented out code, such as: +-- SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal +-- SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal +-- SIGLTHRDBG : constant :=

Re: [PATCH] Add support for GNU/Hurd in gnat-4.9

2014-05-19 Thread Arnaud Charlet
That's actually the biggest concern when people submit a new port: they submit it, get it approved, commit it and then are no longer available for any maintenance when these files need to be updated/become outdated/ no longer compile or run. I can try to do that in the near future, then

Re: [PATCH] Add support for GNU/Hurd in gnat-4.9

2014-05-21 Thread Arnaud Charlet
I think the majority of work has bee done, Now that patch will change slightly for every missing feature added to Hurd. Then it's all good, it's a matter of what I said above. Don't forget also the part where general changes are done in GNAT which require update to target specific files:

[Ada] Add usage line for gnatmake switch -d

2014-05-21 Thread Arnaud Charlet
A new line is added in the gnatmake usage for switch -d: -dDisplay compilation progress Tested on x86_64-pc-linux-gnu, committed on trunk 2014-05-21 Vincent Celier cel...@adacore.com * makeusg.adb: Add switch -d to usage. Index: makeusg.adb

[Ada] Handling of deferred references with nested prefixed calls

2014-05-21 Thread Arnaud Charlet
When handling deferred references, if an actual that is the prefix of an enclosing prefixed call has been rewritten, we must use Nkind and Sloc to identify the corresponding formal. The First_Named_Actual of the enclosing call may be meaningless after the surrounding expansion. No simple example

[Ada] Fix possible overflow in table handling

2014-05-21 Thread Arnaud Charlet
The Reallocate procedures in g-htable.adb and g-dyntab.adb are subject to problems with possible intermediate overflow. This has never been reported to cause problems, but in theory it could cause performance degradation, so it is now fixed. No test, because too much trouble to construct, and we

[Ada] Detect illegal component of dereference of access-to-constant

2014-05-21 Thread Arnaud Charlet
This patch detects an error that was previously undetected. In particular, it is illegal to rename a subcomponent of an object designated by an access-to-constant value if that subcomponent depends on discriminants. The following test should get an error: % gnatmake -f -q acc_const_test.adb

[Ada] Clearer documentation of -gnatw.g and -gnatyg switches

2014-05-21 Thread Arnaud Charlet
This patch provides more precise documentation of the GNAT mode warning switch -gnatw.g and the GNAT mode style switch -gnatyg, in both the users guide and the usage information. Documentation change only, no test needed. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-05-21 Robert Dewar

[Ada] Tag restriction warning messages

2014-05-21 Thread Arnaud Charlet
Restriction warning messages are now tagged [restriction warning] if -gnatw.d is used, instead of [enabled by default]. This new tag can be used in pragma Warning_As_Errors. The following is compiled with -gnatw.d -gnatj50 -gnatl 1. pragma Warning_As_Error ([restriction warning]); 2.

[Ada] Allow warning tag in pragma Warnings (Off, string)

2014-05-21 Thread Arnaud Charlet
This patch allows the use of a warning tag as the second parameter of a pragma Warnings (Off\On, ...) pragma. The effect is to control all error messages in that category. This tag may be either [-gnatw?] for a particular category of errors, or [restriction warning] to cover all restriction

[Ada] Add missing entities to Stand.Tree_Read and Stand.Tree_Write

2014-05-21 Thread Arnaud Charlet
Several entities were not written by Tree_Write and correspondingly not set by Tree_Read. Theoretically this could affect ASIS if it used any routines needing these entities, but we have never observed any issues in this area, so it is likely this is just a latent bug with no observable functional

[Ada] Do not complain about restricted references within defining units

2014-05-21 Thread Arnaud Charlet
Restrictions No_Abort_Statements and No_Dynamic_Attachment follow exactly the RM rule which forbids any references to certain entities. But this should not apply to the units in which these entities are declared, since otherwise, for example, a pragma Inline for one of these entities is a

[Ada] Fix error of not diagnosing bad body with non-standard file names

2014-05-21 Thread Arnaud Charlet
If Source_File_Name pragmas with patterns were used to specify a non- standard naming scheme, then the compiler would fail to diagnose an attempt to compile a spec which did not need a body when in fact a body file was present. Given a gnat.adc file containing: 1. pragma

[Ada] PR ada/9535 improved consistency of stream primitives for datagram sockets

2014-05-21 Thread Arnaud Charlet
This change implements a suggested improvement to the behaviour of stream primitives for streams backed by datagram sockets: a Read or Write call now corresponds to exactly one Receive_Socket or Send_Socket call. Test case: $ gnatmake -q udp_stream $ ./udp_stream Got 5 characters: hello with

[Ada] Implement legality rules for shared volatile variables

2014-05-21 Thread Arnaud Charlet
This patch implements the rules defined in SPARK 2014 RM section C.6. The rules forbit certain constructs to be labelled as volatile. -- Source -- -- shared_variables.ads package Shared_Variables with SPARK_Mode = On is type T is new Integer with Volatile;

[Ada] Update SPARK cross references for local packages

2014-05-21 Thread Arnaud Charlet
Cross references for GNATprove on SPARK code should not use local packages as valid scopes, but instead the enclosing subprogram, which is the meaningful scope to distinguish between local and global variables. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-05-21 Yannick Moy

[Ada] Fix error in classification of restriction warnings

2014-05-21 Thread Arnaud Charlet
Some restriction warnings messages were still being tagged as [enabled by default] instead of [restriction warning]. The following program used not to give the warning since it got incorrectly suppressed (compiled with -gnatj55 -gnatw.d -gnatl) 1. pragma Warnings (Off, [enabled by default]);

[Ada] Overriding_Indicators not legal on protected subprogram bodies

2014-05-21 Thread Arnaud Charlet
The compiler incorrectly allows overriding_indicators to be applied to protected subprogram bodies (and flags a style error with -gnatyO when they're missing), but those are disallowed by the Ada RM (see RM-8.3.1(3-6) and AC95-00213 for confirmation of intent). This is fixed, but the error can be

[Ada] Proper handling of packed array of small record with reverse SSO

2014-05-21 Thread Arnaud Charlet
This change ensures proper processing for a packed array of 4-bit records specified with reverse scalar storage order. The following program must compile quietly and execute as shown: $ gnatmake -q reduced_pkd_array_small_rec $ ./reduced_pkd_array_small_rec Config 0 = 1 Config 1 = 3 Config 2 =

[Ada] Warnings on use of uninitialized entities in an instance

2014-05-21 Thread Arnaud Charlet
This patch adds warnings to uses of potentially uninitialzed entities in instances. If an entity of a generic type has default initialization, then the corresponding actual type should be fully initialized, or else there will be uninitialized components in the instantiation that might go

[Ada] Reject the use of volatiles in assertion expressions

2014-05-21 Thread Arnaud Charlet
This patch corrects the trigger which determines the proper context of a volatile object with enabled property Async_Writers or Effective_Reads. -- Source -- -- assert_exprs.ads package Assert_Exprs with SPARK_Mode is type T is new Integer with Volatile;

[Ada] Implement new restriction No_Fixed_IO

2014-05-21 Thread Arnaud Charlet
A new restriction No_Fixed_IO, which requires partition-wide consistent use, forbids fixed I/O operations which may end up using floating-point at run-time. These include any refernce to Fixed_IO or Decimal_IO in packages Ada.Text_IO, Ada.Wide_Text_IO, and Ada.Wide_Wide_Text_IO, and any use of the

Re: [PATCH] Add support for GNU/Hurd in gnat-4.9

2014-05-22 Thread Arnaud Charlet
BTW, I wonder ho the kfreebsd people managed to get accepted upstream? This is typically a good example of patches being accepted too rapidly, and leading to maintenance issues, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56274 for which nobody is stepping up to fix. So we might well

[Ada] Cleanup handling of info and warning messages

2014-06-11 Thread Arnaud Charlet
This is a fairly major internal reorganization of how info and warning messages are handled. Info messages for elaboration are now tagged as [-gnatel] if warning tagging is activated (-gnatw.d), and info messages coming from instantiations are consistently labeled as such as shown by this example,

[Ada] gnat link and shared libraries

2014-06-11 Thread Arnaud Charlet
When gnat link is invoked and there are shared libraries, the link may be incorrect on some platforms, such as Windows. This is fixed by this patch. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-06-11 Vincent Celier cel...@adacore.com * gnatcmd.adb (Process_Link): Do not

[Ada] Analyze contracts of subprogram body stubs

2014-06-11 Thread Arnaud Charlet
This patch ensures that contract of subprogram body stubs are analyzed in timely fashion. -- Source -- -- pack.ads package Pack with SPARK_Mode, Abstract_State = State, Initializes= (Var_1, State) is Var_1 : Integer := 0; procedure Double

[Ada] Error not detected in illegal selected component

2014-06-11 Thread Arnaud Charlet
This patch corrects an error in the resolution of selected components when the prefix is overloaded and none of the interpretations matches the context. Compiling resolve_func_deref_comp.adb must yield: resolve_func_deref_comp.adb:14:18: no interpretation matches type access to T defined

[Ada] Better handling of variant records with No_Implicit_Conditionals

2014-06-11 Thread Arnaud Charlet
Previously, an attempt to declare a variant record type was rejected if restriction No_Implicit_Conditionals was active, since the resulting generated equality and initialization routines contained implicit tests. Now such declarations are allowed, but these routines are not generated if the

[Ada] Consistent processing of preelaborated units across language versions

2014-06-11 Thread Arnaud Charlet
The processing of pragma Preelaborate_05 might cause inconsistent compiler behaviour when a given unit having the pragma appears in the dependencies of both an Ada 95 and and Ada 2005 unit in the same closure. This is addressed by making runtime units Preelaborate in all cases. Tested on

[Ada] Fix handling of pragma/aspect Independent[_Components]

2014-06-11 Thread Arnaud Charlet
This fixes several errors in the handling of the pragmas Independent and Independent_Components. The implementation now matches the RM definition 100%. The following compiles without errors: 1. package Independ is 2.type A1 is array (1 .. 10) of Integer; 3.pragma

[Ada] Allow pragma Restrictions (No_Dependence = unit) in system.ads

2014-06-13 Thread Arnaud Charlet
This patch enables the recognition/processing of pragma Restrictions (No_Dependence = unit) in system.ads, allowing more flexibility in configuring specialized versions of System. Given a system.ads that contains the line pragma Restrictions (No_Dependence = Ada.Text_IO); Compiling the

[Ada] Fix spurious warning on use before def in Refined_Post aspect

2014-06-13 Thread Arnaud Charlet
The Refined_Post aspect defined in SPARK 2014 should be considered like a postcondition wrt issuing warnings on variable references. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-06-13 Yannick Moy m...@adacore.com * sem_warn.adb (Check_Unset_References): Take case of

[Ada] Fix spurious warning on imported/exported variables with aspect

2014-06-13 Thread Arnaud Charlet
Aspects Import and Export were not treated like the equivalent pragmas wrt issuing warnings on missing initialization before use. Now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-06-13 Yannick Moy m...@adacore.com * sem_ch13.adb

[Ada] Non-static aggregates in Preelaborate units

2014-06-13 Thread Arnaud Charlet
This patch removes a spurious error on a unit to which the Preelaborate pragma applies. The error appeared on a unit that holds an instantiation of a package containing a type declaration with an array component whose default value is given by an actual in the instance, but the error may occur in

[Ada] Elaborate Secondary_Stack early

2014-06-13 Thread Arnaud Charlet
This patch fixes an obscure bug that causes the secondary stack to be used before it is initialized in certain cases. This can only happen if (1) the -gnatE switch is used to disable the static elaboration mode, (2) the -p switch is passed to gnatbind to tell it to choose a pessimistic

[Ada] Make Task_Info pragma and package obsolescent

2014-06-13 Thread Arnaud Charlet
The functionality is now provided in a target-independent manner Tested on x86_64-pc-linux-gnu, committed on trunk 2014-06-13 Geert Bosch bo...@adacore.com * gnat_rm.texi, s-tasinf-solaris.ads, sem_prag.adb, gnat_ugn.texi, s-tasinf-mingw.ads, s-tasinf.ads, s-tasinf-linux.ads,

[Ada] Improvements to handling of pragma Compiler_Unit_Warning

2014-06-13 Thread Arnaud Charlet
We now check for null statement sequences, and for extended return statements. In addition, the message generated now includes a description of the non-permitted construct as shown in this test program (compiled with -gnatj60 -gnatl) 1. pragma Ada_2012; 2. pragma Compiler_Unit_Warning;

[Ada] Assertion policy and postconditions

2014-06-13 Thread Arnaud Charlet
This patch fixes the handling of attribute reference 'Old in the presence of Assertion_Policy (Checked) pragma, when a unit is compiled without the -gnata flag. Compiling and executing the following: gnatmake -q assertion_policy_test.adb assertion_policy_test Must yield: +

[Ada] GNAT.Command_Line.Get_Argument does't expand correctly with custom parser

2014-06-13 Thread Arnaud Charlet
This patches fixes the use of custom parsers when trying to expand command line arguments like *.adb. When run from the test directory, the following program should output next source test_cmd_line1.adb. with Ada.Text_IO; use Ada.Text_IO; with GNAT.Command_Line; use

[Ada] Remove global variable Root_Environment from Project Manager

2014-06-13 Thread Arnaud Charlet
Global variable Root_Environment was used in the Project Manager, but was not initialized by GNATCOLL and GPS. This patch eliminates the direct use of Root_Environment. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-06-13 Vincent Celier cel...@adacore.com * makeutl.ads

[Ada] Handle range check for float Pre/Succ attributes

2014-06-13 Thread Arnaud Charlet
In Float_Check_Overflow mode, Succ applied to type'Last or Pred applied to type'First generates a constraint error since the argument is out of range. This was not previously changed, the following test: 1. with Ada.Exceptions; use Ada.Exceptions; 2. with Text_IO; use Text_IO; 3.

[Ada] Avoid unnecessary warnings about address clause alignment

2014-06-13 Thread Arnaud Charlet
This patch detects cases where we can tell at compile time that an address clause value is compatible with the alignment of the object so that we do not need to issue a warning. The following is compiled with -gnatwa -gnatld7 -gnatj55 1. pragma Restrictions (No_Exception_Propagation);

[Ada] PR ada/61505

2014-06-14 Thread Arnaud Charlet
A blind attempt (since I'm using makeinfo 4.8 where the error does not show up) at fixing the makeinfo errors on gnat_rm.texi Let me know if this fixes the errors. 2014-06-14 Arnaud Charlet char...@adacore.com PR ada/61505 * gnat_rm.texi: Attempt to fix error with makeinfo 5.1

Re: [Ada] PR ada/61505

2014-06-14 Thread Arnaud Charlet
2014-06-14 Bernd Edlinger bernd.edlin...@hotmail.de PR ada/61505 * gnat_rm.texi: Fix errors with makeinfo 5.1. This looks good, except that there's a last change needed (at least according to older versions of makeinfo), now detected: --- gnat_rm.texi(revision

[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] 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] 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] 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] Exception during finalization of controlled object

2014-02-06 Thread Arnaud Charlet
This patch corrects the finalization machinery to properly handle a controlled object that is initialized by an aggregate and acts as a transient. The object is now considered fully initialized after the last component assignment takes place. This avoids the finalization of uninitialized data that

[Ada] Crash on processing external property

2014-02-06 Thread Arnaud Charlet
This patch modifies the mechanism that detects an enabled property to handle the case where the property appears with an expression. -- Source -- -- serial_port.ads pragma SPARK_Mode; package Serial_Port with Abstract_State = (Input_Port with External =

[Ada] Predicates on partial views

2014-02-06 Thread Arnaud Charlet
This patch fixes some errors in the handling of dynamic predicates applied to private types. Compiling and executing the following: gnatmake -q -gnata main main must yield: Endevour Ariane5 Failure to launch --- with gnat.io; with ada.assertions; procedure Main is package

[Ada] Exception during finalization of controlled object

2014-02-06 Thread Arnaud Charlet
This patch corrects the transient object machinery to detect subprogram calls in constructs that have been heavily expanded. -- Source -- -- types.ads with Ada.Finalization; use Ada.Finalization; package Types is Bomb : exception; Not_Zero : exception;

[Ada] Forbid the use of aspect/pragma SPARK_Mode in generics

2014-02-06 Thread Arnaud Charlet
The following patch modifies the analysis of generic packages and subprograms to flag aspect/pragma SPARK_Mode as illegal. -- Source -- -- in_function.ads pragma SPARK_Mode (On); generic Val : Integer; function In_Function return Integer with SPARK_Mode; --

[Ada] Composite postconditions

2014-02-06 Thread Arnaud Charlet
This patch fixes the order in which the conjuncts in complex postconditions are tested. Such postconditions are expanded into individual tests, chained to internal lists when aspects are processed, and combined with other tests when building the contract checking procedure for a given subprogram.

[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

Re: Use [warning enabled by default] for default warnings

2014-02-09 Thread Arnaud Charlet
IMO the natural assumption is that gnu++11 is enabled by default, which is how Lars also read it. There seemed to be support for using warning enabled by default instead, so this patch does that. Tested on x86_64-linux-gnu. OK to install? I'll post an Ada patch separately. FWIW this

Re: [Ada] Use [warning enabled by default] for default warnings

2014-02-09 Thread Arnaud Charlet
This switches Ada from using [enabled by default] to [warning enabled by default] for consistency with: http://gcc.gnu.org/ml/gcc-patches/2014-02/msg00549.html Tested on x86_64-linux-gnu. OK if the above patch goes in? As I just mentioned, this isn't OK at first sight. Arno

[Ada] Reduce use of N_Reference nodes in generated code

2014-02-18 Thread Arnaud Charlet
This is an internal optimization that reduces the number of cases in which we generate N_Reference nodes. Generally has no effect on functional behavior, but the following test: 1. function StrangeRef (A, B : Integer) return Integer is 2.X : Integer; 3. begin 4.X :=

[Ada] Use of attributes 'Old and 'Result and local entities in another 'Old

2014-02-18 Thread Arnaud Charlet
This patch implements the following sentence from Ada RM 6.1.1 (27/3): The prefix of an Old attribute_reference shall not contain a Result attribute_reference, nor an Old attribute_reference, nor a use of an entity declared within the postcondition expression but not within prefix itself

[Ada] Error recovery in task body

2014-02-19 Thread Arnaud Charlet
This patch fixes a crash in a task body with a single statement missing a terminating semicolon. The tree can be repaired locally so further compilation can proceed. Compiling libthr3.adb must yield: libthr3.adb:10:18: missing ; libthr3.adb:13:04: warning: no accept for entry Test ---

[Ada] Accept a constituent in a null dependency clause

2014-02-19 Thread Arnaud Charlet
This patch implements the following SPARK RM rule from 7.2.5 (3g): at least one of its constituents shall be denoted in the input_list of a null_dependency_clause; or -- Source -- -- null_dependency.ads package Null_Dependency with Abstract_State =

[Ada] Incorrect error on valid global refinement

2014-02-19 Thread Arnaud Charlet
This patch updates the analysis of aspect/pragma Refined_Global to interpret states and variables with an encapsulating state as constituents only when the related state has visible refinement. -- Source -- -- parent.ads package Parent with Abstract_State = State is

[Ada] GNAT driver and externally built library project files

2014-02-19 Thread Arnaud Charlet
When the GNAT driver is invoked to bind a main of a project file, and there are externally built library projects in the closure of the main project file, the invocation of gnatbind may fail if the object directory does not contain any ALI files. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] Missing parentheses on [Refined_]Global and [Refined_]Depends

2014-02-19 Thread Arnaud Charlet
This patch modifies the parser to detect missing parentheses on SPARK aspects Global, Depends, Refined_Global and Refined_Depends. -- Source -- -- malformed_contracts.ads package Malformed_Contracts with Abstract_State = (State_1, State_2) is procedure OK_1

[Ada] Semantics of attribute 'Old in aspect/pragma Contract_Cases

2014-02-19 Thread Arnaud Charlet
This patch implements rule SPARK RM 6.1.3 (5) which states: If an Old attribute_reference occurs within a consequence other than the consequence selected for (later) evaluation as described above, then the associated implicit constant declaration (see Ada RM 6.1.1) is not elaborated.

[Ada] Fix removal of side-effects in GNATprove mode

2014-02-19 Thread Arnaud Charlet
In the GNATprove mode for formal verification, side-effects are removed from expressions when the corresponding procedure is called in the frontend. This should only be done when not inside a generic, which is both useless and harmful as it deactivates the mechanism for name resolution of generic

[Ada] Legality rules for Synchronization aspect on protected operations

2014-02-19 Thread Arnaud Charlet
This patch detects additional errors when a Synchronization aspect on an overriding protected operation does not match the given aspect on the overridden operation of an ancestor interface. Compiling b95000g.ads must yield: b95000g.ads:29:13: type Lock_Type must implement abstract

[Ada] Do not perform expansion of generics even in GNATprove mode

2014-02-19 Thread Arnaud Charlet
In GNATprove mode for formal verification, some treatment typically only done during expansion needs to be performed on the tree, but it should not be applied inside generics. Otherwise, this breaks the name resolution mechanism for genetic instances. This completes a previous similar fix. Tested

[Ada] Duplicate projects due to symbolic links

2014-02-19 Thread Arnaud Charlet
When the same projec is imported by several projects in the project tree through different paths that includes symbolic links, the Project Manager may reported an error indicating that two different projects have the same name. This is corrected by this patch. Tested on x86_64-pc-linux-gnu,

[Ada] Internal access to Reason for Warnings Off

2014-02-20 Thread Arnaud Charlet
This is an internal change to allow retrieval of the Reason argument for a given message suppressed by Warnings (Off). No functional effect. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-02-20 Robert Dewar de...@adacore.com * errout.adb (Set_Warnings_Mode_Off): Add Reason

[Ada] Issue with SPARK aspects and generics

2014-02-20 Thread Arnaud Charlet
This patch corrects the propagation of various SPARK aspects from a generic template to an instance. -- Source -- -- values.ads package Values is In_1 : Integer := 1234; end Values; -- gen.ads with Values; use Values; generic package Gen with Abstract_State

[Ada] Proper handling of Raise_Expression nodes in Ada 2012

2014-02-20 Thread Arnaud Charlet
A Raise_Expression is expected to be of any type, and can appear as a component of any expression. This patch introduces a new type Raise_Type, that is the initial type of such a node prior to full resolution. A Raise_Expression node must eventually carry the type imposed by the context. If the

[Ada] Allow Object_Size that is a multiple of the alignment

2014-02-20 Thread Arnaud Charlet
For composite types, any object size should be allowed that is a multiple of the alignment, but the front end was rejecting some cases. The following should compile clean, giving the output shown for -gnatR2: 1. package ObjSizeTest is 2.type R is record 3. A : Integer;

[Ada] Improve error messages on SPARK annotations

2014-02-20 Thread Arnaud Charlet
This patch updates the error diagnostics of various SPARK features to emit clearer and more descriptive messages. -- Source -- -- messages.ads package Messages with SPARK_Mode = On is A : Integer := 1; B : Integer := 2; procedure Error_1 (X : in Integer)

[Ada] gnatmake -s: no recompilation when adding some -gnate? switches

2014-02-20 Thread Arnaud Charlet
When gnatmake is invoked with -s and some additional compilation switches (-gnateA, -gnateE, -gnateF, -gnateinn, -gnateu, -gnateV or -gnateY), recompilation does not necessarily occur. This patch fix this. The test is to invoke gnatmake with -s and one or these switches: recompilation should

[Ada] Do not issue warning specific to compilation in GNATprove mode

2014-02-24 Thread Arnaud Charlet
In GNATprove mode, a warning on ignored pre/post on imported subprograms was misleading, as it was meant for compilation only, while formal verification does take these into account. Hence, we do not generate this warning in GNATprove mode anymore. Tested on x86_64-pc-linux-gnu, committed on

<    1   2   3   4   5   6   7   8   9   10   >