[Ada] Extend the applicability of Thread_Local_Storage to composite types

2018-05-30 Thread Pierre-Marie de Rodat
This patch allows the GNAT-specific Thread_Local_Storage to be applied to variables of a composite type initiallized with an aggregate with static components that requires no elaboration code. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-05-30 Ed Schonberg gcc/ada/ * freeze

[Ada] ACATS 4.1G - CXAG003 - Name_Case_Equivalence doesn't exist

2018-05-30 Thread Pierre-Marie de Rodat
Implement a missing portion of Ada 2005's AI05-0049-1 for subprogram Ada.Directories.Name_Case_Equivalence so that user programs can account for operating system differences in case sensitivity. -- Source -- -- main.adb with Ada.Directories; use Ada.Directories; with A

[Ada] Implement pragma Max_Entry_Queue_Depth

2018-05-30 Thread Pierre-Marie de Rodat
This patch implements AI12-0164-1 for the aspect/pragma Max_Entry_Queue_Depth. Previously, the GNAT specific pragma Max_Queue_Length fulfilled this role, but was not named to match the standard and thus was insufficent. -- Source -- -- pass.ads with System; package Pas

[Ada] Set Etype on rewriteen Max_Queue_Length expressions

2018-05-31 Thread Pierre-Marie de Rodat
Rewriting of Max_Queue_Length expression into N_Integer_Literal should probably be done in expansion and not in analysis, but anyway it should not strip the expression from its Etype because backends (e.g. GNATprove) expect that Etype to be present. No frontend test is provided, because GNAT doesn

[Ada] Posix 2008: reimplement System.OS_Primitives.Clock using clock_gettime

2018-05-31 Thread Pierre-Marie de Rodat
gettimeofday is deprecated in Posix 2008, clock_gettime is the recommended replacement. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-05-31 Doug Rupp gcc/ada/ * libgnat/s-osprim__posix2008.adb (Clock): Implement using clock_gettime.--- gcc/ada/libgnat/s-osprim__posix

[Ada] Post warning on object size clause for subtype

2018-05-31 Thread Pierre-Marie de Rodat
This ensures that a warning for an object size clause present on a subtype is posted on the clause and not on a size clause present on the type. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-05-31 Eric Botcazou gcc/ada/ * einfo.ads (Object_Size_Clause): Declare. * ei

[Ada] Simplify call to Unique_Defining_Entity on protected entry declarations

2018-05-31 Thread Pierre-Marie de Rodat
Calling Unique_Defining_Entity on protectected entry declarations is equivalent to calling a simpler Defining_Entity; use the simpler routine. Simplification only; semantics unaffected, so no test provided. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-05-31 Piotr Trojanek gcc/ada/

[Ada] Fix check on placement of multiple loop (in)variant pragmas

2018-05-31 Thread Pierre-Marie de Rodat
Loop (in)variants should appear next to each other, which is checked by GNAT frontend. As statements inserted during expansion may break this contiguity, GNAT recognizes specially such statements which originate in loop pragmas. In some cases, this special treatment was not properly put in place, w

[Ada] Spurious tampering check failure

2018-05-31 Thread Pierre-Marie de Rodat
This patch modifies the transient scope mechanism to create a scope when the condition of an iteration scheme returns a controlled result or involves the secondary stack. As a result, a while loop which iterates over a container properly manages the tampering bit at each iteration of the loop. Tes

[Ada] Update comment on __atomic_compare_exchange in s-atomic_primitives

2018-05-31 Thread Pierre-Marie de Rodat
Remove mention of unavailability, long obsolete, and reword suggestion of use to indicate that we might want to switch to an internal interface using them. The current wording suggests just that we should bind the current Sync_Compare_And_Swap Ada subprograms to __atomic_compare builtins instead of

[Ada] Detect returning procedures annotated with No_Return

2018-05-31 Thread Pierre-Marie de Rodat
GNAT was emitting a warning about procedures with No_Return aspect on the spec and a returning body, but failed to handle similar procedures with no explicit spec. Now fixed. This was also affecting GNATprove, where an undetected mismatch between No_Return aspect and the body was a soundness bug,

[Ada] Illegal copy of limited object

2018-05-31 Thread Pierre-Marie de Rodat
This patch fixes a spurious copy of a limited object, when that object is a discriminated record component of a limited type LT, and the enclosing record is initialized by means of an aggregate, one of whose components is a call to a build-in-place function that returns an unconstrained object of t

