[Ada] Small cleanup in C header file

2021-05-07 Thread Pierre-Marie de Rodat
This fixes a few deviations from the GCC Coding Conventions, differences between declarations and definitions of functions and minor other things. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * atree.h (Parent): Remove duplicate declaration. (Get_1_Bit_Field): Also

[Ada] Fix type mismatch warnings during LTO bootstrap #2

2021-05-07 Thread Pierre-Marie de Rodat
This fixes the type of parameters and variables in the C code, changes the convention of Raise_From_Signal_Handler to C and uses a compatible boolean type for Is_Handled_By_Others. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * init.c (__gnat_raise_program_error): Fix param

[Ada] Fix type mismatch warnings during LTO bootstrap #5

2021-05-07 Thread Pierre-Marie de Rodat
This changes the C interface to Ada.Exceptions.Exception_Propagation from using the opaque _Unwind_Ptr to using the explicit Exception_Id, which is the C view of the Exception_Data_Ptr declared in System.Standard_Library. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * raise

[Ada] Fix type mismatch warnings during LTO bootstrap #3

2021-05-07 Thread Pierre-Marie de Rodat
This changes a type name to avoid a violation of the C++ ODR with LTO, sets convention C on another enumeration type and declares a matching enumeration type in C, fixes a blatant type mismatch, marks components as aliased in a couple of record types and tweaks one of them a bit more. Tested on x8

[Ada] Replace packed records with integers in low-level implementation

2021-05-07 Thread Pierre-Marie de Rodat
Accessing components in packed record types turns out to be too slow for practical use so this replaces them with integer types. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * atree.ads (Slot): Change to modular type. (Slot_1_Bit): Delete. (Slot_2_Bit): Like

[Ada] Variable-sized node types -- cleanup

2021-05-07 Thread Pierre-Marie de Rodat
Fix incorrect comments. Clean up marks. Rename Set_Ekind to be Mutate_Ekind to match Mutate_Nkind. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * atree.ads, atree.adb, gen_il-gen.ads: Fix comments and clean up ??? marks. Rename Set_Ekind to be Mutate_Ekind.

[Ada] Fix link from body protected entry implementation to source code

2021-05-07 Thread Pierre-Marie de Rodat
CodePeer needs to recognize internally generated procedures that implement protected entries. Previously this was done with an extra field in the procedure entity; now it is done with an extra field in the procedure body. The new field bypasses the trouble with the procedure entity changing its ty

[Ada] Fix type mismatch warnings during LTO bootstrap #4

2021-05-07 Thread Pierre-Marie de Rodat
There are 3 views of the exception record type in an Ada program: the master is declared as Exception_Data in System.Standard_Library, the compiler view is built by Cstand at the beginning of the compilation, and the C view is declared in the raise.h header file. These views must be sufficiently a

[Ada] Reinitialize Private_Dependents when it is vanishing

2021-05-07 Thread Pierre-Marie de Rodat
We call Set_Ekind on a E_Incomplete_Subtype entity, and the Private_Dependents field vanishes. This patch resets it to zero, as required for vanishing fields. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch3.adb (Process_Incomplete_Dependents): Reset Private_D

[Ada] Robust detection of access-to-subprogram and access-to-object types

2021-05-07 Thread Pierre-Marie de Rodat
Routines Is_Access_Object_Type and Is_Access_Subprogram_Type were arbitrarily categorizing E_Access_Subtype as an access-to-object, even though it could represent an access-to-subprogram. Now those routines examine not just the Ekind, but also the Designated_Type of an access (sub)type, which is m

[Ada] Restore nnd capability

2021-05-07 Thread Pierre-Marie de Rodat
Move the nnd capability from Atree to Sinfo.Utils, because Atree is now compiled with "pragma Assertion_Policy (Ignore);", which disables pragma Debug. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * atree.adb: Move nnd-related code from here, and leave a comment poi

Re: [PATCH] DWARF: add abstract origin links on lexical blocks DIEs

2016-01-20 Thread Pierre-Marie de Rodat
On 01/18/2016 10:47 AM, Pierre-Marie de Rodat wrote: Thank you for your inputs! I’m going to try that, then. I hope this test will not be too fragile… Here it is! Re-bootstrapped and regtested successfuly on x86_64-linux. I’ve checked that the testcase fails on the mainline. -- Pierre-Marie

Re: [PATCH 10/9] ENABLE_CHECKING refactoring: remove remaining occurrences

2016-02-24 Thread Pierre-Marie de Rodat
want. I’m a little bit desynchronized with the development pace these days: would this be for stage 4 or GCC 7? -- Pierre-Marie de Rodat

Re: [PATCH 10/9] ENABLE_CHECKING refactoring: remove remaining occurrences

