[PATCH, PING] DWARF: materialize subprogram renamings in Ada as imported declarations

2015-08-03 Thread Pierre-Marie de Rodat
On 07/25/2015 09:44 PM, Pierre-Marie de Rodat wrote: This change makes GCC materialize subprogram renamings in Ada as imported declarations (DW_TAG_imported_declarations). For instance, procedure Foo renames Bar; will output: DW_TAG_imported_declaration: DW_AT_name: foo

[PATCH, PING*2] PR debug/53927: fix value for DW_AT_static_link

2015-08-03 Thread Pierre-Marie de Rodat
On 07/20/2015 09:39 AM, Pierre-Marie de Rodat wrote: This patch fixes the static link description in DWARF to comply with the specification. In order to do so, it appends a field to all FRAME objects to hold the frame base address (DW_AT_frame_base) so that the nested subrograms can directly

[PATCH, PING*2] Track indirect calls for call site information in debug info.

2015-08-03 Thread Pierre-Marie de Rodat
On 07/20/2015 02:45 PM, Pierre-Marie de Rodat wrote: On PowerPC targets with -mlongcall, most subprogram calls are turned into indirect calls: the call target is read from a register even though it is compile-time known. This makes it difficult for machine code static analysis engines to recover

[PATCH v2] PR rtl-optimization/66790: uninitialized registers handling in REE

2015-10-13 Thread Pierre-Marie de Rodat
ompute): Clear GEN bits for DF_REF_MUST_CLOBBER references. -- Pierre-Marie de Rodat >From d7bf6e8c194f66e6b7e1823ad3d118115e4406bc Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Sat, 18 Jul 2015 13:10:45 +0200 Subject: [PATCH 1/2] REE: fix uninitialized registers handling gcc/

Re: [PATCH v2] PR rtl-optimization/66790: uninitialized registers handling in REE

2015-10-19 Thread Pierre-Marie de Rodat
* df-problems.c (df_live_bb_local_compute): Clear GEN bits for DF_REF_MUST_CLOBBER references. This one is probably ok too; I still want to experiment with it a little. Sure, I only committed the attached updated first patch. -- Pierre-Marie de Rodat >From 0275c4a20a4b9daaefbbddd5306e9214e7d5d673 Mon Se

Re: GCC 6 Status Report (2015-10-16)

2015-10-20 Thread Pierre-Marie de Rodat
https://gcc.gnu.org/ml/gcc-patches/2015-08/msg01854.html). The corresponding support in GDB is in the development branch. If there is anything I should do to ease the review process, please let me know. :-) Thank you in advance! -- Pierre-Marie de Rodat

Re: [PATCH v2] PR rtl-optimization/66790: uninitialized registers handling in REE

2015-10-20 Thread Pierre-Marie de Rodat
questions in comment #27 but there was no followup on this point afterwards and Bernd approved the change so I thought it was fine: what should I do? Thanks in advance, -- Pierre-Marie de Rodat

Re: GCC 6 Status Report (2015-10-16)

2015-10-20 Thread Pierre-Marie de Rodat
king side (affecting both dwarf2out and var-tracking), Richard told me in August that he’s not the correct person to ping for dwarf2out patches, so I did ping you for the var-tracking part and Jason for the dwarf2out part afterwards. -- Pierre-Marie de Rodat

Re: [PATCHES, PING*5] Enhance standard DWARF for Ada

2015-11-24 Thread Pierre-Marie de Rodat
On 11/23/2015 10:08 PM, Jason Merrill wrote: On 11/23/2015 08:53 AM, Pierre-Marie de Rodat wrote: Do you think the other patches could make it before the branch? (if they could, I will rebase+retest them as quick as possible). Probably, yes. I can't find the DW_AT_static_link patch, t

Re: [PATCH, PING*4] Track indirect calls for call site information in debug info.

2015-11-24 Thread Pierre-Marie de Rodat
+regtested the patch: the updated version is attached. Thanks in advance for your review! -- Pierre-Marie de Rodat >From 2a02ebc79b51693a341355a2301dc0f733591930 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Thu, 13 Jun 2013 11:13:08 +0200 Subject: [PATCH] Track indirect calls for c

Re: [PATCH, PING*4] PR debug/53927: fix value for DW_AT_static_link