[Ada] Static predicate check on characters of a string literal

2018-05-31 Thread Pierre-Marie de Rodat
This patch implements the rule given in RM 4.2 (11): if the component type of a string literal is a character type with a static predicate, that predicate must be applied to each character in the string. Compiling the example below must yield: gcc -c -gnata main.adb main.adb:4:23: warning:

[Ada] Fix __gnat_backtrace for VxWorks7 on x86

2018-05-31 Thread Pierre-Marie de Rodat
A STORAGE ERROR is raised in __gnat_backtrace: adainit: 0x00400DBC Execution of ce.vxe terminated by unhandled exception raised STORAGE_ERROR : SIGSEGV: possible stack overflow Call stack traceback locations: 0x4082f1 0x408323 0x4080c9 It was passing with vxsim because the WRS_RTP_BASE is set to

[Ada] Crash with Inline_Always on a function with an extended return

2018-06-11 Thread Pierre-Marie de Rodat
This patch fixes a crash on a unit with a function with the GNAT-specific Inline_Always pragma whose body is an extended return statement, when compiling with no optimization level specified. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-06-11 Ed Schonberg gcc/ada/ * inline.

[Ada] Crash on instantiation of nested generic in private part

2018-06-11 Thread Pierre-Marie de Rodat
This patch fixes a compiler abort on an instantiation of a generic nested within another instance, when the outer instance is declared in the visible part of a package and the inner intance is in the private part of the same package. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-06-11 E

[Ada] Performance degradation with references

2018-06-11 Thread Pierre-Marie de Rodat
This patch modifies the creation of markers for variable references in the context of SPARK elaboration checks. Previously, prior to checking whether a reference requires such a marker, the compiler performed a logarithmic look up to determine whether the reference appears within a call. This actio

[Ada] Wrong code in array aggregates of Ada coextensions

2018-06-11 Thread Pierre-Marie de Rodat
The compiler generates wrong code when an array aggregate with an others choice whose expression has nested object allocations (ie. others => new R (new S)) is used to initialize an array of access to discriminated types whose discriminant is an access type. Tested on x86_64-pc-linux-gnu, committe

[Ada] Fix handling of Pre/Post contracts with AND THEN expressions

2018-06-11 Thread Pierre-Marie de Rodat
Pre- and postconditions with top-level AND THEN expressions are broken down into checks of indivudial conjuncts for more precise error reporting. This rewrite interfers with detection of potentially unevaluadted use of 'Old, e.g. a contract like "Pre => Foo and then Bar" is rewritten into a two pra

[Ada] Don't split AND THEN expressions in GNATprove_Mode

2018-06-11 Thread Pierre-Marie de Rodat
Splitting AND THEN expressions in contracts into separate pragma Check is only useful for compilation when the error message points to a failed conjunct. For proof it is of no use; for flow analysis it is annoying. Also, it makes debugging harder. Now it is disabled in GNATprove_Mode. Compilation

[Ada] Do not force Part_Of on generic units

2018-06-11 Thread Pierre-Marie de Rodat
This fixes the code checking SPARK RM 7.2.6(3) so that generic child units are not forced to use Part_Of to relate their abstract state to the state of their parent. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-06-11 Yannick Moy gcc/ada/ * sem_prag.adb (Analyze_Part_Of): On

[Ada] Mark extended return of unconstrained type as never inlined

2018-06-11 Thread Pierre-Marie de Rodat
Calls to subprograms whose body was an extended return of an unconstrained type were marked as not inlined, while the subprogram itself was marked as always inlined. This was inconsistent and could lead to crash in GNATprove. Now such subprograms are marked as not candidates for inlining. This mos

[Ada] Crash on protected type entry family

2018-06-11 Thread Pierre-Marie de Rodat
The compiler may blow up compiling the body of a protected type that has a family entry whose entry index specification contains a call to a function. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-06-11 Javier Miranda gcc/ada/ * exp_ch9.adb (Expand_N_Protected_Body): Add mis

[Ada] Make GNAT.Array_Split a preelaborable unit

2018-06-11 Thread Pierre-Marie de Rodat
This patch makes GNAT.Array_Split a preelaborable unit. As a result, it can be withed by other preelaborated untis. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-06-11 Hristian Kirtchev gcc/ada/ * libgnat/g-arrspl.ads: Add pragma Preelaborate. gcc/testsuite/ * gnat

