[Ada] Implement basic support for -fdiagnostics-format=json

2021-06-18 Thread Pierre-Marie de Rodat
This commit implements basic support for the -fdiagnostics-format=json option that GCC has. When GNAT finds this argument in the command line, error messages such as: tmp.adb:4:12: "My_Var" is undefined Will be printed as: [ { "kind": "error", "locations": [ { "caret": {

[Ada] Do not clear Is_True_Constant flag on imported constants

2021-06-18 Thread Pierre-Marie de Rodat
The flag is first set on them as for any other constants but then cleared when the import pragma is processed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_prag.adb (Process_Import_Or_Interface): Do not artificially record a possible modification for a constan

[Ada] Relax null exclusion mismatch check in Relaxed_RM_Semantics mode

2021-06-18 Thread Pierre-Marie de Rodat
This is useful for e.g. CodePeer usage. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch6.adb (Null_Exclusions_Match): Relax null exclusion mismatch check when Relaxed_RM_Semantics is set.diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb --- a/gcc/ada/sem_

[Ada] Remove dead code for overlapping actuals in prefix notation

2021-06-18 Thread Pierre-Marie de Rodat
Detection of overlapping actuals doesn't need to be special-cased for prefix notation, because it is done after prefixed calls have been rewritten into ordinary calls, both in normal compilation and semantic checking mode (with switch -gnatc). Behaviour is unaffected; the removed code was dead. T

[Ada] New debug switch to disable large static aggregates

2021-06-18 Thread Pierre-Marie de Rodat
This patch adds the -gnatd_g switch, which lowers the threshold for computing static aggregates at compile time. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * debug.adb: Document switch. * exp_aggr.adb: If -gnatd_g was given, then do not bump the limit to 5

[Ada] Warn on 'in out' param containing access in private type

2021-06-18 Thread Pierre-Marie de Rodat
Normally the warnings: warning: formal parameter "..." is not modified warning: mode could be "in" instead of "in out" are disabled if the type contains components of an access type. A previous patch enabled such warnings if the only such components are in internal private types. This pa

[Ada] Fix asymmetries in detection of overlapping actuals

2021-06-18 Thread Pierre-Marie de Rodat
When detecting overlapping actuals we were only examining the type of the first formal parameter, so that errors and warnings were depending on the order of parameters. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_warn.adb (Warn_On_Overlapping_Actuals): Examine types

[Ada] Fix handling of gnat check/test commands

2021-06-18 Thread Pierre-Marie de Rodat
These days, gnat check should always call gnatcheck [--target=prefix], same for gnat test. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gnatcmd.adb: Fix handling of check and test commands.diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb --- a/gcc/ada/gnatcmd.adb ++

[Ada] Correct A'First (N) where N is an object name

2021-06-18 Thread Pierre-Marie de Rodat
This patch corrects a bug in A'First (N), where N is not a literal or named number -- the compiler would think N = 1, even when it is 2 or more. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_attr.adb (Check_Array_Or_Scalar_Type): Use Expr_Value instead of Intva

[Ada] Warn about overlapping actuals in all versions of Ada

2021-06-18 Thread Pierre-Marie de Rodat
Overlapping actuals of elementary types are illegal since Ada 2012; all other overlapping actuals are now reported as warnings regardless of the Ada version (because they are equally suspicious). We even had a comment: "Overlap is only illegal in Ada 2012 in the case of elementary types (pass

[Ada] Missing check for assigning too-large array to fixed-lower-bound object

2021-06-18 Thread Pierre-Marie de Rodat
The compiler was failing to perform a check on a conversion of an array that has a length that exceeds the range of the index subtype of the target subtype of the conversion when the target subtype is an unconstrained array subtype with a fixed lower bound (FLB). The FLB array subtype's index range

[Ada] Error issued on string literal assigned to fixed-lower-bound array

2021-06-18 Thread Pierre-Marie de Rodat
The compiler incorrectly flags a string literal used to initialize an array object with a nominal fixed-lower-bound array subtype (and in other fixed-lower-bound sliding contexts). String literals will already be given proper bounds when in such contexts based on the applicable constraint, so no sl

[Ada] Fix inaccuracies in signal handler trampoline for aarch64-vxworks

2021-06-18 Thread Pierre-Marie de Rodat
Fix a couple of inaccuracies in the VxWorks signal handler trampoline for aarch64: - REGNO_PC_OFFSET, used as the cfi return column number, is better sync'ed with the back-end's DWARF_ALT_FRAME_RETURN_COLUMN. - R18 is used by VxWorks for internal purposes so is best left out of the CFI notes

[Ada] Remove AAMP from compiler sources

2021-06-18 Thread Pierre-Marie de Rodat
AAMP is no longer supported. This patch removes AAMP-specific code. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * ada_get_targ.adb, aspects.ads, checks.adb, cstand.adb, einfo.ads, exp_attr.adb, freeze.adb, get_targ.adb, libgnat/a-textio.ads, libgnat/g-memdu

[Ada] Premature freezing of types

2021-06-18 Thread Pierre-Marie de Rodat
GNAT was freezing prematurely any type referenced in a subprogram profile as part of freezing, regardless of the scope involved, causing premature freezing of types and therefore preventing declaration of additional primitive operations. This is now almost fully fixed. There is one remaining catch

[Ada] Avoid passing Enum_Lit'Size to the back end

2021-06-18 Thread Pierre-Marie de Rodat
Constant fold Enum_Lit'Size so the back end won't see it. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_attr.adb (Eval_Attribute): For Enum_Lit'Size, use Enum_Type'Object_Size.diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb --- a/gcc/ada/sem_attr.adb +

[Ada] Make "gcc -gnatDGL" handle unterminated last lines properly

2021-06-18 Thread Pierre-Marie de Rodat
This patch fixes a bug in which "gcc -gnatDGL" raises an unhandled Constraint_Error in checks-on mode if the last line in the file is not terminated with a line terminator. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sprint.adb (Write_Source_Line): Check for EOF in

[Ada] Ada2020: AI12-0195 overriding class-wide pre/post conditions

2021-06-18 Thread Pierre-Marie de Rodat
This patch does not modify the functionality of the frontend; it ensures the correct decoration of wrappers of class-wide pre/post conditions required for AI12-0195. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * contracts.adb (Process_Spec_Postconditions): Add missing

[Ada] Fix detection of overlapping slices indexed by characters

2021-06-18 Thread Pierre-Marie de Rodat
Slices that denote the same objects can be indexed either by integer or character literals, but the latter was not detected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Denotes_Same_Object): Handle character literals just like integer literals.diff

[Ada] Additional error checking on index constraints with fixed-lower-bound ranges

2021-06-18 Thread Pierre-Marie de Rodat
Error checks are added to disallow index constraints given with a mixture of constrained and fixed-lower-bound ranges, and also to disallow an index constraint with a fixed-lower-bound index applied to a type or subtype with fixed-lower-bound indexes. Tested on x86_64-pc-linux-gnu, committed on tr

[Ada] Fix detection of overlapping actuals with renamings

2021-06-18 Thread Pierre-Marie de Rodat
Routine Denotes_Same_Object wrongly handled renamings of renamings. In a code like this: B : Integer renames A; C : Integer renames B; names "B" and "C" differ and their renamed object names "A" and "B" differ too. This patch rewrites this routine to literally follow the RM, which fixes the

[Ada] Compile s-mmap on aarch64-linux

2021-06-21 Thread Pierre-Marie de Rodat
The rules for building s-mmap were missing from aarch64-linux for no apparent reason. The macros for this package includes other packages that were also missing. There was no example where s-mmap was added by itself so the standard macros were added. Tested on x86_64-pc-linux-gnu, committed on tru

[Ada] Skip overlay checks on protected components with expansion disabled

2021-06-21 Thread Pierre-Marie de Rodat
Routine Find_Overlaid_Entity collects entire objects from prefixes of attribute Address is overlay specifications. The alignment of those entire objects are then examined in Validate_Address_Clauses. However, Find_Overlaid_Entity wrongly collects protected components (and discriminants of concurre

[Ada] Compiler crash on sliding of fixed-lower-bound object in Loop_Invariant

2021-06-21 Thread Pierre-Marie de Rodat
When a sliding conversion is expanded during preanalysis of certain assertion pragmas (such as Loop_Invariant), to convert an object of to an array subtype with a fixed lower bound, a Val attribute created as part of the upper bound expression of the conversion's subtype is not expanded later when

[Ada] Disable wrong computation of offsets within multidimensional arrays

2021-06-21 Thread Pierre-Marie de Rodat
Routine Indexed_Component_Bit_Offset is meant to return the first bit position of an array component, but it only examined the first index expression and necessarily produced wrong results for multidimensional arrays. Since this routine is only used for warnings, it is safe to simply disable this

[Ada] Simplify detection of statically overlapping slices

2021-06-21 Thread Pierre-Marie de Rodat
Statically matching slices in actual parameters are now detected in the Denotes_Same_Object routine by directly examining the slice indexes and by a dubious recursive call. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Denotes_Same_Object): Simplify handling

[Ada] Fix detection of overlapping actuals with renamings

2021-06-21 Thread Pierre-Marie de Rodat
Simplify detection of renamings within actuals that denote the same object. This code only needs to take object renamings and shouldn't care about renamings of subprogram, packages or exceptions. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Is_Object_Renamin

[Ada] Fix unbalanced parens in documentation of Address clauses

2021-06-21 Thread Pierre-Marie de Rodat
Typo in description of handling of Address clauses by GNAT; spotted while implementing support for overlays in GNATprove. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * doc/gnat_rm/representation_clauses_and_pragmas.rst (Address Clauses): Fix unbalanced parens.

[Ada] Fix invalid JSON real numbers generated with -gnatRj

2021-06-21 Thread Pierre-Marie de Rodat
The -gnatR output contains information about fixed-point types declared in the program and it comprises real numbers, which are displayed using a custom format specific to the compiler, which is not always compatible with the JSON data interchange format. The change also fixes an off-by-one bug in

[Ada] Zero-size slices

2021-06-21 Thread Pierre-Marie de Rodat
Fix a bug in slices, where a zero-sized slice causes an invalid read detected by valgrind Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-bituti.ads (Small_Size): Do not include 0 in this type. * libgnat/s-bituti.adb (Copy_Bitfield): Do nothing for

[Ada] Make -gnatU and -gnatw.d the default

2021-06-21 Thread Pierre-Marie de Rodat
-gnatU prepends `error:` to error messages, enabling it by default makes error messages more consistent with warnings. -gnatw.d tags messages with the flag that caused them. As users might need to switch back to the previous behavior, the `-gnatd_U` flag is introduced to do exactly that. Tested

[Ada] Implement 'Valid_Value attribute

2021-06-21 Thread Pierre-Marie de Rodat
Implement the 'Valid_Value attribute for enumeration types. Currently, 'Valid_Value is not supported for types in Standard, because they do not have image/value tables. Currently, there are no 'Valid_Wide_Image or 'Valid_Wide_Wide_Image attributes. Tested on x86_64-pc-linux-gnu, committed on trun

[Ada] Add Return_Statement field

2021-06-21 Thread Pierre-Marie de Rodat
Used by GNAT LLVM to handle E_Constant and E_Variable with Is_Return_Object. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * einfo.ads (Return_Statement): Add documentation. * exp_ch6.adb (Expand_N_Extended_Return_Statement): Set it. * gen_il-fields.ads: Add

[Ada] Adjust new fast bit-field copy path to big-endian platforms

2021-06-21 Thread Pierre-Marie de Rodat
The issue is that the unchecked conversion of small bit-packed arrays to modular types is not done in memory order, whereas this order is expected by the System.Bitfield_Utils unit. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch5.adb (Expand_Assign_Array_Bitfield_Fas

[Ada] Implementation of AI12-205: defaults for formal types

2021-06-21 Thread Pierre-Marie de Rodat
This patch implements the new language feature described in AI12-0205 that introduces defaults for generic formal types. These defaults are subtype marks that must denote a type that is usable as an actual in any subsequent instantiation of the enclosing generic unit. The legality rules are similar

[Ada] Improve efficiency of small slice assignments of packed arrays

2021-06-21 Thread Pierre-Marie de Rodat
If slices fit in 32 bits, and bounds are known at compile time, use a more efficient method for slice assignment. (32 is the usual case here, we're really talking about Val_Bits, which is 32 on most targets.) We might want to change 32 to 64 here. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] INOX: prototype "when" constructs

2021-06-21 Thread Pierre-Marie de Rodat
This patch implements experimental features under the -gnatX flag for "return ... when", "raise ... when", and "goto ... when" constructs. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Document new feature under pragm

[Ada] Optimization of System.Value_N

2021-06-21 Thread Pierre-Marie de Rodat
Add Inline and Pure_Function aspects. With these changes, and additional changes in gigi, we should be able to eliminate duplicate calls to Value_Enumeration_Pos. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-valuen.ads (Value_Enumeration, Valid_Enumerati

[Ada] Implement fixed-lower-bound consistency checks for qualified_expressions

2021-06-21 Thread Pierre-Marie de Rodat
This change implements a missing check for qualified_expressions where the qualifying subtype is an unconstrained array subtype that specifies fixed lower bounds for one or more of its index ranges. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * checks.adb (Selected_Range_C

[Ada] Add Ada.Strings.Text_Buffers and replace uses of Ada.Strings.Text_Output

2021-06-21 Thread Pierre-Marie de Rodat
GNAT's initial implementation of Ada 2022's Image attributes for non-scalar types referenced (in user-visible ways) a GNAT-defined package Ada.Strings.Text_Output and child units thereof. The Ada RM specifies that a similar-but-different package, Ada.Strings.Text_Buffers, is to be provided (RM A.4.

[Ada] Rewrite Validated_View in recursive style

2021-06-30 Thread Pierre-Marie de Rodat
Iteration with an artificial Continue flag in routine Validated_View was confusing. Also, most of the routines that traverse type hierarchies are written in recursive style. Cleanup only; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.ads

[Ada] Consistently use Validated_View for Valid_Scalars on records

2021-06-30 Thread Pierre-Marie de Rodat
Expansion of attribute Valid_Scalars was meant to use Get_Fullest_View for arrays and Validated_View for records. However, this was not done consistently and for records we were mixing Get_Fullest_View with Validated_View. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_

[Ada] Ignore again errors when running gen_il-main

2021-06-30 Thread Pierre-Marie de Rodat
This is needed to allow bootstrap with old compilers, due to finalization issues. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * Make-generated.in (ada/stamp-gen_il): Ignore errors from running gen_il-main.diff --git a/gcc/ada/Make-generated.in b/gcc/ada/Make-genera

[Ada] Fix bug in node/entity kind numbers in sinfo/einfo.h

2021-06-30 Thread Pierre-Marie de Rodat
This patch fixes a bug in the node/entity kinds that are generated by Gen_IL in sinfo/einfo.h. These numbers should be the same as the 'Pos of the corresponding enumeration literals in Node_Kind and Entity_Kind. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gen_il-gen.adb

[Ada] Factor out many fields in entities

2021-06-30 Thread Pierre-Marie de Rodat
Also minor reformatting nearby. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gen_il-gen-gen_entities.adb (Record_Field_Kind, Allocatable_Kind): Add new abstract kinds. (Constant_Or_Variable_Kind): Likewise. (E_Constant, E_Variable, E_Loop_Parameter

[Ada] Add some OS constants to control keepalive on TCP connections

2021-06-30 Thread Pierre-Marie de Rodat
This adds some OS constants that are needed to control the keepalive status of TCP connections. The new constants are TCP_KEEPCNT, TCP_KEEPIDLE and TCP_KEEPINTVL. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * s-oscons-tmplt.c: Add some OS constants.diff --git a/gcc/ada/s-o

[Ada] Accept arrays and scalars as type views that can be validated

2021-06-30 Thread Pierre-Marie de Rodat
Originally the expansion of attribute Validate_Scalars was only using Validated_View, but it was generating unnecessary unchecked conversions between array types that prevented validity checks from being optimized at compilation time. To prevent those conversions some of the calls to Validated_Vie

[Ada] More robust guard against cascaded errors with overlapping actuals

2021-06-30 Thread Pierre-Marie de Rodat
Code cleanup, both to improve efficiency (when no error has been posted for a subprogram call) and to avoid potential crashes (when an error has been posted and the subprogram call parameters are likely to be ill-formed as well). Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/

[Ada] Further adjustment and optimization of System.Value_N

2021-06-30 Thread Pierre-Marie de Rodat
This moves the declaration of Value_Enumeration_Pos to the body, renames Valid_Enumeration_Value into Valid_Value_Enumeration and eliminates the need for a range check on the return path of Value_Enumeration. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * rtsfind.ads (RE_Id

[Ada] Simplify detection of local types

2021-06-30 Thread Pierre-Marie de Rodat
Code cleanup related to fixing Valid_Scalars for private records. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch3.adb (Is_Local_Type): Simplify by reusing Scope_Within.diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_

[Ada] Reuse Is_Subprogram_Or_Entry where possible

2021-06-30 Thread Pierre-Marie de Rodat
Code cleanup; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * freeze.adb (Freeze_All): Simplify by reusing Is_Subprogram_Or_Entry. * sem_ch11.adb (Analyze_Handled_Statement): Likewise.diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.a

[Ada] Remove redundant check for empty list

2021-06-30 Thread Pierre-Marie de Rodat
Cleanup only; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch3.adb (Analyze_Declarations): Remove explicit check for missing, because a subsequent call to Is_Empty_List will detect them anyway.diff --git a/gcc/ada/sem_ch3.adb b

[Ada] Fix style in Get_Fullest_View

2021-06-30 Thread Pierre-Marie de Rodat
Code cleanup related to fixing Valid_Scalars for private records, which used to involve Get_Fullest_View. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.ads (Get_Fullest_View): Refill comment; remove extra extra after period. * sem_util.adb (Get_Ful

[Ada] tech debt: Parent (Empty) is not allowed

2021-06-30 Thread Pierre-Marie de Rodat
The documentation says that the Parent field is not defined for the Empty node, but many places were setting and getting the field. This patch changes the code to obey the documentation. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * atree.adb, atree.ads (Parent, Set_Parent

[Ada] Overriding errors on renamings and instances overriding predefined operators

2021-06-30 Thread Pierre-Marie de Rodat
The compiler improperly flags a renaming-as-body or a function instantiation declaring an operator that overrides a predefined operator, when the renaming or instantiation is declared with an overriding_indicator. In the renaming case, the Overridden_Operation field of the subprogram's entity is n

[Ada] vx7-shared-libs - x86_64-vx7r2 (gnat runtime)

2021-06-30 Thread Pierre-Marie de Rodat
A standalong ifeq is added for selecting vxworks7r2 targets which have shared gnatlib enabled. The powerpc64 ifeq is moved here and x86_64 is added to the filter list. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * Makefile.rtl: Add a new ifeq for vx7r2 shared gnatlib.diff

[Ada] Disable Pre/Post in formal containers

2021-06-30 Thread Pierre-Marie de Rodat
Pre and postconditions in the formal containers library are designed for formal verification. In general, we do not want to execute them. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-cfdlli.ads: Use pragma Assertion_Policy to disable pre and postconditio

[Ada] vx7-shared-libs: Unused variable __gnat_user_int_connect

2021-06-30 Thread Pierre-Marie de Rodat
Makefile.rtl (x86_64-vx7r2) adds a package i-vxinco.adb, which imports a variable that is not exported on rtp. This problem only shows up with a shared library runtime because it's never actually used, and gets optimized away in a static link. Tested on x86_64-pc-linux-gnu, committed on trunk gcc

[Ada] Remove a special case for forking-for-expect from ordinary spawn

2021-06-30 Thread Pierre-Marie de Rodat
The __gnat_in_child_after_fork flag was introduced for tracking memory within a child process created by __gnat_expect_fork. It is not needed for __gnat_portable_spawn, where fork is immediately followed by execv (and _exit should execv fail), because there can be no memory allocations between fork

[Ada] Ensure System.Tasking.Debug.Known_Tasks component access is atomic

2021-06-30 Thread Pierre-Marie de Rodat
Multiple threads can access the elements of System.Tasking.Debug.Known_Tasks concurrently. While the compiler will generally produce code that reads and writes Task_Ids atomically since Task_Id is word size, it is best to be explicit to prevent data race issues that may arise from non-atomic compon

[Ada] Small tweak in a couple of comments

2021-06-30 Thread Pierre-Marie de Rodat
This makes the comments use the same syntax as -gnatD/G for freeze nodes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch12.adb (Freeze_Subprogram_Body): Add missing "freeze". (Install_Body): Likewise.diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb --

[Ada] Remove an obsolete variant of Adjust_Name_Case used only by SPARK

2021-06-30 Thread Pierre-Marie de Rodat
GNATprove no longer calls an obsolete variant of Adjust_Name_Case that uses a global buffer. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * errout.ads (Adjust_Name_Case): Remove obsolete and now unused variant. * errout.adb (Adjust_Name_Case): Likewise; fix

[Ada] Do not catch 'N mod -1' in CodePeer_Mode

2021-06-30 Thread Pierre-Marie de Rodat
The special case used for catching the 'mod -1' operation is not useful to CodePeer, and in fact may be detrimental to its precision. Remove it in CodePeer_Mode. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch4.adb (Expand_N_Op_Mod): Remove special case for mod -1

[Ada] Crash on limited array object with address clause

2021-06-30 Thread Pierre-Marie de Rodat
Compiler aborts on an object declaration for a limited array type, when declaration includes an aggregate that must be built in place, and declaration carries an aspect specification for Address of object. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_aggr.adb (Convert

[Ada] Fix the -gnatyr switch so it works in record rep clauses

2021-06-30 Thread Pierre-Marie de Rodat
The -gnatyr switch is supposed to generate a style warning if the case of a usage name does not match that of the defining_identifier it denotes. The warning was missing for component names appearing in record representation clauses; this patch fixes that bug. Tested on x86_64-pc-linux-gnu, commit

[Ada] Make copies of entities being declared when copying block

2021-06-30 Thread Pierre-Marie de Rodat
When we make a copy of a tree containing a block, we need to make new entities for variables declared in the block. If not, the entity points to the wrong declaration, which is an invalid tree and can cause issues when we need static links and that variable is an uplevel reference. There may also

[Ada] Expose symmetry between Known_ and Unknown_ query routines

2021-06-30 Thread Pierre-Marie de Rodat
We have two families of routines to query entity properties: Known_XXX and Unknown_XXX. They now simply negate each other instead of negating their complex conditions. Code cleanup only related to handling of Alignment in GNATprove; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committe

Re: [PATCH, Ada] Makefile patches from initial RISC-V cross/native build.

2018-08-02 Thread Pierre-Marie de Rodat
described this change as a workaround for cross-machine path issues, I was wondering: do you still need this? If not, we should probably revert it right now, otherwise we should investigate why you needed it in the first place. What do you think? -- Pierre-Marie de Rodat

Re: [PATCH, Ada] Makefile patches from initial RISC-V cross/native build.

2018-08-03 Thread Pierre-Marie de Rodat
osses again. :-) -- Pierre-Marie de Rodat

[Ada] Dynamically resizable, load factor-based hash table

2018-08-21 Thread Pierre-Marie de Rodat
This patch introduces a dynamically resizable, load factor-based hash table in unit GNAT.Dynamic_HTables. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-08-21 Hristian Kirtchev gcc/ada/ * libgnat/g-dynhta.adb, libgnat/g-dynhta.ads: New package Dynamic_HTable. gcc/tes

[Ada] Handle pragmas that come from aspects for GNATprove

2018-08-21 Thread Pierre-Marie de Rodat
In GNATprove we appear to abuse a routine related to cross-references and expect it to deliver exact results, which is not what it was designed for. This patch is a temporary solution to avoid crashes in GNATprove; it doesn't affect the frontend or other backends, because this code is used exclusi

[Ada] General purpose doubly linked list for compiler and tool use

2018-08-21 Thread Pierre-Marie de Rodat
This patch adds unit GNAT.Lists which currently contains the implementation of a general purpose doubly linked list intended for use by the compiler and the tools around it. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-08-21 Hristian Kirtchev gcc/ada/ * impunit.adb: Add g-l

[Ada] Compiler abort on call to expr. function for default discriminant

2018-08-21 Thread Pierre-Marie de Rodat
If a discriminant specification has a default that is a call to an expression function, that function has to be frozen at the point of a call to the initialization procedure for an object of the record type, even though the call does not appear to come from source. Tested on x86_64-pc-linux-gnu, c

[Ada] Enumeration types with non-standard representation

2018-08-21 Thread Pierre-Marie de Rodat
The compiler may report errors on enumeration types with non-standard representation (i.e. at least one literal has a representation value different from its 'Pos value) processing attribute 'Enum_Rep. It may also generate wrong code for the evaluation of 'Enum_Rep raising Constraint_Error at runt

[Ada] Spurious "Duplicated symbol" error with discriminated tasks

2018-08-21 Thread Pierre-Marie de Rodat
This patch fixes a spurious error in a program that contains a discriminated task type and several of its subtype in the same declarative part, when the corresponding discriminant constraints are expressions. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-08-21 Ed Schonberg gcc/ada/

[Ada] Crash on entry in generic with dynamic elaboration checks

2018-08-21 Thread Pierre-Marie de Rodat
This patch modifies the set of attributes that applies to entries and entry families to include elaboration entities used by the access-before-elaboration mechanism. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-08-21 Hristian Kirtchev gcc/ada/ * einfo.adb (Elaboration_Entit

[Ada] Define versions of dimension system for Float and Long_Float

2018-08-21 Thread Pierre-Marie de Rodat
The dimension system in System.Dim.Mks is based on Long_Long_Float, which may not be convenient to people who want to use Float or Long_Float as basis. These new files provide units that define the dimension system based on Float in System.Dim.Float_Mks and on Long_Float in System.Dim.Long_Mks. Ch

[Ada] Fix internal error on extension of record with representation clause

2018-08-21 Thread Pierre-Marie de Rodat
This fixes a long-standing issue present for extensions of tagged record types with a representation clause: the clause is correctly inherited for components inherited in the extension but the position and size are not, which fools the logic of Is_Possibly_Unaligned_Object. This can result in an a

[Ada] Spurious crash on expression function as completion with contracts

2018-08-21 Thread Pierre-Marie de Rodat
This patch fixes a compiler abort on an expression function that is a completion of a subprogram with preconditions. The problem is caused by the presence of types in the precondition that are not frozen when the subprogram body constructed for the expression function receives the code that enforce

[Ada] Retention of with clauses for ignored Ghost units

2018-08-21 Thread Pierre-Marie de Rodat
This patch ensures that with clauses that mention ignored Ghost units are retained in the tree. The retention is necessary for several reasons: * The with clauses allow the new elaboration order mechanism to produce the same library edges regardless of whether the Ghost unit is checke

[Ada] Crash on expression function and tagged types

2018-08-21 Thread Pierre-Marie de Rodat
This patch fixes a compiler abort on an expression function whose expression includes tagged types that have not been frozen before the generated body of the function is analyzed, even though that body is inserted at the end of the current declarative part. Tested on x86_64-pc-linux-gnu, committed

[Ada] Add a new gnat tool vxlink

2018-08-21 Thread Pierre-Marie de Rodat
VxLink is a helper tool used as a wrapper around g++/gcc to build VxWorks DKM (Downloadable Kernel Modules). Such DKM is a partially linked object that includes entry points for constructors and destructors. This tool thus uses g++ to generate an intermediate partially linked object, retrieves th

[Ada] Improper copying of limited arrays with default initialization

2018-08-21 Thread Pierre-Marie de Rodat
This patch fixes an improper expansion of aggregates for limited array types in an object declaration. Prior to this patch, The presence of the aggregate (which can only consist of box initializations) would create a temporary that was then assigned to the object in the declaration. Apart from a vi

[Ada] Spurious ambiguity error on call returning an access type

2018-08-21 Thread Pierre-Marie de Rodat
If F is a function with a single defaulted parameter that returns an access_to_array type, then F (I) may designate either the return type or an indexing of the result of the call, after implicit dereferencing. If the component type C of the array type AR is accces AR this is ambiguous in a contex

[Ada] Spurious error on overriding protected function in instance

2018-08-21 Thread Pierre-Marie de Rodat
The conformance between an overriding protected operation with progenitors and the overridden interface operation requires subtype conformance; requiring equality of return types in the case of a function is too restrictive and leads to spurious errors when the return type is a generic actual. Tes

[Ada] Crash processing SPARK annotate aspect

2018-08-21 Thread Pierre-Marie de Rodat
The compiler blows up writing the ALI file of a package that has a ghost subprogram with an annotate contract. Tested on x86_64-pc-linux-gnu, committed on trunk 2018-08-21 Javier Miranda gcc/ada/ * lib-writ.adb (Write_Unit_Information): Handle pragmas removed by the expander.

Re: [PATCH 2/2] DWARF: make it possible to emit debug info for declarations only

2017-06-16 Thread Pierre-Marie de Rodat
On 05/31/2017 11:08 AM, Pierre-Marie de Rodat wrote: On 05/31/2017 09:34 AM, Richard Biener wrote: Actually for the bigger picture I'd refactor rest_of_decl_compilation, not calling it from the frontends but rely on finalize_decl/function. The missing part would then be calling the dwarf

Re: [PATCH] [PR79542][Ada] Fix ICE in dwarf2out.c with nested func. inlining

2017-06-16 Thread Pierre-Marie de Rodat
On 05/26/2017 04:12 PM, Pierre-Marie de Rodat wrote: I tried this, but I got a crash when compiling the Ada runtime (g-awk.adb). I could not extract a reproducer, but the idea is that because of the call to set_decl_origin_self, some DECLs have themselves as DECL_ABSTRACT_ORIGIN. As a result

Re: [PATCH 2/2] DWARF: make it possible to emit debug info for declarations only

2017-06-20 Thread Pierre-Marie de Rodat
cc1’s .debug_info: there is the expected evolution, too, I suspect Fortran wants to do sth similar as Ada for imported modules. Maybe. I have zero Fortran knowledge, so I’ll let a Fortran expert decide, if that is fine for you. :-) In any case, the back-end is ready for that. -- Pierre-Mar

Re: [PATCH 2/2] DWARF: make it possible to emit debug info for declarations only

2017-06-21 Thread Pierre-Marie de Rodat
On 06/21/2017 09:11 AM, Richard Biener wrote: Sure, no obligation for you to enhance Fortran debug! Understood, thanks. For your information, I just committed the change. Thank you again for reviewing! -- Pierre-Marie de Rodat

[Ada] Remove spurious warning on useless use-clauses in GNATprove

2017-11-08 Thread Pierre-Marie de Rodat
Inside GNATprove, inlining may cause use-clauses to be added in contexts where the entities are already visible. Do not emit warnings about unused use-clauses in these contexts, similar to what is done for instances of generics. There is no test as only GNATprove is impacted. Tested on x86_64-pc-

[Ada] Confusing warning on finalization actions during elaboration

2017-11-08 Thread Pierre-Marie de Rodat
This patch suppresses warnings concerning potential access-before-elaboration issues when the warnings originate from finalization actions performed within an initialization context. Such warnings seem confusing to users because they are not directly related to source code, but to byproducts of the

[Ada] Variable reads and writes

2017-11-08 Thread Pierre-Marie de Rodat
This patch reimplements the handling of variable references by the access- before-elaboration mechanism for the purpose of SPARK elaboration checks. Prior to the patch, variable references (N_Expanded_Name and N_Identifier) were detected and processed as is, however such references might be folded,

[Ada] Spurious error on overriding of privately inherited primitive

2017-11-08 Thread Pierre-Marie de Rodat
Compiler rejects an overriding indicator on a Finalize subprogram for a derived type D when the parent type P is a derivation of a private type whose full view is controlled, and the ultimate parent of P has a visible primitive Finalize. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/

[Ada] Improve the performance of the new ABE mechanism

2017-11-08 Thread Pierre-Marie de Rodat
This patch improves the performance of the new ABE mechanism by eliminating multiple traversals of the same subprogram body by memoizing all the nested scenarios found within. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-11-08 Hristian Kirtchev * einfo.adb: Elist36 is now us

[Ada] Deconstruct storing SPARK cross-references in the ALI files

2017-11-08 Thread Pierre-Marie de Rodat
GNATprove relied on frontend writing cross-references data into the ALI files to synthesize Global contracts. Now this is done by the GNATprove itself. This patch deconstructs the frontend code, that is no longer needed. No test, as only dead code removed. Tested on x86_64-pc-linux-gnu, committed

[Ada] Missing finalization during deallocation

2017-11-08 Thread Pierre-Marie de Rodat
This patch corrects the expansion of Unchecked_Deallocation calls to operate with the available view of the designated type. This ensures that if the type is visible through a limited with clause, the expansion properly detects the case where the designated type requires finalization actions.

[Ada] Remove dead check in collecting SPARK cross-references

2017-11-08 Thread Pierre-Marie de Rodat
GNATprove never collects cross-references to empty entities. Removed code most likely became dead at some point and this was not noticed. No test, as the removed code was only executed as part of GNATprove and its behaviour appears not affected. Tested on x86_64-pc-linux-gnu, committed on trunk 2

[Ada] Don't collect inessential data about SPARK cross-references

2017-11-08 Thread Pierre-Marie de Rodat
Part of deconstructing SPARK cross-references, which are used to synthesize Global contracts for code annotated with SPARK_Mode => Off. Data like line and column numbers was only needed to make the xrefs in the ALI file more readable. Now that the xrefs are not written to the ALI file at all, ther

[Ada] Store SPARK cross-references as Entity_Ids, not strings

2017-11-08 Thread Pierre-Marie de Rodat
GNATprove now picks frontend cross-references directly from memory and not from an ALI file), so there is no need to convert them to strings; it is cleaner and more efficient to store them as Entity_Ids. No test provided, because the behaviour is not affected. Tested on x86_64-pc-linux-gnu, commit

<    11   12   13   14   15   16   17   18   19   20   >