2016-02-25 Thread Pierre-Marie de Rodat
d you do the substitution ENABLE_CHECKING → CHECKING_P for these dwarf2out.* occurences as part of it? -- Pierre-Marie de Rodat

Re: [PATCH 10/9] ENABLE_CHECKING refactoring: remove remaining occurrences

2016-02-25 Thread Pierre-Marie de Rodat
On 02/25/2016 11:15 AM, Martin Liška wrote: Sure. Just working on that. Great, thank you! -- Pierre-Marie de Rodat

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

2016-02-25 Thread Pierre-Marie de Rodat
! I'm attaching two possible patches, so far untested. Thanks, I’m having a look as we speak. So, Pierre-Marie, can I ask you to run whatever Ada debug info testsuite you have with the second patch? And for GCC 7 really please consider adding gnat.dg/guality/ and fill it with tests. Testi

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

2016-02-25 Thread Pierre-Marie de Rodat
just that prune_unused_types_walk_loc_descr does not know about this kind of operation. I think the attached patch is a more general fix for that. What do you think? (bootstrapped and regtested on x86_64-linux) -- Pierre-Marie de Rodat >From 671199e8a7da326e54e081b5c368f93428455e98 Mon Sep 17 00:00

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

2016-02-25 Thread Pierre-Marie de Rodat
-S -g -fgnat-encodings=minimal -dA foo.adb && grep DW_OP_call4 foo.s foo.s:313: .byte 0x99# DW_OP_call4 -- Pierre-Marie de Rodat procedure Foo is type Record_Type (N : Natural) is record S1 : String (1 .. N); S2 : String (1 .. N); end record; procedure Pr

Re: [PATCH] Fix DW_OP_GNU_implicit_pointer referring to DW_TAG_dwarf_procedure (PR debug/69947)

2016-02-26 Thread Pierre-Marie de Rodat
hanks! -- Pierre-Marie de Rodat

[PATCHES] Enhance standard DWARF for Ada

2015-07-16 Thread Pierre-Marie de Rodat
Ok for trunk? Thank you in advance for the review! [1] https://github.com/eliben/pyelftools/ -- Pierre-Marie de Rodat

[PATCH 1/8] Add a flag to control the balance between GNAT encodings, and std. DWARF

2015-07-16 Thread Pierre-Marie de Rodat
eclare a global variable. (gnat_post_options): Initialize this global from options. -- Pierre-Marie de Rodat >From 77212283fa0ddbbf6aef4a6f16aa0e8286b811f3 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Wed, 17 Sep 2014 14:54:50 +0200 Subject: [PATCH 1/8] Add a flag to control t

[PATCH 2/8] DWARF: handle variable-length records and variant parts

2015-07-16 Thread Pierre-Marie de Rodat
c. descr. lists. (prune_unused_types_walk): Don't mark DWARF procedures by default. Mark variant parts since nothing is supposed to reference them. gcc/testsuite/ChangeLog: * gnat.dg/specs/debug1.ads: Update the expected number of DW_AT_artificial attribute in compiler output.

[PATCH 3/8] DWARF: add a language hook to override types in debugging information

2015-07-16 Thread Pierre-Marie de Rodat
2out.c (modified_type_die): Invoke the get_debug_type language hook, process its result instead, if any. (gen_descr_array_type_die): Add array-wide stride processing. -- Pierre-Marie de Rodat >From d50a4b3d02753ccd89e05d08d9f7a9516afdf8de Mon Sep 17 00:00:00 2001 From: Pierre-Marie de R

[PATCH 4/8] DWARF: add a language hook for fixed-point types

2015-07-16 Thread Pierre-Marie de Rodat
. * dwarf2out.h (enum fixed_point_scale_factor): New. (struct fixed_point_type_info): New. * dwarf2out.c (base_type_die): In DWARFv3 or non-strict DWARF mode, get fixed-point type information using the debugging hook and describe it in DWARF, if any. -- Pierre-Marie de Rodat

[PATCH 5/8] DWARF: describe Ada dynamic arrays as proper arrays

2015-07-16 Thread Pierre-Marie de Rodat
pointers and generate the corresponding array type descriptions. -- Pierre-Marie de Rodat >From 27e94b46e4873b175682848e87ccc60bec9f98b2 Mon Sep 17 00:00:00 2001 From: derodat Date: Fri, 3 Oct 2014 09:57:06 + Subject: [PATCH 5/8] DWARF: describe Ada dynamic arrays as proper arrays

[PATCH 6/8] create a macro for max dimensions for array descr. lang. hook

2015-07-16 Thread Pierre-Marie de Rodat
size. * dwarf2out.c (gen_type_die_with_usage): Check that the array descr. language hook does not return an array with more dimensions that it should. -- Pierre-Marie de Rodat >From 5221a4fadfa84f31cc97e0eba26f8640c9abe70d Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Fri