2015-11-24 Thread Pierre-Marie de Rodat
On 08/31/2015 09:28 AM, Pierre-Marie de Rodat wrote: Ping for the patch submitted in <https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01629.html>. As Jason noticed in another thread, I forgot to attach the patch here (although it’s filed in the bug tracker). Here it is! Rebased against

Re: [PATCH, PING*3] DWARF: materialize subprogram renamings in Ada as imported declarations

2015-11-24 Thread Pierre-Marie de Rodat
! -- Pierre-Marie de Rodat

Re: [PATCHES, PING*5] Enhance standard DWARF for Ada

2015-11-26 Thread Pierre-Marie de Rodat
86_64-linux. -- Pierre-Marie de Rodat >From 46826e401566c26ad77e2bb6b782cc6034b96fd3 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Thu, 3 Jul 2014 14:16:09 +0200 Subject: [PATCH 2/8] DWARF: handle variable-length records and variant parts Enhance the DWARF back-end to emi

Re: [PATCH, PING*4] PR debug/53927: fix value for DW_AT_static_link

2015-11-26 Thread Pierre-Marie de Rodat
DECL_NAME (fb_decl) = get_identifier ("FRAME_BASE.PARENT"); TYPE_FIELDS (root->frame_type) = chainon (TYPE_FIELDS (root->frame_type), fb_decl); Much better, thanks. :-) Here’s the updated patch. Regtested again on x86_64-linux. -- Pierre-Marie de Rodat >From 3f067709d8

Re: [PATCH, PING*4] PR debug/53927: fix value for DW_AT_static_link

2015-11-26 Thread Pierre-Marie de Rodat
k you again for reviewing! -- Pierre-Marie de Rodat

Re: [PATCH, PING*4] Track indirect calls for call site information in debug info.

2015-11-30 Thread Pierre-Marie de Rodat
that I’m working on this matter: I hope I’ll be able to yield a patch implementing your proposal before the end of this week. -- Pierre-Marie de Rodat

Re: [PATCH, PING*4] Track indirect calls for call site information in debug info.

2015-12-02 Thread Pierre-Marie de Rodat
! Here’s the patch implemeting this, bootstrapped and regtested without regression on x86_64-linux. -- Pierre-Marie de Rodat >From 41ed1a37921b4f9c5f762334265e72fd8e4b4a25 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Thu, 13 Jun 2013 11:13:08 +0200 Subject: [PATCH] Track indir

Re: [PATCH, PING*4] Track indirect calls for call site information in debug info.

2015-12-02 Thread Pierre-Marie de Rodat
On 12/02/2015 02:57 PM, Jakub Jelinek wrote: Ok, thanks. Great, thank you! I’ve pushed the change. -- Pierre-Marie de Rodat

[PATCHES, PING] Enhance standard DWARF for Ada

2015-12-03 Thread Pierre-Marie de Rodat
On 11/26/2015 01:34 PM, Pierre-Marie de Rodat wrote: Done! (I repalced the dwarf_proc_decl_table hash table with a dwarf_proc_stack_usage_map hash_map) Here's an update for the only affected patch. Regtested again on x86_64-linux. Ping for the patches submitted in <https://gcc.gnu.or

Re: [PATCHES, PING*2] Enhance standard DWARF for Ada

2015-12-09 Thread Pierre-Marie de Rodat
Ping for the patches submitted in <https://gcc.gnu.org/ml/gcc-patches/2015-11/msg02723.html> and for the 2/8 update submitted in <https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03224.html>. Thank you in advance! -- Pierre-Marie de Rodat

[Ada] Spurious elaboration warnings with -gnatc and null procedures

2020-07-07 Thread Pierre-Marie de Rodat
When expansion is disabled (-gnatc or gnatprove_mode), null procedures need to be taken into account explicitly since they are not expanded. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_elab.adb (Is_Guaranteed_ABE): Take into account null procedures.diff --git

[Ada] Checking type invariants on in params of procedures, not functions (AI12-0044)

2020-07-07 Thread Pierre-Marie de Rodat
AI12-0044 is a binding interpretation that restricts type-invariant checking to occur on in parameters of procedures but not functions after a call, because such checks done on function calls within type invariants could cause unbounded recursion. This modifies AI05-0289, which specified that invar

[Ada] Handle explicit dereferences in expression functions

2020-07-07 Thread Pierre-Marie de Rodat
An expression function that is a completion freezes the types that appear in the expression. This includes the types of all entities within. In most cases an access type does not freeze its designated type, but implicit dereferences in a dispatching call do freeze the designated type. Additionally,

