Re: [PATCH, Ada] RISC-V: Initial riscv linux Ada port.

2018-07-12 Thread Pierre-Marie de Rodat
possible to send the corresponding debug11.s and debug11.o? Hopefully we just have to enhance the regexps. -- Pierre-Marie de Rodat

Re: [PATCH, Ada] RISC-V: Initial riscv linux Ada port.

2018-07-12 Thread Pierre-Marie de Rodat
cases. Maybe for some reason we don’t create the correct debug type in the Ada front end… Do you think I can reproduce this with a x86_64-linux compiler targetting something like riscv-elf? I don’t have access to a RISC-V board on which to build GCC. -- Pierre-Marie de Rodat

[Ada] Adjust growth factor from 1/32 to 1/2 for Unbounded_String

2018-07-16 Thread Pierre-Marie de Rodat
This will reduce significantly the number of allocations done when doing consecutive append operations. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-16 Nicolas Roche gcc/ada/ * libgnat/a-strunb.adb, libgnat/a-strunb__shared.adb: Adjust growth factor from 1/32 to

[Ada] Illegal deferred constant causes stack overflow

2018-07-16 Thread Pierre-Marie de Rodat
This patch prevents the compiler from entering infinite recursion when processing an illegal deferred constant. -- Source -- -- types.ads package Types is type Enum is (One, Two); end Types; -- types2.ads with Types; package Types2 is type Enum is private;

[Ada] Violation of No_Standard_Allocators_After_Elaboration not detected

2018-07-16 Thread Pierre-Marie de Rodat
The compiler fails to generate a call to detect allocators executed after elaboration in cases where the allocator is associated with Global_Pool_Object. The fix is to test for this associated storage pool as part of the condition for generating a call to System.Elaboration_Allocators.Check_Standar

[Ada] Adjust inlining in GNATprove mode for predicate/invariant/DIC

2018-07-16 Thread Pierre-Marie de Rodat
The frontend generates special functions for checking subtype predicates, type invariants and Default_Initial_Condition aspect. These are translated as predicates in GNATprove, and as such should no call inside these functions should be inlined. This is similar to the existing handling of calls ins

[Ada] Bit_Order cannot be defined for record extensions

2018-07-16 Thread Pierre-Marie de Rodat
This patch allows the compiler to report an error on Bit_Order when defined for a record extension. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-16 Javier Miranda gcc/ada/ * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Report an error on Bit_Order when def

[Ada] Crash processing sources under GNATprove debug mode