[PATCH 7/8] DWARF: add a language hook for scalar biased types

2015-07-16 Thread Pierre-Marie de Rodat
the bias to subrange_type_die. -- Pierre-Marie de Rodat >From 702af856454dd74dc23979e488d311ea008981ee Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Thu, 8 Jan 2015 11:07:06 +0100 Subject: [PATCH 7/8] DWARF: add a language hook for scalar biased types Front-ends like GNAT

[PATCH 8/8] DWARF: describe properly Ada packed arrays

2015-07-16 Thread Pierre-Marie de Rodat
ne of the original packed type, if any. Fix TYPE_DECL peeling around the name of the input type. -- Pierre-Marie de Rodat >From 2be4df85e18e86c999d7f493366804bb57052abf Mon Sep 17 00:00:00 2001 From: derodat Date: Thu, 18 Dec 2014 12:45:52 + Subject: [PATCH 8/8] DWARF: describe

Re: [PATCH 2/8] DWARF: handle variable-length records and variant parts

2015-07-16 Thread Pierre-Marie de Rodat
ificial attribute in compiler output. -- Pierre-Marie de Rodat >From a7ba9b22e494c0d7db0d141008f87c33fd7864a3 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

Re: [PATCH 1/8] Add a flag to control the balance between GNAT encodings, and std. DWARF

2015-07-16 Thread Pierre-Marie de Rodat
On 07/16/2015 12:12 PM, Richard Biener wrote: On Thu, Jul 16, 2015 at 10:52 AM, Andreas Schwab wrote: Pierre-Marie de Rodat writes: +fgnat-encodings= IMHO the option name should include "dwarf". And start with -g Thank you for your answers! Changing the name of the opti

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

2015-07-18 Thread Pierre-Marie de Rodat
registers using the MIR dataflow problem. Update the call to add_removable_extension. (find_and_remove_re): Call df_mir_add_problem. -- Pierre-Marie de Rodat >From 2b0fe78644c3c3b16555b69d0b787dbad4a434a4 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date

[PATCH] PR debug/53927: fix value for DW_AT_static_link

2015-07-20 Thread Pierre-Marie de Rodat
sted.c (finalize_nesting_tree_1): Append a field to hold the frame base address. * dwarf2out.c (gen_subprogram_die): Generate for DW_AT_static_link a location description that computes the value of this field. -- Pierre-Marie de Rodat

[PATCH] Track indirect calls for call site information in debug info.

2015-07-20 Thread Pierre-Marie de Rodat
ing_no_opt, make_pass_variable_tracking_no_opt): New. Implement the new pass which adds notes for indirect calls. * dwarf2out.c (dwarf2out_var_location): Set the symbol reference for calls whose target is compile-time known but that are indirect. (gen_subprogram_die): Handle such calls.

[PATCHES, PING] Enhance standard DWARF for Ada

2015-07-23 Thread Pierre-Marie de Rodat
On 07/16/2015 10:34 AM, Pierre-Marie de Rodat wrote: This patch series aims at enhancing GCC to emit standard DWARF in place of the current GNAT encodings (non-standard DWARF) for a set of "basic" types: dynamic arrays, variable-length records, variant parts, etc. Ping for the pa

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

2015-07-25 Thread Pierre-Marie de Rodat
atch for it). Ok for trunk? Thank you in advance for your feedback! -- Pierre-Marie de Rodat >From 8eed7558683e817755314d00adaf9b4820742d22 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Wed, 22 Jul 2015 19:41:08 +0200 Subject: [PATCH] DWARF: materialize subprogram renam

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

2015-07-27 Thread Pierre-Marie de Rodat
On 07/19/2015 12:14 AM, Pierre-Marie de Rodat wrote: This patch is an attempt to fix PR rtl-optimization/66790: please see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66790> for the context. This adds a new dataflow problem (MIR for Must-Initialized Registers) and use it in the REE p

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

2015-07-27 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] Track indirect calls for call site information in debug info.

2015-07-27 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

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

2015-07-31 Thread Pierre-Marie de Rodat
On 07/16/2015 10:34 AM, Pierre-Marie de Rodat wrote: This patch series aims at enhancing GCC to emit standard DWARF in place of the current GNAT encodings (non-standard DWARF) for a set of "basic" types: dynamic arrays, variable-length records, variant parts, etc. Ping for the pa

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

2015-07-31 Thread Pierre-Marie de Rodat
On 07/31/2015 12:54 PM, Pierre-Marie de Rodat wrote: On 07/16/2015 10:34 AM, Pierre-Marie de Rodat wrote: This patch series aims at enhancing GCC to emit standard DWARF in place of the current GNAT encodings (non-standard DWARF) for a set of "basic" types: dynamic arrays, varia

[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

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