[Ada] Fix expansion of delta aggregates with slices

2020-07-07 Thread Pierre-Marie de Rodat
When creating an anonymous object of the delta aggregate, use the type of the base expression, not the type of the delta aggregate itself. This follows from Ada 2020 4.3.4(14/5): "The bounds of the anonymous object of an array_delta_aggregate and the discriminants and tag (if any) of the anon

[Ada] Remove extra checks for non-static context from resolving 'Update

2020-07-07 Thread Pierre-Marie de Rodat
Choices in attribute Update are evaluated, which includes checks for non-static context, as part of their analysis and resolution, which happens in Analyze_Array_Component_Update. There is no need to repeat them while attribute is resolved. This is just a cleanup, with no impact on the compiler; i

[Ada] Ensure No_Specification_Of_Aspect forbids pragmas and repr. clauses

2020-07-07 Thread Pierre-Marie de Rodat
Section 13.12.1 of the Ada reference manual states the following: [The No_Specification_of_Aspect pragma] Identifies an aspect for which no aspect_specification, attribute_definition_clause, or pragma is given. GNAT already checks for aspects, this commit adds checks for attribute definitions and p

[Ada] Ada2020: AI12-0198 potentially unevaluated components of arrays

2020-07-07 Thread Pierre-Marie de Rodat
Minor reformatting: This patch reorders the routines of the internal package Interval_Lists. No functional change. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.ads (Interval_Lists): Reordering routine. * sem_util.adb (Interval_Lists): Reordering routines

[Ada] Set range checks for for 'Update on arrays in GNATprove expansion

2020-07-07 Thread Pierre-Marie de Rodat
This is a follow-up of a recent change, where setting of range checks for 'Update on records was moved from Resolve_Attribute (where it was shared between GNAT and GNATprove) to custom expansion for GNATprove (and GNAT sets them as well in its own expansion). This patch does the same for 'Update o

[Ada] Fix documentation of -gnatVa switch

2020-07-07 Thread Pierre-Marie de Rodat
Switch -gnatVa enables all validity checks, including for parameters, which can be specifically enabled with -gnatVp. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Validity Checking): Add "p" to the list of s

[Ada] Allow aspect Relaxed_Initialization on protected entries

2020-07-07 Thread Pierre-Marie de Rodat
Fix the initial support for aspect Relaxed_Initialization based on the finalized SPARK RM wording. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch13.adb (Analyze_Relaxed_Parameter): Fix for protected entries.diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13

[Ada] Use pragma Unsuppress in Time_IO

2020-07-07 Thread Pierre-Marie de Rodat
We are relying on language-defined checks (like slice out of bounds) to detect certain cases of incorrect syntax in time strings. But the run-time system is usually compiled with checks suppressed, so this is erroneous. We were doing something like: X := T'Value (A (Lo .. Hi)); -- Could

[Ada] Add support for XDR streaming in the default runtime

2020-07-07 Thread Pierre-Marie de Rodat
Since we no longer need to distribute s-stratt__xdr.adb, some code in Makefile.rtl is now dead. Update the GNAT UG accordingly. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * Makefile.rtl: Remove dead code. * doc/gnat_ugn/building_executable_programs_with_gnat.rst:

[Ada] Ada2020: AI12-0198 potentially unevaluated components of arrays

2020-07-07 Thread Pierre-Marie de Rodat
This patch fixes a regression in the SPARK testsuite. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Is_Potentially_Unevaluated): Protect reading attribute Etype.diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb --- a/gcc/ada/sem_util.adb +++ b/

[Ada] ACATS 4.1H - BC60005 - null exclusion matching for formal subprograms