2018-07-16 Thread Pierre-Marie de Rodat
Processing sources under -gnatd.F the frontend may crash on an iterator of the form 'for X of ...' over an array if the iterator is located in an inlined subprogram. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-16 Javier Miranda gcc/ada/ * exp_ch5.adb (Expand_Iterator_Lo

[Ada] Segmentation_Fault with Integer'Wide_Wide_Value

2018-07-16 Thread Pierre-Marie de Rodat
This patch updates the routines which produce Wide_String and Wide_Wide_String from a String to construct a result of the proper maximum size which is later sliced. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-16 Hristian Kirtchev gcc/ada/ * libgnat/s-wchwts.adb (Wide_St

[Ada] Code cleanup on functions inlining

2018-07-16 Thread Pierre-Marie de Rodat
This patch is preventive: it improves checks on inline functions that return unconstrained type. It does not change the functionality of the compiler. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-16 Javier Miranda gcc/ada/ * inline.adb (Build_Body_To_Inline): Minor code

[Ada] Spurious possible contraint error warning with No_Exception_Propagation

2018-07-16 Thread Pierre-Marie de Rodat
This patch corrects an issue whereby spurious unhandled exception warnings on integer literals within static if and case expressions would be emitted when the restriction No_Exception_Propagation is enabled. -- Source -- -- gnat.adc pragma Restrictions (No_Exception_Pr

[Ada] Crash on Indefinite_Hashed_Maps with -gnata -gnateV

2018-07-16 Thread Pierre-Marie de Rodat
This patch corrects the generation of helper functions which verify the validity of record type scalar discriminants and scalar components when switches -gnata (assertions enabled) and -gnateV (validity checks on subprogram parameters) are in effect. Tested on x86_64-pc-linux-gnu, committed on tru

[Ada] Deconstruct always-false calls to Withed_Body in Walk_Library_Items

2018-07-16 Thread Pierre-Marie de Rodat
We previously removed the calls to Set_Withed_Body; this commit deconstructs calls to Withed_Body, which always returned False. The Set_Withed_Body/Withed_Body were helping the Walk_Library_Items routine traverse the AST of several compilation units such that declarations are visited before refere

[Ada] Spurious error with null Abstract_State

2018-07-16 Thread Pierre-Marie de Rodat
This patch corrects the mechanism which ensures that a package with a null Abstract_State does not introduce hidden state, by ignoring internal states and variables because they do not represent the "source" hidden state. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-16 Hristian Kirt

[Ada] Avoid crash when traversing units with -gnatd.WW debug switch

2018-07-16 Thread Pierre-Marie de Rodat
The debug switch -gnatd.WW enables extra info when traversing library units with Walk_Library_Items, which is used in the CodePeer and GNATprove. This routine was crashing when trying to print info about a unit with configuration pragmas (typically an .adc file). Now fixed. No test, as the crash o

[Ada] Deconstruct unused Withed_Body filed of N_With_Clause node

2018-07-16 Thread Pierre-Marie de Rodat
The Withed_Body field was added to N_With_Clause node to help the Walk_Library_Items routine, which was created for the CodePeer backend and later adopted by the GNATprove. This routine is meant to traverse all library units, such that declarations are visited before references. However, for compl

[Ada] Missing error on hidden state in instantiation

2018-07-16 Thread Pierre-Marie de Rodat
This patch modifies the analysis of package contracts to split processing which is specific to package instantiations on its own. As a result, the lack of indicator Part_Of can now be properly assessed. -- Source -- -- gen_pack.ads generic package Gen_Pack is Pack_V

[Ada] Fix Next_Actual when used on calls "inlined for proof"

2018-07-17 Thread Pierre-Marie de Rodat
The GNATprove backend needs to apply antialiasing checks to subprogram calls that have been rewritten into null statements while "inlining for proof". This requires the First_Actual/Next_Actual to use the Original_Node and not the N_Null_Statement that rewriting leaves as a parent. Only effective

[Ada] Add elaboration-related switches to GNAT UGN

2018-07-17 Thread Pierre-Marie de Rodat
This patch adds compiler switches -gnatH and -gnatJ to section "Alphabetical list of all switches" of the GNAT User Guide for Native. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-17 Hristian Kirtchev gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Add

[Ada] Secondary stack leak in loop iterator

2018-07-17 Thread Pierre-Marie de Rodat
When the evaluation of the loop iterator invokes a function whose result relies on the secondary stack the compiler does not generate code to release the consumed memory as soon as the loop terminates. After this patch the following test works fine. with Text_IO; use Text_IO; pragma Warnings (Off

[Ada] Attach the special GNATprove HEAP entity to the Standard package

2018-07-17 Thread Pierre-Marie de Rodat
In GNATprove mode we use frontend cross-references to synthesize the Global contract of subprograms with SPARK_Mode => Off and represent a read/write via a pointer as a read/write of a special entity called HEAP. This entity is now attached to the Standard package, so that we can safely check the E

[Ada] Crash on case expression in build-in-place function

2018-07-17 Thread Pierre-Marie de Rodat
This patch modifies the recursive tree replication routine New_Copy_Tree to create new entities and remap old entities to the new ones for constructs in N_Expression_With_Actions nodes when requested by a caller. This in turn allows the build-in-place mechanism to avoid sharing entities between the

[Ada] New ignored Ghost code removal mechanism

2018-07-17 Thread Pierre-Marie de Rodat
This patch reimplements the mechanism which removes ignored Ghost code from the tree. The previous mechanism proved to be unreliable because it assumed that no new scoping constructs would be created after some ignored Ghost code had already notified its enclosing scoping constructs that they cont

[Ada] Spurious error on unused Part_Of constituent

2018-07-17 Thread Pierre-Marie de Rodat
This patch updates the analysis of indicator Part_Of (or the lack thereof), to ignore generic formal parameters for purposes of determining the visible state space because they are not visible outside the generic and related instances. -- Source -- -- gen_pack.ads gene

[Ada] Secondary stack leak in statements block located in a loop

2018-07-17 Thread Pierre-Marie de Rodat
When a loop iterator has a block declaration containing statements that invoke functions whose result is returned on the secondary stack (such as a string-returning function), the compiler fails to generate code to release the allocated memory when the loop terminates. After this patch the followi

[Ada] Spurious error on Part_Of indicator

2018-07-17 Thread Pierre-Marie de Rodat
This patch modifies the verification of a missing Part_Of indicator to avoid considering constants as visible state of a package instantiation because the compiler cannot determine whether their values depend on variable input. This diagnostic is left to GNATprove. -- Source -- --

[Ada] Avoid confusing warning on exception propagation in GNATprove mode

2018-07-17 Thread Pierre-Marie de Rodat
When compiling with the restriction No_Exception_Propagation, GNAT compiler may issue a warning about exceptions not being propagated. This warning is useless and confusing to users for GNATprove analysis, as GNATprove precisely detects possible exceptions, so disable the warning in that mode. Tes

[Ada] Crash processing abstract state aspect of a package

2018-07-17 Thread Pierre-Marie de Rodat
The compiler may crash processing an aspect Part_Of used in a package spec which has also an Initial_Condition aspect. After this patch the following test compiles fine. package P with SPARK_Mode => On, Abstract_State => (Count_State), Initial_Condition => (Get_Count = 0) -- Tes

[Ada] Missing check on illegal equality operation in subprogram

2018-07-17 Thread Pierre-Marie de Rodat
In Ada2012 it is illegal to declare an equality operation on an untagged type when the operation is primitive and the type is already frozem (see RM 4.5.2 (9.8)). previously the test to detect this illegality only examined declarations within a package. This patch covers the case where type and ope

[Ada] Argument_String_To_List creates empty items from whitespace

2018-07-17 Thread Pierre-Marie de Rodat
This patch corrects an issue whereby leading whitespace in a non-quoted argument list passed to Argument_String_To_List caused extraneous empty arguments to be returned. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-17 Justin Squirek gcc/ada/ * libgnat/s-os_lib.adb (Argum

[Ada] Minor fix for imported C++ constructors

2018-07-17 Thread Pierre-Marie de Rodat
C++ constructors are imported as functions and then internally rewritten into procedures taking the "this" pointer as first parameter. Now this parameter is not of an access type but of the type directly, so it must be In/Out and not just In. Tested on x86_64-pc-linux-gnu, committed on trunk 201

[Ada] Assertion_Policy for class-wide precondition

2018-07-17 Thread Pierre-Marie de Rodat
This patch fixes the compiler to that class-wide preconditions on primitive operations of interfaces are not checked at run time when the Assertion_Policy indicates that they should be ignored. This is required by the RM. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-17 Bob Duff g

[Ada] Configuration state not observed for instance bodies

2018-07-17 Thread Pierre-Marie de Rodat
This patch ensures that the processing of instantiated and inlined bodies uses the proper configuration context available at the point of the instantiation or inlining. Previously configuration pragmas which appear prior to the context items of a unit would lose their effect when a body is instant

[Ada] Use standard version of s-memory.adb for mingw32

2018-07-17 Thread Pierre-Marie de Rodat
This patch switches mingw32 targets to use the standard version of s-memory.adb as Windows now has the capability of limiting the amount of memory used by process. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-17 Patrick Bernardi gcc/ada/ * libgnat/s-memory__mingw.adb: Re

[Ada] Faulty ignored Ghost code removal

2018-07-17 Thread Pierre-Marie de Rodat
This patch ensures that removal of ignored Ghost code is the absolute last operation performed on the tree. Previously the removal was performed prior to issuing delayed warnings, however the warning mechanism may see a heavily modified tree and fail. No small reproducer available. Tested on x86_

[Ada] Fix incompatibility Default_Scalar_Storage_Order/tagged types

2018-07-17 Thread Pierre-Marie de Rodat
The pragma Default_Scalar_Storage_Order cannot reliably be used to set the non-default scalar storage order for a program that declares tagged types, if it also declares user-defined primitives. This is fixed by making Make_Tags use the same base array type as Make_DT and Make_Secondary_DT when ac

[Ada] Spurious error on prefixed call in an instantiation

2018-07-17 Thread Pierre-Marie de Rodat
This patch fixes a spurious error on a prefixed call in an instance, when the generic parameters include an interface type and an abstract operation of that type, and the actuals in the instance include an interface type and a corresponding abstract operation of it, with a different name than the c

[Ada] Spurious error -- "allocation from empty storage pool"

2018-07-31 Thread Pierre-Marie de Rodat
This patch fixes a bug in which if "pragma Default_Storage_Pool (null);" is given, then a build-in-place function will get an incorrect error message "allocation from empty storage pool" even though there is no such allocation in the source program. Tested on x86_64-pc-linux-gnu, committed on trun

[Ada] Deconstruct 'F' as a prefix for an ALI data

2018-07-31 Thread Pierre-Marie de Rodat
In GNATprove we used to store a variant of cross-reference information in the ALI file in lines that started with an 'F' letter. This is no longer the case, so the letter can be returned to the pool of unused prefixes. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-31 Piotr Trojanek

[Ada] Spurious warning on iteration over range of 64-bit modular type

2018-07-31 Thread Pierre-Marie de Rodat
This patch suppresses a spurious warning on the use of a 64-bit modular type in a quantified expression, where the range of iteration will include a bound that appears larger than the run-time representation of Universal_Integer'last. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-31

[Ada] Replace low-level calls to Ekind with high-level calls to Is_Formal

2018-07-31 Thread Pierre-Marie de Rodat
High-level wrappers are easier to read. This change came up while reading some code related to GNATprove, but then uniformly applied to the entire frontend. For the few remaining membership tests that could be replaced by Is_Formal it is not obvious whether the high-level routine makes the code bet

[Ada] Compiler failure on an extended_return_statement in a block

2018-07-31 Thread Pierre-Marie de Rodat
When compiling with an assertion-enabled compiler, Assert_Failure can be raised when expanded an extended_return_statement whose enclosing scope is not a function (such as when it's a block_statement). The simple fix is to change the Assert to test Current_Subprogram rather than Current_Scope. Thre

[Ada] Spurious error on the placement of aspect Global

2018-07-31 Thread Pierre-Marie de Rodat
This patch modifies the expansion of stand-alone subprogram bodies that appear in the body of a protected type to properly associate aspects and pragmas to the newly created spec for the subprogram body. As a result, the annotations are properly associated with the initial declaration of the subpro

[Ada] Wrong value after assignment of overlain record objects

2018-07-31 Thread Pierre-Marie de Rodat
This patch corrects an issue whereby objects of a record type with a representation clause which are overlain by address would fail to get assigned values properly when one or both of said objects were marked volatile. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-31 Justin Squirek

[Ada] Fix alignment of mutex_t and cond_t type on 32-bit SPARC/Solaris

2018-07-31 Thread Pierre-Marie de Rodat
The alignment of the couple of types from System.OS_Interface was wrongly set to 4 (32-bit) instead of 8 (64-bit) in 32-bit mode. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-31 Eric Botcazou gcc/ada/ * libgnarl/s-osinte__solaris.ads (upad64_t): New private type.

[Ada] Spurious error on default parameter in protected operation

2018-07-31 Thread Pierre-Marie de Rodat
This patch fixes a spurious compiler error on a call to a protected operation whose profile includes a defaulted in-parameter that is a call to another protected function of the same object. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-07-31 Ed Schonberg gcc/ada/ * exp_ch6.

[Ada] GNATmake fails to detect missing body

2018-07-31 Thread Pierre-Marie de Rodat
This patch corrects an issue whereby building a multi-unit compilation with missing sources resulted in a cryptic "code generation" error instead of the appropriate file not found error. -- Source -- -- main.adb with Types; procedure Main is begin null; end; -- ty

[Ada] Secondary stack leak with access-to-subprogram

2018-07-31 Thread Pierre-Marie de Rodat
This patch modifies call resolution to recognize when the designated type of an access-to-subprogram requires secondary stack management, and establish the proper transient block. -- Source -- -- leak7.adb procedure Leak7 is Max_Iterations : constant := 10_000;

[Ada] Remove inappropriate test from Is_By_Reference_Type

2021-09-20 Thread Pierre-Marie de Rodat
The result returned by the predicate may change depending on whether an error was posted on the type, which complicates further error reporting. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_aux.adb (Is_By_Reference_Type): Do not test Error_Posted.diff --git a/gcc/ada/

[Ada] usage.adb: make -gnatw.c description clearer

2021-09-20 Thread Pierre-Marie de Rodat
The term "unrepped" can be hard to understand for users. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * usage.adb (Usage): Update -gnatw.c messages.diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -483,8 +483,10 @@ begin

[Ada] Move Build_And_Insert_Cuda_Initialization to Expand_CUDA_Package

2021-09-20 Thread Pierre-Marie de Rodat
This commit makes Build_And_Insert_Cuda_Initialization an internal procedure and creates a new Expand_CUDA_Package procedure which calls Build_And_Insert_Cuda_Initialization. This is a small, self-contained refactoring that does not impact any feature or fix any bug - it just makes future commits

[Ada] Only assign type to op if compatible

2021-09-20 Thread Pierre-Marie de Rodat
Before this commit, the following program would make the compiler crash: procedure Main is ConstantString1 : aliased String := "Class1"; My_Access : access String := ConstantString1'Access; begin if "Class1" = My_Access then null; end if; end Main; This was because when an acces

[Ada] Refactor scan_backend_switch to share logic across backends

2021-09-20 Thread Pierre-Marie de Rodat
This commit refactors scan_backend_switch to share logic across adabkend.adb and back_end.adb. A side effect of this refactor is that `-fdump-diagnostics-format` is now available with other backends. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * adabkend.adb (Scan_Back_End

[Ada] Spurious accessibility error on allocator in generic instance

2021-09-20 Thread Pierre-Marie de Rodat
This patch fixes an error in the compiler whereby an allocator for a limited type within a generic instance may cause spurious compile-time warnings and run-time errors. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch4.adb (Expand_N_Type_Conversion): Add guard to prot

[Ada] Fix assertion in GNATprove_Mode

2021-09-20 Thread Pierre-Marie de Rodat
Avoid calling List_Rep_Info in Generate_SCIL and GNATprove_Mode, because the representation info is not there. Otherwise, we fail an assertion. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gnat1drv.adb (Gnat1drv): Avoid calling List_Rep_Info in Generate_SCIL and G

[Ada] Don't examine all discriminants when looking for the first one

2021-09-20 Thread Pierre-Marie de Rodat
A minor performance improvement; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch3.adb (Build_Discriminant_Constraints): Exit once a first discriminant is found and the Discrim_Present flag is set.diff --git a/gcc/ada/sem_ch3.adb b/gcc/

[Ada] Work around CodePeer bug by declaring variable

2021-09-20 Thread Pierre-Marie de Rodat
This commit works around a CodePeer bug where CodePeer thinks Get_32_Bit_Val returns something uninitialized. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * atree.adb (Get_32_Bit_Field): Declare result before returning.diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb ---

[Ada] Small cleanup in System.Dwarf_Line

2021-09-20 Thread Pierre-Marie de Rodat
The unit has got "with" and "use" clauses both for Ada.Exceptions.Traceback and System.Traceback_Entries, but the former is essentially a forwarder for the latter so can be eliminated. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-dwalin.ads: Remove clause for Ad

[Ada] Implementation of Preelaborable_Initialization attribute for AI12-0409

2021-09-20 Thread Pierre-Marie de Rodat
This set of changes implements the Preelaborable_Initialization attribute, corresponding to the existing aspect/pragma, as defined by AI12-0409 (RM2022 10.2.1(11.6/5-11.8/5). This includes semantic checking of restrictions on the prefix, and support for the aspect expression being given by an expre

[Ada] Refine types of local constants that store Etype results

2021-09-20 Thread Pierre-Marie de Rodat
Calls to Etype return entities, even though the signature of the Etype routine says it returns nodes. Fixed automatically with: $ sed -i 's/ Node_Id := Etype/ Entity_Id := Etype/' *.adb Found while reviewing changes in GNATprove related to aliasing checks. Tested on x86_64-pc-linux-gnu, commit

[Ada] Spurious link error with child unit and different Assertion modes.

2021-09-20 Thread Pierre-Marie de Rodat
This patch fixes a spurious link error on a compilation that involves a child unit that must be compiled with assertions enabled, and a parent that is compiled without. The error occurs when the parent includes instantiations that involve constructs such as predicates or pre/ postconditions, and ob

[Ada] Fix condition in op interpretation resolution

2021-09-20 Thread Pierre-Marie de Rodat
A previous patch fixed crashes on comparisons of string literals with access to strings by making sure that resolution of operations was only performed when operand types are actually compatible. However, the check was incomplete. Indeed, using only Has_Compatible_Type does not cover the case wher

[Ada] Fix repeated generation of dispatch tables in CodePeer mode

2021-09-20 Thread Pierre-Marie de Rodat
Routine Make_DT that generates dispatch tables for tagged types might be called twice: when the tagged type is frozen (if it requires freezing) and once the enclosing package is fully analyzed. The Has_Dispatch_Table flag on a type prevents dispatch tables being generated twice. However, this flag

[Ada] SPARK proof of the Ada.Strings.Fixed library

2021-09-20 Thread Pierre-Marie de Rodat
Introduced pragmas to prove with SPARK the behaviours of most of the functions and procedures from Ada.Strings.Fixed. Procedure Move and all procedures that rely on it (Insert, Delete, Overwrite, Replace_Slice) have incomplete contracts and can have runtime errors. Function Count is given without a

[Ada] Adjust latest change for ELF platforms

2021-09-20 Thread Pierre-Marie de Rodat
Shared libraries effectively have a "static" load address of zero in ELF. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-objrea.adb (Get_Load_Address): Return 0 for ELF.diff --git a/gcc/ada/libgnat/s-objrea.adb b/gcc/ada/libgnat/s-objrea.adb --- a/gcc/ada/libgnat/

[Ada] Add support for PE-COFF PIE to System.Dwarf_Line

2021-09-20 Thread Pierre-Marie de Rodat
This makes it possible for System.Dwarf_Line to handle Position-Independent Executables on Windows systems by translating the run-time addresses it is provided with into addresses in the executable. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * adaint.c (__gnat_get_executa

[Ada] Cleanups related to building of dispatch tables

2021-09-20 Thread Pierre-Marie de Rodat
Code cleanup only; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch7.adb (Expand_N_Package_Declaration): Fix wording in comment. * exp_disp.adb (Mark_DT): Remove unnecessary initialization of I_Depth.diff --git a/gcc/ada

[Ada] Use OS_Time for interface to TZ functions.

2021-09-20 Thread Pierre-Marie de Rodat
A recent regression caused by the parameterization of time_t was due to the unusual declaration used for time_t in the interface to TZ functions in sysdep.c. The root cause was the Long_Integer size of 32 bits used on x86_64-windows. The incident was temporarily fixed by reverting the declaration t

[Ada] Accept volatile expressions as non-scalar actual parameters

2021-09-20 Thread Pierre-Marie de Rodat
This change removes an old, incomplete and duplicated code that implemented the very first wording of a SPARK RM rule related to volatile expressions acting as actual parameters. Current the rule says: "[a name denoting] an effectively volatile object for reading [can be] an actual parameter in a

[Ada] Accept volatile properties on constant objects

2021-09-20 Thread Pierre-Marie de Rodat
Aspects Volatile and its related properties, i.e. Async_Readers, Async_Writers, Effective_Reads, Effective_Writes and No_Caching, are now allowed on stand-alone constant objects in SPARK. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * contracts.adb (Add_Contract_Item): Acce

[Ada] Clean up Uint fields, remove unused routines

2021-09-20 Thread Pierre-Marie de Rodat
Remove unused routines. Remove 2-parameter versions of Init_Alignment and friends. Replace calls with direct calls to Set_Alignment and friends. These routines aren't really doing anything worth an extra abstraction. Change remaining Init_ routines to Reinit_, because these are not usually bein

[Ada] Remove redundant checks for non-empty list of aspects

2021-09-20 Thread Pierre-Marie de Rodat
Cleanup related to inlining-for-proof and detection of overlaying actual parameters in GNATprove; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * inline.adb (Has_Excluded_Declaration): Remove redundant guard; the guarded code will call First

[Ada] Fix shadowing in conditions for inlining

2021-09-20 Thread Pierre-Marie de Rodat
Cleanup related to inlining-for-proof and detection of overlaying actual parameters in GNATprove; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * inline.adb (Has_Excluded_Declaration): Rename and reduce scope of a local variable.diff --git a/

[Ada] Present and No functions for type Uint

2021-09-20 Thread Pierre-Marie de Rodat
Declare Present and No functions for type Uint, analogous to other types such as Node_Id, and use them as appropriate. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * uintp.ads, uintp.adb (Present, No): New functions for comparing with No_Uint. * checks.adb,

[Ada] Remove "with GNAT.OS_Lib;" from libgnat/a-stbufi.ads

2021-09-21 Thread Pierre-Marie de Rodat
...and replace with System.OS_Lib, because we don't want things under Ada to depend on GNAT. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-stbufi.ads, libgnat/a-stbufi.adb: Change all occurrences of GNAT.OS_Lib to System.OS_Lib.diff --git a/gcc/ada/libgna

[Ada] Refine patch for spurious link error involving discriminated types

2021-09-21 Thread Pierre-Marie de Rodat
This patch handles properly the case of a Component_Definition appearing in a Component_Declaration. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch3.adb (Process_Discriminant_Expressions): If the constraint is for a Component_Definition that appears in a

[Ada] Exception raised on empty file in GNATprove mode

2021-09-21 Thread Pierre-Marie de Rodat
Adapt computation of indexes in buffer for outputting error messages to avoid an index out-of-bound exception on an empty file in GNATprove mode. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * errout.adb (Get_Line_End): Do not allow the result to go past the end of

[Ada] Update comment for Error_Msg_Internal

2021-09-21 Thread Pierre-Marie de Rodat
When Error_Msg_Internal parameters Sptr and Optr were renamed to Span and Opan, its comment has not been updated. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * errout.adb (Error_Msg_Internal): Fix references to Sptr and Optr in comment; fix grammar of "low-level" w

[Ada] Refactor sort procedures of doubly linked list containers

2021-09-21 Thread Pierre-Marie de Rodat
In earlier work, a performance problem was addressed by rewriting Ada.Containers.Doubly_Linked_Lists.Generic_Sorting in a-cdlili.adb. It turned out that the very-slow-in-some-cases Sort algorithm formerly used there was duplicated in 4 other units: the Bounded, Formal, Indefinite, and Restricted v

[Ada] Enforce legality rule for Predicate_Failure aspect specifications

2021-09-21 Thread Pierre-Marie de Rodat
If a Predicate_Failure aspect is specified for a type or subtype, Ada requires that either the Static_Predicate aspect or the Dynamic_Predicate aspect must also be specified for that same type or subtype. [The GNAT-defined Predicate aspect can also be used to meet this requirement.] The point is th

[Ada] Clean up uses of Esize and RM_Size

2021-09-21 Thread Pierre-Marie de Rodat
This patch updates calls to Esize and RM_Size so they will work with the new representation of "unknown" (i.e. "not yet set"). The old representation is "Uint_0". The new one will be "initial zero bits". The new representation is not yet installed; we are still using Uint_0. A future change wil

[Ada] Interface behaves differently from abstract tagged null

2021-09-21 Thread Pierre-Marie de Rodat
When the result expression of a simple-return-statement is a type conversion, and the tag of the expression differs from the tag of the specific nonlimited return type, the frontend silently skips ensuring that the tag of the returned object is that of the result type. Tested on x86_64-pc-linux-gn

[Ada] Presence of abstract operator function causes resolution problems

2021-09-21 Thread Pierre-Marie de Rodat
The declaration of an abstract function with an operator designator can result in removing a nonhomographic user-defined operator as a possible interpretation in an overloaded expression, leading to an error about mismatched types. The condition for marking an interpretation as being a predefined

[Ada] Fix ignored dynamic predicates specified through "predicate" aspect

2021-09-21 Thread Pierre-Marie de Rodat
Before this patch, GNAT would ignore dynamic predicates specified through the "predicate" pragma when attempting to evaluate expressions. This would result in incorrect behavior in cases like the following: subtype SS is String (1 .. 4) with Predicate => SS (2) = 'e'; pragma Assert ("" i

[Ada] rtems: add 128bit support for aarch64

2021-09-21 Thread Pierre-Marie de Rodat
Add 128BITS integer support for aarch64-rtems6. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * Makefile.rtl (aarch64-rtems*): Add GNATRTL_128BIT_PAIRS to the LIBGNAT_TARGET_PAIRS list and also GNATRTL_128BIT_OBJS to the EXTRA_GNATRTL_NONTASKING_OBJS list.dif

[Ada] exp_pakd.adb: work around spurious Codepeer warnings

2021-09-21 Thread Pierre-Marie de Rodat
Codepeer erroneously emits a warning for this if expression. Replacing it with a statement is enough to make the problem disappear. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_pakd.adb (Expand_Packed_Not): Replace expression with statement.diff --git a/gcc/ad

[Ada] Follow-up tweaks to System.Dwarf_Line

2021-09-21 Thread Pierre-Marie de Rodat
This fixes a couple of thinkos in the previous change. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-dwalin.adb (Skip_Form): Fix cases of DW_FORM_addrx and DW_FORM_implicit_const. Replace Constraint_Error with Dwarf_Error.diff --git a/gcc/ada/lib

[Ada] Small optimization to DWARF 5 mode in System.Dwarf_Line

2021-09-21 Thread Pierre-Marie de Rodat
There is no need to fetch every string from the .debug_line_str section. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-dwalin.adb (To_File_Name): Fetch only the last string from the .debug_line_str section. (Symbolic_Address.Set_Result): Likewise.

[Ada] Add assertions to Uintp

2021-09-21 Thread Pierre-Marie de Rodat
Add appropriate assertions to the operations in Uintp. Most operations disallow No_Uint. Division disallows Uint_0 on the right, and so on. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * uintp.ads, uintp.adb: Add assertions. (Ubool, Opt_Ubool): New "boolean" subtyp

[Ada] Remove if_expression

2021-09-21 Thread Pierre-Marie de Rodat
Replace an if_expression with an if_statement, because codepeer is tripping over the if_expression. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_eval.adb (Fold_Shift): Replace an if_expression with an if_statement.diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/se

[Ada] Add assertions to Uintp (UI_Is_In_Int_Range)

2021-09-21 Thread Pierre-Marie de Rodat
This completes the previous change that added assertions to Uintp. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * uintp.ads, uintp.adb (UI_Is_In_Int_Range): Change the type of the formal parameter to Valid_Uint. Remove code that preserved the previous behavi

[Ada] Cleanup old VxWorks in Makefile.rtl

2021-09-21 Thread Pierre-Marie de Rodat
The sections titled "PowerPC and e500v2 VxWorks 653" and "VxWorksae / VxWorks 653 for x86 (vxsim)" in Makefile.rtl are removed since they are no longer used. Also remove the relevant packages. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * Makefile.rtl: Remove unused VxWork

[Ada] Crash on build of Initialization procedure for derived container

2021-09-21 Thread Pierre-Marie de Rodat
This patch fixes a compiler abort on the construction of the initialization procedure for a private type completed by a derived container type whose element type is another container with controlled components with trivial initializations, Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada

[Ada] Set related expression for external DISCR symbols in Build_Temporary

2021-09-21 Thread Pierre-Marie de Rodat
This is required for CodePeer to use a better name for a variable, or a constant created by GNAT. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_util.adb (Build_Temporary): In case of an external DISCR symbol, set the related expression for CodePeer so that a mo

[Ada] Fix regression in ACATS bdd2006 and bdd2007

2021-09-21 Thread Pierre-Marie de Rodat
This fix is not strictly necessary to pass these ACATS tests, but this improves the error message, and avoids updating expected outputs. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch13.adb (Stream_Size): Print message about allowed stream sizes even if other

[Ada] bindgen: support additional features on targets suppressing the standard lib

2021-09-21 Thread Pierre-Marie de Rodat
For targets that suppress the standard library, the binder can now set the default stack size and enable stack checking when GCC stack limit are used. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * bindgen.adb (Gen_Adainit): For targets that suppress the standard li

[Ada] Add "optional" node subtypes that allow Empty

2021-09-21 Thread Pierre-Marie de Rodat
This patch adds new Opt_... subtypes to Sinfo.Nodes and Einfo.Entities. The predicates say "Opt_N_Declaration = Empty" rather than "No (Opt_N_Declaration)" because No is not visible. It can't be made visible with "with Atree;", because that would introduce cycles. It could be made visible by moving

[Ada] SCOs: generate 'P' decisions for [Type_]Invariant pragmas

2021-09-21 Thread Pierre-Marie de Rodat
Those pragmas should be dealt with in the same way as their equivalent aspects. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * par_sco.adb (Traverse_One): Add support for pragma Invariant / Type_Invariant.diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb --- a/

[Ada] Spurious dynamic accessibility check on allocator

2021-09-21 Thread Pierre-Marie de Rodat
This patch corrects an issue in the compiler whereby an anonymous access class-wide type allocator with default initialization has spuriously generated dynamic accessibility checks associated with the construct - leading to spurious runtime accessibility failures. Additionally, this patch corrects

[Ada] Rename "optional" node subtypes that allow Empty

2021-09-21 Thread Pierre-Marie de Rodat
This patch renames the new Opt_... subtypes in Sinfo.Nodes and Einfo.Entities to end with the suffix "_Id" for homogeneity with other subtypes of Node_Id and Entity_Id. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gen_il-gen.adb (Put_Opt_Subtype): Add suffix.diff --git a/

  1   2   3   4   5   6   7   8   9   10   >