aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2022-06-01[Ada] Combine system.ads file - vxworks7 kernel constants.Doug Rupp7-14/+14
Systemitize Word_Size and Memory_Size declarations rather than hard code with numerical values or OS specific Long_Integer size. gcc/ada/ * libgnat/system-vxworks7-aarch64.ads (Word_Size): Compute based on Standard'Word_Size. (Memory_Size): Compute based on Word_Size. * libgnat/system-vxworks7-arm.ads: Likewise. * libgnat/system-vxworks7-e500-kernel.ads: Likewise. * libgnat/system-vxworks7-ppc-kernel.ads: Likewise. * libgnat/system-vxworks7-ppc64-kernel.ads: Likewise. * libgnat/system-vxworks7-x86-kernel.ads: Likewise. * libgnat/system-vxworks7-x86_64-kernel.ads: Likewise.
2022-06-01[Ada] Combine system.ads files - arm and aarch64 qnxDoug Rupp1-1/+1
Systemitize Word_Size and Memory_Size declarations rather than hard code with numerical values or OS specific Long_Integer size. gcc/ada/ * libgnat/system-qnx-arm.ads (Memory_Size): Compute based on Word_Size.
2022-06-01[Ada] Fix missing space in error messagePiotr Trojanek1-1/+1
On illegal code like: type T is new Positive in range 1..5; the compiler was emitting message: error: extra "in"ignored ^^ which lacked a space character. A tiny diagnostic improvement; spotted while mistakenly typing an illegal test. gcc/ada/ * par-util.adb (Ignore): Add missing space to message string.
2022-06-01[Ada] Fix classification of Subprogram_Variant as assertion pragmaYannick Moy1-0/+1
This pragma was wrongly not recognized as an assertion pragma. Now fixed. gcc/ada/ * sem_prag.ads (Assertion_Expression_Pragmas): Fix value for pragma Subprogram_Variant.
2022-06-01[Ada] Rename Returns_On_Secondary_Stack into Needs_Secondary_StackEric Botcazou7-286/+283
The Returns_On_Secondary_Stack predicate is a misnomer because it must be invoked on a type and types do not return; as a matter of fact, the other Returns_XXX predicates apply to functions. gcc/ada/ * exp_ch6.adb (Caller_Known_Size): Invoke Needs_Secondary_Stack in lieu of Returns_On_Secondary_Stack. (Expand_Call_Helper): Likewise. (Expand_Simple_Function_Return): Likewise. (Needs_BIP_Alloc_Form): Likewise. * exp_ch7.adb (Wrap_Transient_Declaration): Likewise. * sem_res.adb (Resolve_Call): Likewise. (Resolve_Entry_Call): Likewise. * sem_util.ads (Returns_On_Secondary_Stack): Rename into... (Needs_Secondary_Stack): ...this. * sem_util.adb (Returns_On_Secondary_Stack): Rename into... (Needs_Secondary_Stack): ...this. * fe.h (Returns_On_Secondary_Stack): Delete. (Needs_Secondary_Stack): New function. * gcc-interface/decl.cc (gnat_to_gnu_subprog_type): Replace call to Returns_On_Secondary_Stack with Needs_Secondary_Stack.
2022-06-01[Ada] Do not freeze subprogram body without spec too earlyEric Botcazou2-22/+26
This fixes a small oddity whereby a subprogram body declared without a spec would be frozen before its entity is fully processed as an overloaded name. Now the latter step computes useful information, for example whether the body is a (late) primitive of a tagged type, which can be required during the freezing process. The change also adjusts Check_Dispatching_Operation accordingly. No functional changes. gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): For the case where there is no previous declaration, freeze the body entity only after it has been processed as a new overloaded name. Use Was_Expression_Function to recognize expression functions. * sem_disp.adb (Check_Dispatching_Operation): Do not require a body which is the last primitive to be frozen here.
2022-06-01[Ada] Bug fix in "=" function of formal doubly linked listJulien Bortolussi1-2/+2
Correction of a typo regarding indexes. gcc/ada/ * libgnat/a-cfdlli.adb ("="): Make the function properly loop over the right list.
2022-06-01[Ada] Fix predicate check on object declarationMarc Poulhiès4-92/+106
When subtype predicate checks are added for object declarations, it could lead to a compiler crash or to an incorrect check. When the subtype for the object being declared is built later by Analyze_Object_Declaration, the predicate check can't be applied on the object instead of a copy as the call will be incorrect after the subtype has been built. When subtypes for LHS and RHS do not statically match, only checking the predicate on the object after it has been initialized may miss a failing predicate on the RHS. In both cases, skip the optimization and check the predicate on a copy. Rename Should_Build_Subtype into Build_Default_Subtype_OK and move it out of sem_ch3 to make it available to other part of the compiler (in particular to checks.adb). gcc/ada/ * checks.adb (Apply_Predicate_Check): Refine condition for applying optimization. * sem_ch3.adb (Analyze_Component_Declaration): Adjust calls to Should_Build_Subtype. (Analyze_Object_Declaration): Likewise. (Should_Build_Subtype): Rename/move to ... * sem_util.ads (Build_Default_Subtype_OK): ... this. * sem_util.adb (Build_Default_Subtype_OK): Moved from sem_ch3.adb.
2022-06-01[Ada] arm-qnx-7.1: unwind goes wrong after regs restoreDoug Rupp1-0/+10
Bump the pc +3 total for Thumb mode, the same calculation that as is done for arm-linux. gcc/ada/ * init.c (__gnat_adjust_context_for_raise) [QNX][__thumb2__]: Bump the pc an extra byte.
2022-06-01[Ada] Enable using absolute paths in -fdiagnostics-format=json outputGhjuvan Lacambre5-11/+34
This commit makes GNAT use absolute paths in -fdiagnostics-format=json's output when -gnatef is present on the command line. This makes life easier for tools that ingest GNAT's output. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Document new behavior. * errout.adb (Write_JSON_Location): Output absolute paths when needed. * switch-c.adb (Scan_Front_End_Switches): Update -gnatef comment. * usage.adb (Usage): Update description of -gnatef. * gnat_ugn.texi: Regenerate.
2022-06-01[Ada] Fix bad interaction between Inline_Always and -gnateV + -gnataEric Botcazou1-1/+4
The combination of pragma/aspect Inline_Always and -gnateV -gnata runs afoul of the handling of inlining across units by gigi, which does not inline a subprogram that calls nested subprograms if these subprograms are not themselves inlined. This condition does not apply to internally generated subprograms but the special _postconditions procedure has Debug_Info_Needed set so it is not considered as such and, as a consequence, triggers an error if the enclosing subprogram requires inlining by means of Inline_Always. The _postconditions procedure is already marked inlined when generating C code so it makes sense to mark it inlined in the general case as well. gcc/ada/ * contracts.adb (Build_Postconditions_Procedure): Set Is_Inlined unconditionnally on the procedure entity.
2022-06-01[Ada] Propagate null-exclusion to anonymous access typesPiotr Trojanek1-0/+1
When analyzing an array or record type declaration whose component has a constrained access type, e.g.: type Buffer_Acc is not null access all String; type Buffer_Rec is record Data : Buffer_Acc (1 .. 10); end record; type Buffer_Arr is array (Boolean) of Buffer_Acc (1 .. 10); we propagated various properties of the unconstrained access type (e.g. the designated type, access-to-constant flag), but forgot to propagate the null-exclusion. For GNAT it didn't make a big difference, because the (anonymous) component type was never subject to legality checks. The "value tracking" optimisation machinery, which also deals with null values, only works for entire objects and doesn't care about components. However, GNATprove uses this flag when an access-to-component object is dereferenced. gcc/ada/ * sem_ch3.adb (Constrain_Access): Propagate null-exclusion flag from parent type.
2022-06-01[Ada] Add a comment about a finalization issueEric Botcazou1-0/+6
gcc/ada/ * sem_ch5.adb (Analyze_Loop_Statement): Add a comment about a finalization issue.
2022-06-01[Ada] Get rid of secondary stack for controlled components of limited typesEric Botcazou2-14/+17
The initial work didn't change anything for limited types because they use a specific return mechanism for functions called build-in-place where there is no anonymous return object, so the secondary stack was used only for the sake of consistency with the nonlimited case. This change aligns the limited case with the nonlimited case, i.e. either they both use the primary stack or they both use the secondary stack. gcc/ada/ * exp_ch6.adb (Caller_Known_Size): Call Returns_On_Secondary_Stack instead of Requires_Transient_Scope and tidy up. (Needs_BIP_Alloc_Form): Likewise. * exp_util.adb (Initialized_By_Aliased_BIP_Func_Call): Also return true if the build-in-place function call has no BIPalloc parameter. (Is_Finalizable_Transient): Remove redundant test.
2022-06-01[Ada] Note that hardening features are experimentalAlexandre Oliva2-0/+6
Some features haven't got customer feedback or made upstream yet. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst: Note that hardening features are experimental. * gnat_rm.texi: Regenerate.
2022-06-01[Ada] Another case where freezing incorrectly suppresses checksSteve Baird2-4/+15
Avoid improperly suppressing checks for the wrapper subprogram that is built when a null type extension inherits (and does not override) a function with a controlling result. This is a follow-up to other changes already made on this ticket. gcc/ada/ * exp_ch3.adb (Make_Controlling_Function_Wrappers): Set the Corresponding_Spec field of a wrapper subprogram body before analyzing the subprogram body; the field will be set (again) during analysis, but we need it to be set earlier. * exp_ch13.adb (Expand_N_Freeze_Entity): Add wrapper subprogram bodies to the list of declarations for which we do not want to suppress checks.
2022-06-01[Ada] Adjust reference in commentEric Botcazou1-1/+1
This is needed after the creation of Returns_On_Secondary_Stack from the original Requires_Transient_Scope. gcc/ada/ * sem_util.adb (Indirect_Temp_Needed): Adjust reference in comment.
2022-06-01[Ada] QNX shared libraries - arm-qnx build gnatlib .so'sDoug Rupp1-2/+1
Shared libraries now fully supported on arm-qnx. gcc/ada/ * Makefile.rtl (GNATLIB_SHARED): Revert disablement for arm-qnx.
2022-06-01[Ada] Fix composability of return on the secondary stackEric Botcazou1-14/+47
Having components that need to be returned on the secondary stack would not always force a record type to be returned on the secondary stack itself. gcc/ada/ * sem_util.adb (Returns_On_Secondary_Stack.Caller_Known_Size_Record): Directly check the dependence on discriminants for the variant part, if any, instead of calling the Is_Definite_Subtype predicate.
2022-06-01[Ada] Fix "formal parameter & is not referenced" not being properly taggedGhjuvan Lacambre1-1/+2
gcc/ada/ * sem_warn.adb (Warn_On_Unreferenced_Entity): Fix warning tag.
2022-06-01[Ada] Adjust warning switchesGhjuvan Lacambre1-11/+12
This makes tagging more accurate. gcc/ada/ * sem_warn.adb (Check_References): Adjust conditions under which warning messages should be emitted and their tags as well.
2022-06-01[Ada] Minor tweaks to dispatching support codeEric Botcazou3-29/+33
No functional changes. gcc/ada/ * exp_disp.ads (Expand_Interface_Thunk): Change type of Prim. * exp_disp.adb (Expand_Interface_Thunk): Declare Is_Predef_Op earlier, do not initialize Iface_Formal, use No idiom and tweaks comments. (Register_Primitive): Declare L earlier and tweak comments. * sem_disp.adb (Check_Dispatching_Operation): Move tests out of loop.
2022-06-01[Ada] Missing discriminant checks when accessing variant fieldSteve Baird6-69/+128
In some cases, the compiler would incorrectly fail to generate discriminant checks when accessing fields declared in a variant part. Correct some such cases; detect the remaining cases and flag them as unsupported. The formerly-problematic cases that are now handled correctly involve component references occurring in a predicate expression (e.g., the expression of a Dynamic_Predicate aspect specification) for a type declaration (not for a subtype declaration). The cases which are now flagged as unsupported involve expression functions declared before the discriminated type in question has been frozen. gcc/ada/ * exp_ch3.ads: Replace visible Build_Discr_Checking_Funcs (which did not need to be visible - it was not referenced outside this package) with Build_Or_Copy_Discr_Checking_Funcs. * exp_ch3.adb: Refactor existing code into 3 procedures - Build_Discr_Checking_Funcs, Copy_Discr_Checking_Funcs, and Build_Or_Copy_Discr_Checking_Funcs. This refactoring is intended to be semantics-preserving. * exp_ch4.adb (Expand_N_Selected_Component): Detect case where a call should be generated to the Discriminant_Checking_Func for the component in question, but that subprogram does not yet exist. * sem_ch13.adb (Freeze_Entity_Checks): Immediately before calling Build_Predicate_Function, add a call to Exp_Ch3.Build_Or_Copy_Discr_Checking_Funcs in order to ensure that Discriminant_Checking_Func attributes are already set when Build_Predicate_Function is called. * sem_ch6.adb (Analyze_Expression_Function): If the expression of a static expression function has been transformed into an N_Raise_xxx_Error node, then we need to copy the original expression in order to check the requirement that the expression must be a potentially static expression. We also want to set aside a copy the untransformed expression for later use in checking calls to the expression function via Inline_Static_Function_Call. So introduce a new function, Make_Expr_Copy, for use in these situations. * sem_res.adb (Preanalyze_And_Resolve): When analyzing certain expressions (e.g., a default parameter expression in a subprogram declaration) we want to suppress checks. However, we do not want to suppress checks for the expression of an expression function.
2022-06-01[Ada] Fix search for "for ... of" loop subprogramsBob Duff2-7/+19
This patch makes the search for Get_Element_Access, Step (Next/Prev), Reference_Control_Type, and Pseudo_Reference (for optimized "for ... of" loops) more robust. In particular, we have a new Next procedure in Ada 2022, and we need to pick the right one. We have not yet added the new Next and other subprograms. gcc/ada/ * exp_ch5.adb (Expand_Iterator_Loop_Over_Container): For each subprogram found, assert that the variable is Empty, so we can detect bugs where we find two or more things with the same name. Without this patch, that bug would happen when we add the new Next procedure. For Step, make sure we pick the right one, by checking name and number of parameters. For Get_Element_Access, check that we're picking a function. That's not really necessary, because there is no procedure with that name, but it seems cleaner this way. * rtsfind.ads: Minor comment improvement. It seems kind of odd to say "under no circumstances", and then immediately contradict that with "The one exception is...".
2022-06-01[Ada] arm-qnx-7.1: unwind goes wrong after regs restoreDoug Rupp1-0/+30
The usual increment of the pc to pc+2 for ARM is needed. gcc/ada/ * init.c (QNX): __gnat_adjust_context_for_raise: New implementation for arm-qnx.
2022-06-01[Ada] Add reference counting in functional containersJulien Bortolussi2-52/+227
This patch adds reference counting to dynamically allocated pointers on arrays and elements used by the functional container. This is done by making both the arrays and the elements controlled. gcc/ada/ * libgnat/a-cofuba.ads, libgnat/a-cofuba.adb: Add reference counting.
2022-06-01[Ada] Issue a warning on entity hidden in use_clause with -gnatwhYannick Moy3-41/+83
Augment the warnings issued with switch -gnatwh, so that a warning is also issued when an entity from the package of a use_clause ends up hidden due to an existing visible homonym. gcc/ada/ * sem_ch8.adb (Use_One_Package): Possibly warn. * sem_util.adb (Enter_Name): Factor out warning on hidden entity. (Warn_On_Hiding_Entity): Extract warning logic from Enter_Name and generalize it to be applied also on use_clause. * sem_util.ads (Warn_On_Hiding_Entity): Add new procedure.
2022-06-01[Ada] Issue better error message for out-of-order keywords in record defYannick Moy1-1/+40
Various cases of out-of-order keywords in the definition of a record were already detected. This adds a similar detection after NULL and RECORD keywords. gcc/ada/ * par-ch3.adb (P_Known_Discriminant_Part_Opt): Reword error message to benefit from existing codefix. (P_Record_Definition): Detect out-of-order keywords in record definition and issue appropriate messages. Other cases are already caught at appropriate places.
2022-06-01[Ada] Use Actions field of freeze nodes for subprograms (continued)Eric Botcazou1-2/+10
This case was missed in the previous change. gcc/ada/ * exp_ch6.adb (Freeze_Subprogram.Register_Predefined_DT_Entry): Put the actions into the Actions field of the freeze node instead of inserting them after it.
2022-06-01[Ada] Add inline documentation for Is_{Parenthesis,Enum_Array}_AggregateMarc Poulhiès1-0/+9
Both flags were added when square brackets for array/container aggregates have been enabled with -gnat2022 without their corresponding inline documentation. This change adds the missing documention. gcc/ada/ * sinfo.ads: Add inline documention for Is_Parenthesis_Aggregate and Is_Enum_Array_Aggregate.
2022-06-01[Ada] Incorrect code for anonymous access-to-function with convention CBob Duff2-8/+4
This patch fixes a bug where the compiler generates incorrect code for a call via an object with convention C, whose type is an anonymous access-to-function type. gcc/ada/ * einfo-utils.adb (Set_Convention): Call Set_Convention recursively, so that Set_Can_Use_Internal_Rep is called (if appropriate) on the anonymous access type of the object, and its designated subprogram type. * sem_ch3.adb (Access_Definition): Remove redundant call to Set_Can_Use_Internal_Rep.
2022-06-01[Ada] Suppress warnings on membership test of rangesBob Duff3-46/+7
For a membership test "X in A .. B", the compiler used to warn if it could prove that X is within one of the bounds. For example, if we know at compile time that X >= A, then the above could be replaced by "X <= B". This patch suppresses that warning, because there is really nothing wrong with the membership test, and programmers sometimes find it annoying. gcc/ada/ * exp_ch4.adb (Expand_N_In): Do not warn in the above-mentioned cases. * fe.h (Assume_No_Invalid_Values): Remove from fe.h, because this is not used in gigi. * opt.ads (Assume_No_Invalid_Values): Improve the comment. We don't need to "clearly prove"; we can just "prove". Remove the comment about fe.h, which is no longer true.
2022-05-31Daily bump.GCC Administrator1-0/+205
2022-05-30[Ada] Fix spurious options being inserted in -fdiagnostics-format=json outputGhjuvan Lacambre1-1/+1
Without this patch, gnat would use `-gnatw?` as the default option for some of the default warnings. gcc/ada/ * erroutc.adb (Get_Warning_Option): Don't consider `?` as a valid option switch.
2022-05-30[Ada] Add "option" field to GNAT's -fdiagnostics-format=json outputGhjuvan Lacambre3-10/+41
This enables better integration with tools that handle GNAT's output. gcc/ada/ * erroutc.ads (Get_Warning_Option): New function returning the option responsible for a warning if it exists. * erroutc.adb (Get_Warning_Option): Likewise. (Get_Warning_Tag): Rely on Get_Warning_Option when possible. * errout.adb (Output_JSON_Message): Emit option field.
2022-05-30[Ada] Remove contract duplication in formal doubly linked listsJulien Bortolussi1-9/+1
Remove a minor duplication in Post of a function of formal doubly linked lists. gcc/ada/ * libgnat/a-cfdlli.ads (Insert): Remove the duplication.
2022-05-30[Ada] Fix expansion of structural subprogram variantsPiotr Trojanek1-7/+21
When implementing structural subprogram variants we ignored them in expansion of the pragma itself, but not in expansion of a recursive subprogram call. Now fixed. gcc/ada/ * exp_ch6.adb (Check_Subprogram_Variant): Ignore structural variants.
2022-05-30[Ada] Simplify construction of a path to filePiotr Trojanek1-5/+5
Code cleanup; semantics is unaffected. gcc/ada/ * osint.adb (Locate_File): Change variable to constant and initialize it by concatenation of directory, file name and NUL.
2022-05-30[Ada] Remove repeated description of support for Address clausesPiotr Trojanek2-14/+0
The GNAT behaviour regarding the Ada RM requirement to support Address clauses for imported subprograms was documented twice: in section about packed types (which was a mistake) and in section about address clauses (where it belongs). Cleanup related to the use of packed arrays for bitset operations to detect uses of uninitialized scalars in GNAT. gcc/ada/ * doc/gnat_rm/implementation_advice.rst (Packed Types): Remove duplicated and wrongly placed paragraph. * gnat_rm.texi: Regenerate.
2022-05-30[Ada] Add insertion character to Ineffective_Inline_Warnings messagesGhjuvan Lacambre1-2/+2
This enables tools that ingest GNAT's output to properly classify these messages. gcc/ada/ * inline.adb (Check_Package_Body_For_Inlining): Add insertion character.
2022-05-30[Ada] Add insertion character for overlay modification warningsGhjuvan Lacambre3-5/+5
This enables tools that ingest GNAT's output to properly classify these messages. gcc/ada/ * freeze.adb (Warn_Overlay): Add 'o' insertion character. * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Likewise. * sem_util.adb (Note_Possible_Modifications): Likewise.
2022-05-30[Ada] Fix Warn_On_All_Unread_Out_Parameters not being properly taggedGhjuvan Lacambre1-1/+1
This caused tools ingesting GNAT's output to mislabel these messages. gcc/ada/ * sem_warn.adb (Warn_On_Useless_Assignment): Fix insertion character.
2022-05-30[Ada] Fix Warn_On_Late_Primitives messages not being properly taggedGhjuvan Lacambre1-1/+1
This caused tools ingesting GNAT's output to mislabel these messages. gcc/ada/ * sem_disp.adb (Warn_On_Late_Primitive_After_Private_Extension): Fix insertion character.
2022-05-30[Ada] Fix -gnatw.f warnings not having the right insertion charactersGhjuvan Lacambre1-1/+1
This caused these warnings not to be tagged with the switch causing them, which is an issue for tools ingesting GNAT's output. gcc/ada/ * sem_elab.adb (Process_Conditional_ABE_Access_Taken): Add '.f' insertion characters.
2022-05-30[Ada] Deconstruct deferred referencesPiotr Trojanek8-138/+4
While cleaning up and modifying code for unreferenced warnings we removed all calls to Defer_Reference, which was the only routine that populated the Deferred_References table. Consequently, all the code related to this table became dead. gcc/ada/ * lib-xref.ads (Deferred_Reference_Entry, Defer_Reference, Process_Deferred_References, Has_Deferred_Reference): Remove client API. * lib-xref.adb (Deferred_References, Defer_Reference, Has_Deferred_Reference, Process_Deferred_References): Remove implementation. * frontend.adb, sem_ch11.adb, sem_ch5.adb, sem_res.adb, sem_util.adb, sem_warn.adb: Remove uses of Deferred_References.
2022-05-30[Ada] Avoid creating a finalization wrapper block for functionsBob Duff2-54/+30
This patch fixes a bug whereby if a function body has local objects that are finalizable, and has a return statement that requires generation of transient finalizable temps, and there are dynamic-sized objects requiring pushing/popping the (primary) stack at run time, and the function body has exception handlers, then incorrect code is generated. In particular, the transient objects are finalized after they have been deallocated. This can cause seg faults, corrupted heap, and the like. Note that if there are no dynamic-sized objects, then the bug does not occur, because the back end allocates objects of compile-time-known size based on where they are referenced, rather than which local block they are declared in. This patch relies on the fact that an At_End handler and regular exception handlers CAN coexist in the same handled statement sequence, which was not true some years ago. gcc/ada/ * exp_ch7.adb (Wrap_HSS_In_Block): Do not create a new block in the case of function bodies. We include all subprogram bodies, because it's harmless for procedures. We cannot easily avoid creating this block in ALL cases, because some transformations of (e.g.) task bodies end up moving some code such that the wrong exception handlers apply to that code. (Build_Finalizer_Call): Remove code for creating a new block. This was unreachable code, given that Wrap_HSS_In_Block has already done that, but with the above change to Wrap_HSS_In_Block, this code becomes reachable, and triggers essentially the same bug. * exp_ch7.ads: Adjust comment.
2022-05-30[Ada] Incorrect unreferenced warnings on null subprograms and formals with ↵Justin Squirek2-0/+27
aspects This patch corrects an error in the compiler whereby spurious unreferenced warnings are generated on formal parameters of null generic subprograms. These changes also fix the parsing of aspects on formal parameters such that the aspects now get properly set for all formal parameters in a parameter list. gcc/ada/ * par-ch6.adb (P_Formal_Part): Set Aspect_Specifications on all formals instead of just the last in a formal id list. * sem_ch6.adb (Analyze_Null_Procedure): Mark expanded null generic procedures as trivial in order to avoid spurious unreferenced warnings.
2022-05-30[Ada] Fix illegal Ada in s-dwalin.adbRomain Beguet1-0/+2
Both the `System.Mmap` and `System.Object_Reader` packages are defining entities named `Offset` and they are both `use`d at the top of s-dwalin.adb. Therefore, the references to `Offset` throughout this file are ambiguous, and GNAT is supposed to complain. Since it does not for the moment, we fix the ambiguity by declaring a subtype `Offset` at the top of the file simply renames `System.Object_Reader.Offset`. gcc/ada/ * libgnat/s-dwalin.adb: Add a subtype declaration to fix the ambiguity.
2022-05-30[Ada] Incorrect determination of whether an expression is predicate-staticSteve Baird1-15/+46
The expression given in a Static_Predicate aspect specification is required to be predicate-static. The implementation of this compile-time check was incorrect in some cases. There were problems in both directions: expressions that are not predicate-static were incorrectly treated as though they were and vice versa. This led to both accepting invalid code and to rejecting valid code. gcc/ada/ * sem_ch13.adb (Is_Predicate_Static): Do not generate warnings about subexpressions of enclosing expressions. Generate warnings for predicates that are known to be always true or always false, except in the case where the predicate is expressed as a Boolean literal. Deal with non-predicate-static expressions that have been transformed into predicate-static expressions. Add missing Is_Type_Ref call to N_Membership_Test case.
2022-05-30[Ada] Fix expansion of aggregate for discriminated limited extensionEric Botcazou1-3/+13
The presence of the discriminants prevents the values associated with the components of the parent type from being put into the sub-aggregate built for the _Parent component. gcc/ada/ * exp_aggr.adb (Expand_Record_Aggregate.Build_Back_End_Aggregate): Skip the discriminants at the start of the component list before looking for the components inherited from the parent in the case of a tagged extension.