[Ada] Do not query the representation information in CodePeer/GNATprove

2018-06-11 Thread Pierre-Marie de Rodat
Representation information generated when user calls the compiler with -gnatR switch is not available when running the frontend inside CodePeer or GNATprove. Do not query such information in that case, as this leads to spurious messages that it is not available. There is no impact on compilation.

[Ada] Reject violation of SPARK 6.1.4(12) with enclosing task unit

2018-06-11 Thread Pierre-Marie de Rodat
SPARK 6.1.4(12) applies both to enclosing subprograms and enclosing task units, but the latter was not correctly rejected. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-06-11 Yannick Moy gcc/ada/ * sem_prag.adb (Check_Mode_Restriction_In_Enclosing_Context): Adapt for

[Ada] Missing predicate function body for derived type in nested package

2018-06-11 Thread Pierre-Marie de Rodat
This patch fixes a bug in the construction of predicate functions. For a derived type, we must ensure that the parent type is already frozen so that its predicate function has been constructed already. This is necessary if the parent is declared in a nested package and its own freeze point has not

[Ada] Mark parameters as coming from source for GNATprove

2018-06-11 Thread Pierre-Marie de Rodat
When building a separate subprogram declaration for possible inlining of local subprograms in GNATprove mode, correctly mark subprogram parameters as coming from source. This has no impact on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-06-11 Yannick Moy gcc/ada/

[Ada] Dangling cursor checks in Element function

2018-06-11 Thread Pierre-Marie de Rodat
In Ada.Containers.Ordered_Maps, if a dangling cursor is passed to the Element function, execution is erroneous. Therefore, the compiler is not obligated to detect this error. However, this patch inserts code that will detect this error in some cases, and raise Program_Error. The same applies to Ord

[Ada] Improve last exception info availability from C++ handlers

2018-06-11 Thread Pierre-Marie de Rodat
The Most_Recent_Exception service failed to provide accurate information on an Ada exception caught by a C++ handler for foreign exceptions. The service relies on updates of a "current exception buffer" from live exception objects at various points of the propagation process and this update was not

[Ada] Suppress the expansion of ignored assertion pragmas

2018-06-11 Thread Pierre-Marie de Rodat
This patch suppresses the expansion of ignored assertion pragmas. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-06-11 Hristian Kirtchev gcc/ada/ * contracts.adb (Process_Body_Postconditions): Expand only checked postconditions. (Process_Contract_Cases_For): E

[Ada] Double finalization of limited controlled result

2018-06-11 Thread Pierre-Marie de Rodat
This patch disables a build-in-place optimization when a function returns a limited controlled result because the optimization may violate the semantics of finalizable types by performing illegal calls to Finalize. In general, the optimization causes the result object of a build-in-place function

[Ada] Inconsistent scope chain due to quantified expression

2018-01-11 Thread Pierre-Marie de Rodat
This patch corrects the minor decoration performed on invariant procedures in case the procedure is not inserted into the tree and analyzed. The decoration now constructs a proper first/next/last entity chain containing the single formal parameter which represents the object of the related type. Th

[Ada] Wrong column in sloc of "expect name" error for loop variant