2020-07-07 Thread Pierre-Marie de Rodat
This ACATS test shows that we had several inconsistencies in the checking of null exclusion matching. We also realized that some old code in sem_ch6.adb was wrong and no longer necessary, so removed it. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch6.adb (Check_Confo

[Ada] Freeze aspect expression relocated to pragma Precondition

2020-07-07 Thread Pierre-Marie de Rodat
In Analyze_Aspect_Specification we relocate expression of a Pre aspect to pragma Precondition. From this point we now only process the relocated expression; in particular, we freeze it and then copy to a pragma Check (which will ultimately execute this expression when subprogram is called). This f

[Ada] Hang on conditional expression as actual

2020-07-07 Thread Pierre-Marie de Rodat
This patch fixes the compiler whereby conditional expressions used as actuals for anonymous access type in subprogram calls may result in an infinite loop when one of the branches of said conditional expression expands to an N_Expression_With_Actions Tested on x86_64-pc-linux-gnu, committed on tru

[Ada] Move generation of range checks for entry families to expander

2020-07-07 Thread Pierre-Marie de Rodat
This converts the generation of range checks for entry families to the separate analysis and generation model: the semantic analyzer sets the Do_Range_Check flag on the node to be range-checked and then later the expander generates the actual range check. This also removes a useless conditional co

[Ada] Avoid crash on node extension

2020-07-07 Thread Pierre-Marie de Rodat
If a Node_Id points to a node extension, rather than an actual node, avoid crashing in the various debugging printouts, but just print an indication that it's an extension. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * treepr.adb (Print_Node): Add code to test Is_Extension

[Ada] Errors in handling of access_to_subprogram contracts

2020-07-07 Thread Pierre-Marie de Rodat
This patch fixes errors in the construction of wrappers for Access_To_Subprogram types that carry pre/postconditions. a) The formals of the subprogram body for the wrapper must be distinct from those of the corresponding declarationm to prevent spurious visibility errors when other homonyms appear

[Ada] ACATS 4.1K - C452003

2020-07-07 Thread Pierre-Marie de Rodat
This test generates an assertion failure when compiling c452003_root-child.adb and shows that we are missing a null check in membership tests. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch4.adb (Tagged_Membership): Generate a call to CW_Membership instead of

[Ada] Assert failure on invalid Variable_Indexing

2020-07-07 Thread Pierre-Marie de Rodat
GNAT is getting confused and will either generate an assert failure or a confusing error message (when assertions are disabled) in case of an invalid Variable_Indexing. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch4.adb (Try_Container_Indexing): Add ??? comment. Pro

[Ada] Use Is_Generic_Subprogram where possible

2020-07-07 Thread Pierre-Marie de Rodat
Replace low-level Ekind_In tests with high-level Is_Generic_Subprogram. Cleanup only; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * einfo.adb, sem_ch10.adb, sem_ch12.adb, sem_ch8.adb: Use Is_Generic_Subprogram.diff --git a/gcc/ada/einfo.adb

[Ada] Simplify statically known Max_Size_In_Storage_Elements attribute in more cases

2020-07-07 Thread Pierre-Marie de Rodat
Generalize the existing constant-folding code that is used for Size attribute references to handle Max_Size_In_Storage_Elements attribute references as well. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_attr.adb (Eval_Attribute): Generalize static evaluation of

[Ada] Fix typo in code to get a better error message

2020-07-07 Thread Pierre-Marie de Rodat
For illegal name of a generic unit in a USE clause we tailor the message based on the kind of the generic, but we failed to detect generic procedures. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch8.adb (Analyze_Use_Package): Replace low-level, error-prone Ek

[Ada] ACATS 4.1J - B854003 - Subtype conformance check missed #2

2020-07-07 Thread Pierre-Marie de Rodat
This is a follow up of previous change, which didn't handle the case of Errmsg = False in Check_Conformance properly. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch6.adb (Check_Formal_Subprogram_Conformance): New subprogram to handle checking without systemat

[Ada] Small adjustment in the handling of alignment for arrays

2020-07-07 Thread Pierre-Marie de Rodat
This moves the setting of the alignment of an array with known alignment and size for the component type from Freeze_Array_Type to Layout_Type. The rationale is that Layout_Type is invoked after Freeze_Array_Type during freezing and computes the component size from the size of the component type,

[Ada] Check predicates for subtypes of private types