2018-01-11 Thread Pierre-Marie de Rodat
This patch corrects error messages printed when using the pragma Loop_Variant without a named argument from having an incorrect column number in some cases. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-01-11 Justin Squirek gcc/ada/ * sem_prag.adb (Analyze_Pragma:Pragma_Loop

[Ada] Missing finalization in case expression

2018-01-11 Thread Pierre-Marie de Rodat
This patch modifies the processing of controlled transient objects within case expressions represented by an Expression_With_Actions node. The inspection of an individual action must continue in case it denotes a complex expression, such as a case statement, which in turn may contain additional tra

[Ada] Encoding of with clauses in ALI files

2018-01-11 Thread Pierre-Marie de Rodat
This patch modifies the encodings of with clauses in ALI files to adhere to the existing API. The encodigs are as follows: * Explicit with clauses are encoded on a 'W' line (same as before). * Implicit with clauses for ancestor units are encoded on a 'W' line (same as before). * Li

[Ada] Aspect/pragma Secondary_Stack_Size can evaluate non-literals as zero

2018-01-11 Thread Pierre-Marie de Rodat
This patch fixes the problem of aspect/pragma Secondary_Stack_Size expressions with non-literals evaluating as zero in static secondary stacks allocations. The aspect Secondary_Stack_Size is now converted to a pragma instead of an attribute as the attribute does not have visibility on the discrimin

[Ada] Crash on iterated_component_association in expression function

2018-01-11 Thread Pierre-Marie de Rodat
This patch improves on the handling of the Ada2020 construct Iterated_ Component_Association in various contexts, when the expression involved is a record or array aggregate. Executing: gnatmake -gnatX -q main ./main must yield: 123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ with Text

[Ada] Finding proper scope when inside entry body

2018-01-11 Thread Pierre-Marie de Rodat
This patch modifies routine Find_Enclosing_Scope which obtains the scope of an arbitrary node to return the unique defining entity of an enclosing body. This automatically takes care of the following corner cases: * The body is a subprogram body which does not complete a previous declarati

[Ada] Illegal protected calls in inherited pre/postconditions

2018-01-11 Thread Pierre-Marie de Rodat
AI12-0166 specifies that it is illegal for a pre/postcondition of a protected operation to contain an internal call to a protected function. This patch completes the implementation of this rule in the case the condition is inherited from a classwide condition of an abstract operation of an interfac

[Ada] Integer overflow in SS_Allocate

2018-01-11 Thread Pierre-Marie de Rodat
This patch imposes a new check and rewrites existing ones to ensure operations involving SS_Ptr do not cause an Integer overflow. The Default_Sec_Stack_Size function was removed in the process to simplify System.Parameter. SS_Ptr was derived from the integer System.Parameters.Size_Type to ease the

[Ada] Different runtime behavior of Predicate_Failure

2018-01-11 Thread Pierre-Marie de Rodat
This patch corrects the generation of predicate checks to handle the case where Predicate_Failure appears as a pragma. -- Source -- -- main.adb with Ada.Assertions; use Ada.Assertions; with Ada.Exceptions; use Ada.Exceptions; with Ada.Text_IO;use Ada.Text_IO; proc

[Ada] Handling of pragma Predicate

2018-01-11 Thread Pierre-Marie de Rodat
This patch fixes an omission in the processing of pragma Predicate, which should have the same semantics as the corresponding aspect, which is more commonly used. Executing gnatmake -q -gnata predicate predicate must yield: Even1 violated Even2 violated with Text_IO; use Text_I

[Ada] Secondary stack leak due to controlled component

2018-01-11 Thread Pierre-Marie de Rodat
This pach modifies the expansion related to initialization calls and secondary stack usage to inspec the components of a type derived from Limited_Controlled or Controlled. Previously controlled types were treated as never utilizing the secondary stack, however this is not true because a controlled

[Ada] New implementation for Normalize_Pathname

2018-01-11 Thread Pierre-Marie de Rodat
This implementation fixes an issue on Windows where a single drive letter was not followed by a directory separator. On Windows the following program: with Ada.Text_IO; use Ada.Text_IO; with GNAT.OS_Lib; use GNAT.OS_Lib; procedure Main is begin Put_Line (Normalize_Pathname ("c:\"

[Ada] Annotate standard File_Type with Default_Initial_Condition (for SPARK)

2018-01-11 Thread Pierre-Marie de Rodat
GNATprove was emitting spurious checks about objects of the File_Type being uninitialized and there was no easy to fix that (those checks could only be silenced by pragma Annotate or by hiding File_Type behind as SPARK wrapper). Now the full view of File_Type is annotated with Default_Initial_Cond

[Ada] Warning on use of predefined operations on an actual fixed-point type

2018-01-11 Thread Pierre-Marie de Rodat
The compiler warns when a generic actual is a fixed-point type, because arithmetic operations in the instance will use the predefined operations on it, even if the type has user-defined primitive operations (unless formsl surprograms for these operations appear in the generic). This patch refines t

[Ada] Crash on expression function as completion, with implicit dereference

2018-01-11 Thread Pierre-Marie de Rodat
An implicit dereference freezes the corresponding designated type. Most implicit dereferences are made explicit during expansion, but this is not the case for a dispatching call where the the controlling parameter and the corresponding controlling argument are access to a tagged type. In that case,

[Ada] Null procedures not allowed in protected definitions

2018-01-11 Thread Pierre-Marie de Rodat
The syntax rules do not allow null procedures in protected definitions. This patch fixes a bug that accidentally allowed them. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-01-11 Bob Duff gcc/ada/ * par-ch9.adb (P_Protected_Operation_Declaration_Opt): Give an error if

[Ada] gnatbind -f switch gives an error for duplicates

2018-01-11 Thread Pierre-Marie de Rodat
If the -felab-order.txt switch is given to gnatbind, and there are duplicate unit names in elab-order.txt, an error will be given. The following test should get errors: this (spec) <-- that (body) error: elab-order.txt:5: duplicate unit name "this (spec)" from line 1 error: elab-order.txt:7: dupl

[Ada] Secondary stack leaks during object initialization

2018-01-11 Thread Pierre-Marie de Rodat
This patch modifies the transient scope mechanism to prevent secondary stack leaks during object initialization. The modifications are as follows: 1) Prior to this change, the secondary stack was never managed within type initialization procedures, for reasons unknown. It is speculated that the co

[Ada] Spurious error on referene to subcoponrnt in dynamic predicate

2018-01-11 Thread Pierre-Marie de Rodat
This patch fixes a visibility error in the expression for a dynamic predicate of a record type, when the expression contains a reference to a subcomponent of the record given by a selected component whose prefix is the name of the enclosing component. Executing gnatmake -q -gnata main ./mai

[Ada] Incorrect diagnostic on illegal with clause

2018-01-11 Thread Pierre-Marie de Rodat
This patch updates the detection of illegal with clauses which import private child packages to properly detect a grandchild of Ada. -- Source -- -- fake.ads package Fake is end Fake; -- fake-ada.ads package Fake.Ada is end Fake.Ada; -- fake-ada-text_io.ads packa

[Ada] No error on missing enclosing parentheses in Expression Function

2018-01-11 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby an expression within an expression function declaration or completion without proper parenthesization is incorrectly accepted by the compiler. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-01-11 Justin Squirek gcc/ada/ * par-ch6.adb (Scan_Bo

[Ada] Missing diagnostic of categorization dependency

2018-01-11 Thread Pierre-Marie de Rodat
This patch modifies the analysis of subprogram bodies to catch a case where a pure subprogram body unit depends on non-pure units. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-01-11 Hristian Kirtchev gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Check the

[Ada] Detection of illegal constituent assignments

2018-01-11 Thread Pierre-Marie de Rodat
This patch modifies the analysis of assignment statements to detect an illegal attempt to alter the value of single protected type Part_Of constituent when inside a protected function. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-01-11 Hristian Kirtchev gcc/ada/ * sem_ch5.a

[Ada] Prohibit concurrent types in Ghost regions

2018-01-11 Thread Pierre-Marie de Rodat
This patch ensures that single concurrent type declarations are marked as Ghost when they appear within a Ghost region. In addition, the patch verifies that no concurrent type is declared within a Ghost region and issues an error. -- Source -- -- types.ads package Type

[Ada] Allow uses of range utility routines on private types

2018-01-11 Thread Pierre-Marie de Rodat
Frontend only calls Is_Null_Range and Not_Null_Range routines on full views of types, but backends (for example GNATprove) might call them also on private types. This patch adapts those routines to transparently retrieve the full type when called on a private type. No frontend test, because only e

[Ada] Warning on out-of-range value for default-initialized scalar object

2018-01-11 Thread Pierre-Marie de Rodat
When an object of a type with a specified Default_Value aspect is declared without an explicit initial value and the default value is out of range of the objects subtype, the compiler now issues a warning that Constraint_Error will be raised due to an out-of-range value. The test below must output

[Ada] Crash on build-in-place call with address specification for target

2018-01-11 Thread Pierre-Marie de Rodat
The presence of an address clause complicates the build-in-place expansion because the indicated address must be processed before the indirect call is generated, including the definition of a local pointer to the object. The address clause may come from an aspect specification or from an explicit

[PATCH][PR84213] DWARF: no location for non-definition DECLs with non-trivial DECL_VALUE_EXPR

2018-02-09 Thread Pierre-Marie de Rodat
This patch restricts the set of cases in which we allow the generation of location attributes for variables that are not defined in the current unit. For such variables with complex DECL_VALUE_EXPR trees, generating a location attribute can end up creating relocations to text symbols in the deb

Re: [PATCH][PR84213] DWARF: no location for non-definition DECLs with non-trivial DECL_VALUE_EXPR

2018-02-09 Thread Pierre-Marie de Rodat
ting issues are fixed before committing. Thanks! -- Pierre-Marie de Rodat

Re: [PATCH][PR84213] DWARF: no location for non-definition DECLs with non-trivial DECL_VALUE_EXPR

2018-02-09 Thread Pierre-Marie de Rodat
On 02/09/2018 02:53 PM, Pierre-Marie de Rodat wrote: Pasto, or maybe I didn’t properly configure Vim on the machine I used. ;-) I’ll make sure these formatting issues are fixed before committing. Thanks! Committed! That was a Thunderbird pasto. I tried to update the PR. Hoping I did that

[Ada] Introduce -gnatd_A to set Opt.Disable_ALI_File

2018-09-26 Thread Pierre-Marie de Rodat
This will allow us to remove the import of flag_compare_debug in lib-writ.adb in a second stage. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-09-26 Arnaud Charlet gcc/ada/ * gnat1drv.adb (Adjust_Global_Switches): -gnatd_A sets Opt.Disable_ALI_File. * debug.a

[Ada] Set Current_Error_Node directly

2018-09-26 Thread Pierre-Marie de Rodat
This changes gigi to set Current_Error_Node directly, which should result in a more robust error handling. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-09-26 Eric Botcazou gcc/ada/ * gcc-interface/gigi.h (error_gnat_node): Delete. * gcc-interface/trans.c (error_gnat

[Ada] Fix assertion failure on record subtype with -gnatRj

2018-09-26 Thread Pierre-Marie de Rodat
The JSON output of the -gnatR machinery was choking on record subtypes and the change fixes this oversight. The following package must now compile properly with -gnatRj: package P is type Rec (D : Integer) is record C : Integer; case D is when 1 => S : String

[Ada] Regression in partial compilation of RCI units

2018-09-26 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby the compilation of partial sources (packages without bodies that require them) would not occur when said sources were remote call interfaces. This is required because such interfaces may have bodies that only exist on the server side or vice versa Tested on x86_64

[Ada] Crash on expression functions within quantified expressions

2018-09-26 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby using a call to an expression function as the domain of iteration for a loop would trigger a crash due to the function not being frozen appropriately. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-09-26 Justin Squirek gcc/ada/ * sem_ch5.adb

[Ada] Missing predicate check on return value

2018-09-26 Thread Pierre-Marie de Rodat
The semantics of the return statement includes an implicit conversion of the value to the return type of the funcction. This conversion, as elsewhere, entails a predicate check if the return type has a predicate aspect. We do not apply the check to a case expression because in the context of a ret

[Ada] Inlining of renamed subprogram instances in package body

2018-09-26 Thread Pierre-Marie de Rodat
This fixes a small discrepancy in the handling of renamed subprograms declared in a package body, between those originally a regular subprogram and those an instance of a generic subprogram, the latter being slightly hindered. The difference comes from the setting of the Is_Public flag, which was

[Ada] Preparation for new description of interface thunks

2018-09-26 Thread Pierre-Marie de Rodat
This adjusts and exposes a couple of functions of the front-end used for the generation of interface thunks so as to make them callable from gigi. This also propagates the debug info setting from the targets to the thunks so as to make stepping into primitives work better in the debugger. Tested

[Ada] Missing error on non-limited derived type with limited component

2018-09-26 Thread Pierre-Marie de Rodat
This patch fixes a missing error on a type extension with limited components, when the parent type is a derived limited interface. This may allow the unit to improperly compile, but may lead to bind-time errors when compiling a client of that unit. Compiling p.adb must yield: keys.ads:8:06: exte

[Ada] New unit GNAT.Sets

2018-09-26 Thread Pierre-Marie de Rodat
This patch implements unit GNAT.Sets which currently offers a general purpose membership set. The patch also streamlines GNAT.Dynamic_HTables and GNAT.Lists to use parts of the same API, types, and exceptions as those used by GNAT.Sets. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-09-26

[Ada] Illegal formal objects associated with anonymous acc-to-subp args

2018-09-26 Thread Pierre-Marie de Rodat
The compiler was incorrectly accepting generic instantiations with formal objects of named access-to-subprogram types associated with an actual of an anonymous access-to-subprogram type. Analyze_Object_Declaration tests for objects initialized anonymous access-to-subprogram values, and wraps a conv

[Ada] Pair miscount in Dynamic_HTable.Put

2018-09-26 Thread Pierre-Marie de Rodat
This patch corrects the logic of GNAT.Dynamic_HTables.Dynamic_HTable.Put to update the number of key-value pairs in the hash table only when the put is adding a new pair, rather than updating the value of an existing pair. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-09-26 Hristian Kir

[Ada] Mimic the C++ ABI when passing class-wide conversion actuals

2018-09-26 Thread Pierre-Marie de Rodat
This patch does not affect the behavior of Ada-only code but improves consistency with the code generated by the C++ compiler. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-09-26 Javier Miranda gcc/ada/ * sem_res.adb (Resolve_Actuals): If the formal is a class-wide t

[Ada] Spurious error on private extension with predicate

2018-09-26 Thread Pierre-Marie de Rodat
This patch fixes a spurious error involving a private extension whose full view includes a dynamic predicate, when the parent type is itself private at the point of the predicate check. The conversion is known to be legal so no extra conversion checks are required. Tested on x86_64-pc-linux-gnu,

[Ada] Spurious dependency on secondary stack

2018-09-26 Thread Pierre-Marie de Rodat
This patch reimplements the handling of the secondary stack when the iteration scheme of a loop statement requires this support. Prior to this modification, an iterator loop over a container was assumed to require unconditional secondary stack management. This is however not always true because of

[Ada] Spurious error on interface conversion under ZFP

2018-09-26 Thread Pierre-Marie de Rodat
The frontend reports an error under ZFP when performing the type conversion of a tagged object to one of its covered interface types. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-09-26 Javier Miranda gcc/ada/ * exp_disp.adb (Expand_Interface_Conversion): No displacement of

[Ada] Do not issue by default info messages for inlining in GNATprove

2018-09-26 Thread Pierre-Marie de Rodat
Info messages about lack of inlining for analysis in GNATprove may be confusing to users. They are now only issued when GNATprove is called with switch --info, which it passes on to gnat2why with switch -gnatd_f. There is no effect on compilation. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] Spurious elaboration issue due to inlining

2018-09-26 Thread Pierre-Marie de Rodat
This patch ensures that the full compilation context is captured prior to package or subprogram instantiation/inlining and restored after the action takes place. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-09-26 Hristian Kirtchev gcc/ada/ * sem_ch12.adb (Instantiate_Packag

[Ada] Missing front-end code for constraint checks on fixed point exprs

2018-09-26 Thread Pierre-Marie de Rodat
This patch ensures that the front-end generates constraint checks for some operations that previously depended on gigi for the corresponding check. The patch also resets the Do_Range_Check flag so that it never appears in the tree presented to gigi. Tested on x86_64-pc-linux-gnu, committed on trun

[Ada] Issue info message on inlined subprograms in GNATprove mode

2018-09-26 Thread Pierre-Marie de Rodat
Issue a positive message that inlining was performed in GNATprove mode, when corresponding debug switch -gnatd_f is set. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-09-26 Yannick Moy gcc/ada/ * errout.ads: Update comment for insertion character '?'. * inline.adb: U

[Ada] Spurious ineffective use_clause warning

2018-09-26 Thread Pierre-Marie de Rodat
This patch fixes an issue whereby user-defined subprograms used as generic actuals with corresponding formals containing other formal types led to spurious ineffective use_clause warnings. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-09-26 Justin Squirek gcc/ada/ * sem_ch8.

[Ada] Fix inheritance of representation items defined as aspects

2018-09-26 Thread Pierre-Marie de Rodat
When a representation item is defined by a pragma or attribute definition clause, the entity it applies to is that of the Name of the representation item. But when it is defined by an aspect definition, the entity is directly denoted by the Entity attribute of the represenation item. The circuitry

[Ada] Spurious error message on visibiliy change in aspect expression

2018-10-09 Thread Pierre-Marie de Rodat
This patch removes an improper error message on a visibility change in an aspect expression between the freeze point and the end of the declaration list, when the expression involves a call to a instance of Unchecked_Conversion and the enclosing package declaration has a package body with multiple

[Ada] Internal error on inlined renaming of subprogram instance

2018-10-09 Thread Pierre-Marie de Rodat
This fixes a recent regression introduced in the compiler for the inlined renaming of a subprogram instantiated in a package body. It was wrongly clearing the Is_Public flag on the entity associated with the body. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-10-09 Eric Botcazou gcc

[Ada] Fix spurious error on derived record passed as Out parameter

2018-10-09 Thread Pierre-Marie de Rodat
This fixlet gets rid of a spurious error issued in the specific case of a call to a subprogram taking an Out parameter of a discriminated record type without default discriminants, if the actual parameter is the result of the conversion to the record type of a variable whose type is derived from th

[Ada] Fix strange warning when using Ada.Iterator_Interface

2018-10-09 Thread Pierre-Marie de Rodat
The back-end was recently changed to issue more -Wuninitialized warnings on Out parameters and this has caught a case related to Ada.Iterator_Interface.: This patchlet simply kills this uninteresting warning. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-10-09 Eric Botcazou gcc/ada/

[Ada] Ignore pragmas Compile_Time_Error/Warning in GNATprove mode

2018-10-09 Thread Pierre-Marie de Rodat
GNATprove does not have sometimes the precise information of the compiler about size of types and objects, so that it cannot evaluate the expressions in pragma Compile_Time_Error/Warning the same way the compiler does. Thus, these pragmas should be ignored in GNATprove mode, as it can neither veri

[Ada] Fix spurious -Wuninitialized warnings for small records

2018-10-09 Thread Pierre-Marie de Rodat
This change is aimed at getting rid of spurious -Wuninitialized warnings issued for small records passed by copy and containing default values for some of their components. The source of the problem is that the _Init parameter of the initialization routine is declared as an in/out parameter, so th

[Ada] Premature secondary stack reclamation

2018-05-21 Thread Pierre-Marie de Rodat
This patch modifies the creation of transient scopes to eliminate potential premature secondary stack reclamations when there is no suitable transient context and the scope was intended to manage the secondary stack. Instead, the logic was changed to accommodate a special case where an assignment w

[Ada] Propagate load addresses for traceback cache on Linux

2018-05-21 Thread Pierre-Marie de Rodat
Symbolization of traceback addresses through shared libraries requires information on the shared libraries load addresses, which was at hand on Linuxbut not propagated through the runtime when caching is enabled. This change fixes this. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-05-2

[Ada] Extend legality of Scalar_Storage_Order to formal types

2018-05-21 Thread Pierre-Marie de Rodat
This patch extends the legality of the GNAT attribute Scalar_Storage_Order, to apply to formal private types. Previously this extension applied only in GNAT_Mode, to support instantiations of Ada.Sequential_IO, but it is more generally useful. The following must compile quietly: with Memory_

[Ada] Robustify traceback symbolization from dwarf info

2018-05-21 Thread Pierre-Marie de Rodat
Symbolization of traceback entries from dwarf info is failing in multiple cases for addresses originating from shared libraries. Part of the problem is a confusion across different functions regarding the kind of "address" at hand, sometimes full process runtime addresses (e.g. in traceback entrie

[Ada] Tighten Object_Reader.Get_Memory_Bounds

2018-05-21 Thread Pierre-Marie de Rodat
Symbolization of traceback entries from dwarf info was failing in some cases with shared libraries on ELF targets, from unexpected overlapping of what we believed were code regions for distinct modules. This is caused by the inclusion of all SHF_ALLOC sections in the set of sections of possible re

[Ada] Spurious error on synchronous refinement

2018-05-21 Thread Pierre-Marie de Rodat
This patch ensures that an abstract state declared with simple option "synchronous" is automatically considered "external". Tested on x86_64-pc-linux-gnu, committed on trunk 2018-05-21 Hristian Kirtchev gcc/ada/ * einfo.adb (Is_External_State): An abstract state is also external

[Ada] Only allow Has_Discriminants on type entities

2018-05-21 Thread Pierre-Marie de Rodat
This patch enforces what the comment for Has_Discriminant says: --Has_Discriminants (Flag5) -- Defined in all types and subtypes. to avoid semantically undefined calls on non-type entities. It also adapts other routines to respect this comment. No user-visible impact. Tested on x86_64

[Ada] Crash on incorrect frontend inlining in GNATprove mode

2018-05-21 Thread Pierre-Marie de Rodat
In some cases, the inlining performed in GNATprove mode leads to a crash, when inlining a call where a return statement of the inlined function returns a string literal. Now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-05-21 Yannick Moy gcc/ada/ * sem_eval.adb (Stati

[Ada] Remove External aspect from predefined abstract states

2018-05-21 Thread Pierre-Marie de Rodat
Explicit External aspect was an equivalant to an implicit default. It was only needed as a workaround for a frontend bug. (If it meant to serve as documentation, there should be explicit Effective_Reads and Effective_Writes set to False too.) No test, because these changes are semantically neutra

<    13   14   15   16   17   18   19   20   21   22   >