2020-07-08 Thread Pierre-Marie de Rodat
This patch fixes a bug where if we have "subtype S is T with Predicate => ...", and T is a private type whose full type is derived from another private type, then the predicate of S is not checked. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch13.adb (Analyze_Aspect_

[Ada] Extend optimization to True/False prefixed with Standard

2020-07-08 Thread Pierre-Marie de Rodat
Optimization that repaces if expression then return true; else return false; end if; with return expression; is now trivially extended to detect True/False prefixed by Standard. Found while investigating excessive validity checks. Tested on x86_64-pc-linux-gnu, committ

[Ada] Fix inaccurate -gnatR output for derived untagged types

2020-07-08 Thread Pierre-Marie de Rodat
This fixes a couple of quirks in the output generated by the -gnatR switch for derived untagged types with discriminants: 1. in normal mode, it would display both the hidden and the visible discriminants, which results in overlapping components, 2. in JSON mode, it would display only the

[Ada] Allow boolean expressions in aspect Relaxed_Initialization

2020-07-08 Thread Pierre-Marie de Rodat
The final version of SPARK RM 6.10 allows the Relaxed_Initialization status of subprogram parameters (and function result) to be controlled by an optional boolean expressions, e.g.: function F (Arg : Integer) return Integer with Relaxed_Initialization => (Arg => True, F'Result); Tested on x

[Ada] ACATS 4.1R - BD10001 - Error missed

2020-07-08 Thread Pierre-Marie de Rodat
GNAT does not reject specifying aspect Inline twice (once via an aspect and once via a pragma). Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_prag.adb (Process_Inline): Check for duplicate pragma+aspect Inline. Minor code cleanup. (Check_Duplicate_Pragm

[Ada] Disallow Predicate_Failure without predicate

2020-07-08 Thread Pierre-Marie de Rodat
This patch checks RM-3.2.4(14.2/4), which requires Predicate_Failure to be specified only on a subtype with a previous predicate specification (for Static_Predicate or Dynamic_Predicate). We apply the same rule to the GNAT-specific Predicate aspect. Tested on x86_64-pc-linux-gnu, committed on trun

[Ada] Small tweak to Narrow_Large_Operation procedure

2020-07-08 Thread Pierre-Marie de Rodat
This recently introduced procedure is responsible for narrowing the type of operations done originally in Universal_Integer, rewriting them into operations done in Integer or Long_Long_Integer. This changes the procedure to use the base type instead of the first subtype for these two integer types

[Ada] Remove excessive validity checks on in-parameters

2020-07-08 Thread Pierre-Marie de Rodat
Routine Safe_To_Capture_Value was written to capture just the "value", which only made sense for assignable entities. However, it was later employed to capture other properties, e.g. the value being [non-]null or valid. Those properties can be captured for non-assignable entities as well, e.g. cons

[Ada] Add expected and actual size to "bit number out of range" error message

2020-07-08 Thread Pierre-Marie de Rodat
This commit lets users know what the expected and actual size are when conflicting representation clauses are present. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch13.adb (Analyze_Record_Representation_Clause, Check_Record_Representation_Clause): Add expecte

[Ada] Fix incorrect placement of freeze node with predicate

2020-07-08 Thread Pierre-Marie de Rodat
This prevents the freezing mechanism from putting a node inside the subprogram body generated for a predicate function, which can for example happen for a function referenced in the predicate. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * freeze.adb (In_Expanded_Body): Ret

[Ada] Ada_2020 AI12-0250 : Implement Iterator filters.

2020-07-08 Thread Pierre-Marie de Rodat
Iterator filters can appear in loop parameter specifications and in iterator specifications, and determine which elements of some domain of iteration are to be used in a loop, aggregate ,or quantified expression. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * par.adb (P_Ite

[Ada] Static expression function problems with -gnatc and -gnatd.F (SPARK mode)

2020-07-08 Thread Pierre-Marie de Rodat
The implementation of static expression functions exhibited various problems when compiling with the switches -gnatd.F (SPARK mode) or -gnatc. Use of those switches could lead to errors on legal calls to static expression functions (such as the calls being flagged as not static), plus the compiler

[Ada] Accept aspect Relaxed_Initialization on generic subprograms

2020-07-08 Thread Pierre-Marie de Rodat
Aspect Relaxed_Initialization has been prototyped for ordinary subprograms and then SPARK RM 6.10 allowed it for generic subprograms as well. This is mostly straightforward to implement, except when 'Result appears in the aspect expression for a generic function. When instantiated in a wrapper pac

[Ada] Update entities on class-wide condition function creation

2020-07-08 Thread Pierre-Marie de Rodat
Problem: Expression functions that have class-wide pre/post conditions which call functions that are themselves expression functions refer to entities from a specification that isn't theirs. Solution: When creating the class-wide clone of the function that has the class-wide condition, update its

[Ada] Analyze aspects once generic subprograms are recognized

2020-07-08 Thread Pierre-Marie de Rodat
When analysing aspect Yield we were adding a minimum decoration to the annotated entity by setting its kind to E_Function/E_Procedure. This kind was then correctly reset to E_Generic_Function/E_Generic_Procedure after all aspects has been analysed. It seems cleaner to set this kind once and correc

[Ada] Add comment on implementation choice for byte-packed array types

2020-07-08 Thread Pierre-Marie de Rodat
This documents the implementation choice made for byte-packed array types, where we let the code generator deal with them if the type is composite and use the manipulation routines of the front-end if the type is discrete. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * free

[Ada] Clean up in Interfaces.C.Extensions

2020-07-08 Thread Pierre-Marie de Rodat
Now that Interfaces.C also defined long_long and unsigned_long_long, make definitions in Interfaces.C.Extensions subtypes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/i-cexten.ads (long_long, unsigned_long_long): Now subtypes of Interfaces.C types.

[Ada] Fix internal error on string type comparision with predicate

2020-07-08 Thread Pierre-Marie de Rodat
This freezing issue shows that Freeze_Expression does not fully control the placement of freeze nodes produced by an expression coming from the Actions list of various constructs, here an N_And_Then node, because it does not check whether the entity being frozen, for example a type, is really decla

[Ada] Fix warnings in C runtime files on Windows

2020-07-08 Thread Pierre-Marie de Rodat
They are mostly warnings on unused parameters, useless variables, casts between integer and pointers of different size, or missing or incorrect prototypes. There is also an improper checking of a return value. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * adaint.h (__gnat

[Ada] Disable warning about unsafe use of __builtin_frame_address

2020-07-08 Thread Pierre-Marie de Rodat
This disables the warning that is given by the C compiler when it is compiling the generic implementation of the backtrace facility used on some platforms. This happens when a positive frame level is requested, which can be problematic in the general case. But this implementation is known to work

[Ada] Do not apply constraint checks on allocator with No_Initialization

2020-07-08 Thread Pierre-Marie de Rodat
For an allocator in the subtype mark case, the constraints of the subtype must be checked against the designated subtype, except in the case where the No_Initialization flag is set on the allocator node. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch4.adb (Expand_N_A

[Ada] Fix C miss parentheses warning on Windows

2020-07-08 Thread Pierre-Marie de Rodat
The C compiler switch -Wparentheses causes the warning suggest parentheses around '&&' within '||'. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * socket.c [_WIN32] (__gnat_minus_500ms): Parentheses around && operations. Remove notes about TN in comment.diff --git

[Ada] Fix crash on quantified expression in expression function (2)

2020-07-10 Thread Pierre-Marie de Rodat
This just replaces Find_Aspect with Find_Value_Of_Aspect, which seems to be the preferred idiom to retrieve the value of an aspect. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * freeze.adb (Freeze_Expr_Types): Replace call to Find_Aspect with call to Find_Value_Of_

[Ada] Fix crash on quantified expression in expression function

2020-07-10 Thread Pierre-Marie de Rodat
The problem is that the compiler freezes the iterator type associated with a given type in the body of an expression function that contains a quantified expression for this type and happens to be the completion of a previous declaration. The reason is that Freeze_Expr_Types does not see that the

[Ada] Make System.Generic_Bignums more flexible

2020-07-10 Thread Pierre-Marie de Rodat
Reorganize the code and add new generic parameters so that this unit can be reused in more contexts and in particular provide support for bounded large integers without needing any dynamic memory allocation nor secondary stack. Move the implementation of To_String to System.Generic_Bignums to allo

[Ada] Add global contracts to Ada.Numerics.Big_Numbers libraries

2020-07-10 Thread Pierre-Marie de Rodat
This patch adds global contracts to functions from Ada.Numerics.Big_Numbers.Big_Integers and Ada.Numerics.Big_Numbers.Big_Reals. This removes the warnings returned when using these functions in SPARK. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-nbnbin.ads, libg

[Ada] Spurious error in generic dispatching constructor call

2020-07-10 Thread Pierre-Marie de Rodat
Given two interface types Ifc0 and Ifc1 where Ifc1 is a descendant of Ifc0, the frontend reports a spurious error handling a call to a Generic_Dispatching_Constructor instance that occurs as the operand of a qualified expression initializing an allocator where Ifc1'Class is the subtype_mark of the

[Ada] Part of implementation of AI12-0212: container aggregates

2020-07-10 Thread Pierre-Marie de Rodat
This is ongoing work for the implementation of Ada 2020 generalized aggregates for containers. The patch includes the infrastructure to support the new aspect and related subprograms, and implements the functionality of positional aggregates for set-like containers. Still to come: a) resolution a

[Ada] Fix internal error on if-expression in call returning tagged type

2020-07-10 Thread Pierre-Marie de Rodat
This removes the left-overs of an expansion done in Expand_Call_Helper in order to pass the correct accessibility level to the callee when the actual is an if-expression of an access type. The expansion uses a dummy temporary to analyze the outermost Expression_With_Actions it makes and removes it

[Ada] Cleanup excessive conditions in Check_Completion

2020-07-10 Thread Pierre-Marie de Rodat
In routine Check_Completion once the entity kind is determined, it is enough to look if the required completion is provided. However, those two tests were combined, so we were processing the entity several times, which was inelegant and inefficient. Tested on x86_64-pc-linux-gnu, committed on trun

[Ada] Small cleanup throughout Exp_Ch4

2020-07-10 Thread Pierre-Marie de Rodat
This replaces calls to Esize or RM_Size for standard integer types with their value, uses Standard_Long_Long_Unsigned directly in one case and Standard_Long_Long_Integer in another case, and changes the recently added Narrow_Large_Operation to use Uint instead of Nat for sizes. No functional chang

[Ada] Use small limit for aggregates inside subprograms

2020-07-10 Thread Pierre-Marie de Rodat
We want to favor large static aggregate at library level, but within subprograms, we want to favor loops instead when relevant. As part of this work we uncovered a missing freeze on allocator subtype marks showing up with this change, as well as the need to generate predicate checks within init pr

[Ada] Fix detection of volatile properties in SPARK

2020-07-10 Thread Pierre-Marie de Rodat
Now that volatile properties can be set on types, objects other than variable may have fine-grain volatile properties inherited through their type. This is now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Has_Enabled_Property): Add handling of

[Ada] Reuse SPARK expansion of attribute Update for delta_aggregate

2020-07-10 Thread Pierre-Marie de Rodat
For GNATprove we have a special expansion of attribute Update. It is now refactored it into a dedicated routine and reused for delta_aggregate. For attribute Update the behaviour is as it was; for delta_aggregate we now decorate the AST with range checks flags that were previously missing. Tested

[Ada] Fix failing assertions related to volatile objects

2020-07-10 Thread Pierre-Marie de Rodat
Comments for routines No_Caching_Enabled and Is_Effectively_Volatile, which are both related to volatile objects, were not enforced with assertions. As a result, we had failing assertions much deeper in the call tree, far from where the problems occur. This patch adds both the missing assertions an

[Ada] Revert too late setting of Ekind on discriminants

2020-07-10 Thread Pierre-Marie de Rodat
A recent patch enforced an existing comment in Is_Effectively_Volatile with an assertion. To satisfy this assertion, it also set the Ekind on discriminants earlier. However, a subtle prevention of cascaded errors in routine Enter_Name relies on the Ekind of discriminants being set late. This patch

[Ada] Fix expansion of 'Update with multiple choices in GNATprove

2020-07-10 Thread Pierre-Marie de Rodat
GNAT expands attribute Update applied to a record component into a sequence of assignments to a temporary object and applies range checks when analysing those assignment. GNATprove keeps such an aggregate unexpanded, so it misses range checks, especially when several components of a different type

[Ada] Further improve the expansion of array aggregates

2020-07-10 Thread Pierre-Marie de Rodat
First, this change extends the memset optimization to the case of array aggregates nested in other aggregates, when the outer aggregates are expanded component-wise; second, it prevents the compiler from duplicating allocators and other nonstatic constructs present in an Others choice of array aggr

[Ada] Fix detection of actual parameters for procedure calls

2020-07-10 Thread Pierre-Marie de Rodat
Routine Is_Actual_Parameter, which deals with cross-references and pragma Unreferenced, for a procedure call like this: P (A); was wrongly returning True for both the identifiers P and A above, on the grounds that both have N_Procedure_Call_Statement as their parent. Now it only returns True f

[Ada] Remove references to non-existing E_Protected_Object

2020-07-10 Thread Pierre-Marie de Rodat
Nowhere in the code we call set Ekind to E_Protected_Object, so all the code that tests this is necessarily dead. This patch removes references to E_Protected_Object. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * einfo.ads (E_Protected_Object): Enumeration literal removed.

[Ada] Add warning for overlays changing scalar storage order

2020-07-10 Thread Pierre-Marie de Rodat
This makes the compiler issue an unconditional warning for an overlay that changes the scalar storage order, i.e. for an address clause when the overlaid and the underlying objects are of array or record types that have opposite scalar storage order. The reason is that the code generator does not

[Ada] Ada2020: AI12-0368 Declare expressions can be static

2020-07-10 Thread Pierre-Marie de Rodat
This patch implements AI12-0368, which allows declare expressions to be static. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_res.adb (Resolve_Expression_With_Actions): Check the rules of AI12-0368, and mark the declare expression as static or known at

[Ada] Revert mistaken negation related to references to labels

2020-07-10 Thread Pierre-Marie de Rodat
Commit titled "Update handling of assigned value/unreferenced warnings" added a comment "... *unless* this is an actual parameter" and at the same time removed a "not" operator from the corresponding condition. This is now reverted to match both the previous code and the current comment. Tested on

[Ada] Spurious error on parameterless acccess_to_subprogram

2020-07-10 Thread Pierre-Marie de Rodat
Compiler rejects an indirect call through an Access_To_Subprogram value that denotes a parameterless subprogram, when the corresponding access type has a pre- or postcondition. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch3.adb (Build_Access_Subprogram_Wrapper_Body)

[Ada] Preserve casing of output files

2020-07-10 Thread Pierre-Marie de Rodat
Windows is case insensitive but also case preserving, so we don't want to generate a file in lower case if the input file wasn't. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * osint-c.adb (Set_File_Name): Preserve casing of file. * osint.adb (File_Names_Equal): New

[Ada] Potentially unevaluated nested expressions

2020-07-10 Thread Pierre-Marie de Rodat
This patch fixes the general problem in the detection of potentially unevaluated nested expressions. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Immediate_Context_Implies_Is_Potentially_Unevaluated): New subprogram. (Is_Potentially_U

[Ada] Ongoing work for unnamed and named container aggregates

2020-07-15 Thread Pierre-Marie de Rodat
This implements additional functionality for the Ada 202x container aggregates, in particular the use of iterated_component_association in both Unnamed (positional) and Named (keyed) aggregates for types for which the Aspect Aggregate is defined. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] Cleanup condition for an effectively volatile array type

2020-07-15 Thread Pierre-Marie de Rodat
When we detect effectively volatile array type we only need to examine the type of array component if the array itself has no Has_Volatile_Components property. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_prag.adb (Atomic_Components): Simplify with Ekind_In. (

[Ada] Use Sloc of delay statement in timed entry call

2020-07-15 Thread Pierre-Marie de Rodat
This changes the Sloc used to expand a timed entry call from that of the Select to that of the Delay statement for coverage purposes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch9.adb (Expand_N_Timed_Entry_Call): Use the Sloc of the delay statement in the e

[Ada] Do not generate extra copies inside initialization procedures

2020-07-15 Thread Pierre-Marie de Rodat
The RM C.6(19) clause says that atomic or volatile objects of types that are not by reference must be passed by copy in a call if the type of the formal is not atomic or volatile respectively. But this requirement does not apply to initialization procedures, which are generated by the compiler, an

[Ada] Fix oversight in Delayed_Aspect_Present predicate

2020-07-15 Thread Pierre-Marie de Rodat
The predicate returns true only if an aspect requiring delaying like Alignment or Address is the first aspect in the list. The change also contains a small consistency fix for Freeze_Object_Declaration. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch3.adb (Delayed_As

[Ada] Extend static functions

2020-07-15 Thread Pierre-Marie de Rodat
This patch extends static functions and allow them on Intrinsic imported subprograms in addition to expression functions, under -gnatX. We also implement compile time evaluation of Shift_Left/Right operators as a first set of useful static-compatible intrinsics. Tested on x86_64-pc-linux-gnu, com

[Ada] Assert failure with -gnatwr

2020-07-15 Thread Pierre-Marie de Rodat
In a case of a complex precondition expression with quantifiers, we can get a crash in Resolve_Type_Conversion when trying to emit a -gnatwr warning. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_res.adb (Resolve_Type_Conversion): Protect against null entity.

[Ada] ACATS 4.1P [BDB4001] - 13.11.4(22-23/3) not enforced

2020-07-15 Thread Pierre-Marie de Rodat
This ACATS test shows GNAT was not enforcing legality rules related to subpools. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch3.adb (Freeze_Type): Remove warning in expander, replaced by a corresponding error in sem_ch13.adb. Replace RTE_Available by

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