aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2022-05-18[Ada] Ada2022: AI12-0143 Index attribute for entry familiesJavier Miranda5-1/+344
gcc/ada/ * snames.ads-tmpl (Name_Index): New attribute name. (Attribute_Id): Adding Attribute_Index as regular attribute. * sem_attr.adb (Attribute_22): Adding Attribute_Index as Ada 2022 attribute. (Analyze_Index_Attribute): Check that 'Index appears in a pre-/postcondition aspect or pragma associated with an entry family. (Analyze_Attribute): Adding semantic analysis for 'Index. (Eval_Attribute): Register 'Index as can never be folded. (Resolve_Attribute): Resolve attribute 'Index. * sem_ch9.adb (Check_Wrong_Attribute_In_Postconditions): New subprogram. (Analyze_Requeue): Check that the requeue target shall not have an applicable specific or class-wide postcondition which includes an Index attribute reference. * exp_attr.adb (Expand_N_Attribute_Reference): Transform attribute Index into a renaming of the second formal of the wrapper built for an entry family that has contract cases. * einfo.ads (Is_Entry_Wrapper): Complete documentation.
2022-05-18[Ada] Fix proof of runtime unitsYannick Moy3-0/+9
Update to latest version of Why3 caused some proof regressions. Fix the proof by changing ghost code. gcc/ada/ * libgnat/s-imagei.adb (Set_Digits): Add assertion. * libgnat/s-imgboo.adb (Image_Boolean): Add assertions. * libgnat/s-valueu.adb (Scan_Raw_Unsigned): Add assertion.
2022-05-18[Ada] Errors missed on ACATS test B650007Arnaud Charlet2-14/+7
This ACATS test shows that we need to call Is_Immutably_Limited_Type in Analyze_Function_Return and also that we have a latent bug in Is_Immutably_Limited_Type which shouldn't look through private types. gcc/ada/ * sem_aux.adb (Is_Immutably_Limited_Type): Do not look through private types as per RM 7.5(8.1). * sem_ch6.adb (Analyze_Function_Return): Use Is_Immutably_Limited_Type as per RM 6.5(5.10).
2022-05-18[Ada] Fix the parsing for delta aggregateMarc Poulhiès3-1/+12
In Ada 2022, delta aggregate must use parentheses not square brackets except array delta aggregates. gcc/ada/ * gen_il-gen-gen_nodes.adb (Gen_IL.Gen.Gen_Nodes): Add Is_Homogeneous_Aggregate field for N_Delta_Aggregate nodes. * par-ch4.adb (P_Aggregate_Or_Paren_Expr): Minor reformatting. * sem_aggr.adb (Resolve_Delta_Aggregate): Reject square brackets for record aggregate. (Resolve_Record_Aggregate): Uniformise error message.
2022-05-18[Ada] Secondary stack and a-tagsArnaud Charlet3-66/+46
The simple use of Ada.Tags triggers a dependency on the secondary stack mechanism, which is unwanted on small embedded targets. To avoid this dependency, we special case a-tags.ali in ALI.Scan_ALI to not set Sec_Stack_Used. If some other code calls one of the functions returning a string, this code will also be marked as requiring the secondary stack. We also remove the need to import and set __gnat_binder_ss_count in this case by ensuring this variable defaults to 0. gcc/ada/ * ali.adb (Scan_ALI): Special case a-tags.ali when setting Sec_Stack_Used. * bindgen.adb (Gen_Adainit): Simplify handling of secondary stack related code, and only import __gnat_binder_ss_count when needed. * libgnat/s-secsta.adb (Binder_SS_Count): Default initialize to 0.
2022-05-18[Ada] Fix problematic underflow for Float_Type'ValueEric Botcazou2-1/+20
We need a couple of guards for boundary conditions in the support code. gcc/ada/ * libgnat/s-dourea.adb ("/"): Add guard for zero and infinite divisor. * libgnat/s-valuer.adb (Scan_Raw_Real): Add guard for very large exponent values.
2022-05-18[Ada] Spurious error on freezing of tagged types in SPARKYannick Moy1-1/+11
SPARK RM 7.7(8) mandates that the freezing point of a tagged type must occur within the so-called early call region of all its primitives. This check may lead to spurious errors due to generated constructs being considered in the search for the start of the early call region. gcc/ada/ * sem_elab.adb (Is_Suitable_Construct): Fix for generated constructs.
2022-05-18[Ada] Rework optimization skipping pragma check in object declarationMarc Poulhiès2-4/+8
When an object declaration is initialized with a type conversion: Var : Typ := Typ (Value); we skip the check for Typ's predicate as it is already checked during the type conversion. This is not correct when Var's subtype and the target subtype of the conversion do not statically match: Var : Typ := OtherTyp (Value); In such case, we can't skip the check of Typ's predicate. Fix minor typos in comment. gcc/ada/ * sem_ch3.adb (Analyze_Object_Declaration): Skip predicate check for type conversion if object's subtype and expression's subtype statically match. * exp_prag.adb (Expand_Pragma_Check): Typo fix in comment.
2022-05-18[Ada] Fix internal error on subprogram instantiationEric Botcazou2-1/+2
The compiler builds renamings for actuals of formal objects for debugging purposes in this case, but it must not generate them for temporaries. gcc/ada/ * exp_dbug.ads (Build_Subprogram_Instance_Renamings): Fix typo. * exp_dbug.adb (Build_Subprogram_Instance_Renamings): Build the renaming only for actuals of formal objects.
2022-05-18[Ada] Overriding error on type derived from discriminated untagged private typeGary Dismukes1-1/+9
When a derived type DT has an untagged private parent type PT with a discriminant, where the full type of PT is tagged, and DT inherits a function F with an anonymous access result that designates the type, the compiler wrongly reports an error saying that DT must be declared abstract or F overridden. A test is added to exclude checking the abstract overriding rules that should only apply to inherited subprograms of tagged derived types. gcc/ada/ * sem_ch3.adb (Check_Abstract_Overriding): If the type is derived from an untagged type, then don't perform any of the abstract overriding error checks.
2022-05-18[Ada] Prevent overflow in computation of aggregate sizePiotr Trojanek1-2/+2
When computing size of a static aggregate to decide if it should be transformed into assignments and loops we could have an overflow check. This is mostly harmless, because colossal aggregates will likely crash the application anyway, no matter how we transform them. This was not detected because compiler was built with -gnatg switch that suppresses overflow checks (they are only enabled by an explicit -gnato switch). gcc/ada/ * exp_aggr.adb (Component_Count): Calculate size as an Uint and only then check if it is in the range of Int, as otherwise the multiplication of Int values can overflow.
2022-05-18[Ada] Fast implementation of floating-point mathematical functionsEric Botcazou8-149/+439
This adds a package renaming unit to the GNAT hierarchy so as to expose the underlying implementation of floating-point mathematical functions, thus also making it possible to use their vector implementation, if any. The change also contains a small improvement to the Hide_Public_Entities mechanism in Sem_Ch7 that makes it possible to clear the Is_Public flag within instances of generic packages that do not have a body. gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-gfmafu$(objext). (SIMD_PATH_TARGET_PAIRS): New variable. (TRASYM_DWARF_COMMON_OBJS): Minor tweak. (x86-64/Linux): Use SIMD_PATH_TARGET_PAIRS. (x32/Linux): Likewise. * doc/gnat_rm/the_gnat_library.rst (Generic_Fast_Math_Functions): New entry. * gnat_rm.texi: Regenerate. * impunit.adb (Non_Imp_File_Names_95): Add g-gfmafu. * sem_ch7.adb (Has_Referencer): Do not set In_Nested_Instance for instances of generic packages that do not have a body. * libgnat/a-nalofl__simd.ads: New SIMD-enabled version. * libgnat/a-nuaufl__simd.ads: Likewise. * libgnat/g-gfmafu.ads: New package renaming unit.
2022-05-18[Ada] Freezing too strict in instancesArnaud Charlet1-7/+10
Should_Freeze_Type is relaxed to only take the relevant case into account (entities denoted by generic actual parameters as per 13.14(5/3), as well as profile of any subprograms named as per 13.14(10.2/4)), instead of being overly conservative wrt instances and as a result, wrongly rejecting some legal code. In practice this means we only need to worry about profile of subprograms named as part of instances. gcc/ada/ * freeze.adb (Should_Freeze_Type): Fix handling of freezing in instances.
2022-05-18[Ada] Fix incorrect freezing with generic child unitMarc Poulhiès1-2/+2
The Analyze_Associations.Check_Generic_Parent function was using an incorrect node as the instanciation node for the actual, possibly leading to incorrect freeze node being created (and later crashing in gigi). Using Get_Unit_Instantiation_Node fixes the issue. gcc/ada/ * sem_ch12.adb (Check_Generic_Parent): Use Get_Unit_Instantiation_Node instead of Next.
2022-05-18[Ada] Ada.Numerics.Aux.*: Mention more Intrinsic and less C Math LibraryAlexandre Oliva4-18/+27
Since we import the elemental math functions as intrinsics, it's not accurate to state we're drawing them in from the C math library. gcc/ada/ * libgnat/a-nagefl.ads: Replace mentions of C/unix math library with intrinsics. * libgnat/a-nallfl.ads: Likewise. State compatibility requirements. * libgnat/a-nalofl.ads: Likewise. * libgnat/a-nuaufl.ads: Likewise.
2022-05-18[Ada] Small performance tweak in recent changeEric Botcazou1-2/+1
This avoids a useless walk of the prefix chain in instances. gcc/ada/ * sem_ch8.adb (Analyze_Subprogram_Renaming): Move final test on In_Instance to outer condition.
2022-05-18[Ada] New port arm-qnxDoug Rupp4-9/+174
The QNX system specs for ARM and AARCH64 are identical. It makes more sense to have it named for the base architecture. gcc/ada/ * Makefile.rtl: Rename system-qnx-aarch64.ads to system-qnx-arm.ads. (AARCH64 QNX section): Modify to handle both arm and arch64. * tracebak.c (__QNX__): Add new __ARMEL__ section. * sigtramp-arm-qnx.c: New file. * libgnat/system-qnx-aarch64.ads: Renamed to ... * libgnat/system-qnx-arm.ads: this.
2022-05-18Daily bump.GCC Administrator1-0/+226
2022-05-17[Ada] Restore defensive guard in checks for volatile actualsPiotr Trojanek1-1/+2
When flagging names of volatile objects occurring in actual parameters it is safer to guard against identifiers without entity. This is redundant (because earlier in the resolution of actual parameters we already guard against actuals with Any_Type), but perhaps such identifiers will become allowed in constructs like: Subprogram_Call (Actual => (declare X : Boolean := ... with Annotate (GNATprove, ...))); ^^^^^^^^^ which include an identifier that does not denote any entity. Code cleanup related to handling of volatile components; behaviour is unaffected. gcc/ada/ * sem_res.adb (Flag_Effectively_Volatile_Objects): Restore redundant guard.
2022-05-17[Ada] Subprogram renaming fails to hide homographGary Dismukes1-0/+25
The compiler failed to detect an error where the first prefix of an expanded name given as the renamed subprogram in a subprogram renaming declaration denotes a unit with the same name as the name given for the subprogram renaming. Such a unit must be hidden by the renaming itself. An error check is added to catch this case. gcc/ada/ * sem_ch8.adb (Analyze_Subprogram_Renaming): Add error check for the case of a renamed subprogram given by an expanded name whose outermost prefix names a unit that is hidden by the name of the renaming. (Ult_Expanded_Prefix): New local expression function to return the ultimate prefix of an expanded name.
2022-05-17[Ada] CUDA: remove code performing kernel registrationGhjuvan Lacambre2-503/+8
A previous commit implemented a new kernel registration scheme, using the binder to generate registration code rather than inserting registration code in packages. Now that this new approach has had time to be thoroughly tested, it is time to remove the old approach. gcc/ada/ * gnat_cuda.ads: Update package-level comments. (Build_And_Insert_CUDA_Initialization): Remove function. * gnat_cuda.adb (Build_And_Insert_CUDA_Initialization): Remove function. (Expand_CUDA_Package): Remove call to Build_And_Insert_CUDA_Initialization.
2022-05-17[Ada] Enhance the warning on C enum with size clause for size /= 32Etienne Servais1-5/+12
Improve the warning message and silence warning when size > 32, this is likely intentional and does not warrant a warning. gcc/ada/ * freeze.adb (Freeze_Enumeration_Type): Fix comment, enhance message and silence warning for size > 32.
2022-05-17[Ada] Allow inlining for proof inside genericsYannick Moy5-10/+103
For local subprograms without contracts inside generics, allow their inlining for proof in GNATprove mode. This requires forbidding the inlining of subprograms which contain references to object renamings, which would be replaced in the SPARK expansion and violate assumptions of the inlining code. gcc/ada/ * exp_spark.adb (Expand_SPARK_Potential_Renaming): Deal with no entity case. * inline.ads (Check_Object_Renaming_In_GNATprove_Mode): New procedure. * inline.adb (Check_Object_Renaming_In_GNATprove_Mode): New procedure. (Can_Be_Inlined_In_GNATprove_Mode): Remove case forbidding inlining for subprograms inside generics. * sem_ch12.adb (Copy_Generic_Node): Preserve global entities when inlining in GNATprove mode. * sem_ch6.adb (Analyse_Subprogram_Body_Helper): Remove body to inline if renaming is detected in GNATprove mode.
2022-05-17[Ada] Provide allocation subtype for allocators of a ↵Gary Dismukes2-8/+44
Designated_Storage_Model type When an allocator is for an access type that has a Designated_Storage_Model aspect, and the designated type is an unconstrained record type with discriminants, and the subtype associated with the allocator is constrained, a dereference of the new access value can be passed to the designated type's initialization procedure. The post-front-end phase of the compiler needs to be able to create a temporary object in the host memory space to pass to the init proc, which requires creating such an object, but the subtype needed for the allocation isn't readily available at the point of the dereference. To make the subtype easily accessible, we set the Actual_Designated_Subtype of such a dereference to the subtype of the allocated object. gcc/ada/ * exp_ch4.adb (Expand_N_Allocator): For an allocator with an unconstrained discriminated designated type, and whose allocation subtype is constrained, set the Actual_Designated_Subtype of the dereference passed to the init proc of the designated type to be the allocation subtype. * sinfo.ads: Add documentation of new setting of Actual_Designated_Subtype on a dereference used as an actual parameter of call to an init proc associated with an allocator. Also add missing syntax and documentation for the GNAT language extension that allows an expression as a default for a concrete generic formal function.
2022-05-17[Ada] Cleanups related to front-end SJLJBob Duff8-75/+21
This patch cleans up some code that is left over from the front-end SJLJ exception handling mechanism, which has been removed. This is in preparation for fixing a finalization-related bug. Most importantly: The documentation is changed: a Handled_Sequence_Of_Statements node CAN contain both Exception_Handlers and an At_End_Proc. The assertion contradicting that is removed from Expand_At_End_Handler. The From_At_End field is removed. gcc/ada/ * sinfo.ads: Remove From_At_End. Update comments. * gen_il-fields.ads, gen_il-gen-gen_nodes.adb, sem_ch11.adb: Remove From_At_End. * exp_ch11.adb (Expand_At_End_Handler): Remove assertion. * fe.h (Exception_Mechanism, Exception_Mechanism_Type, Has_DIC, Has_Invariants, Is_List_Member, List_Containing): Remove declarations that are not used in gigi. * opt.ads (Exception_Mechanism): This is not used in gigi. * exp_util.ads: Minor comment fix.
2022-05-17[Ada] GNAT.Binary_Search is not internalDmitriy Anisimkov1-0/+1
Put package GNAT.Binary_Search to predefined units list. gcc/ada/ * impunit.adb: Add "g-binsea" to Non_Imp_File_Names_95 list.
2022-05-17[Ada] Fix insertion of declaration inside quantified expressionYannick Moy1-1/+1
When the evaluation of the subtype_indication for the iterator_specification of a quantified_expression leads to the insertion of a type declaration, this should be done with Insert_Action instead of Insert_Before. gcc/ada/ * sem_ch5.adb (Analyze_Iterator_Specification): Use Insert_Action when possibly inside an expression.
2022-05-17[Ada] Fix Forced sign flag in formatted stringMarc Poulhiès1-1/+1
Fix the Forced sign flag that is incorrectly ignored for scientific notation and shortest representation. gcc/ada/ * libgnat/g-forstr.adb (Is_Number): Add scientific notation and shortest representation.
2022-05-17[Ada] Fix small glitch in Expand_N_Full_Type_DeclarationEric Botcazou1-2/+1
The original node is not guaranteed to also be an N_Full_Type_Declaration, so the code needs to look into the node itself. gcc/ada/ * exp_ch3.adb (Expand_N_Full_Type_Declaration): Look into N.
2022-05-17[Ada] Requires_Cleanup_Actions and N_Protected_BodyBob Duff1-1/+0
This patch disallows N_Protected_Body from being passed to Requires_Cleanup_Actions. Protected bodies never need cleanup, and are never passed to Requires_Cleanup_Actions, which is a good thing, because it would blow up on Handled_Statement_Sequence, which doesn't exist for N_Protected_Body. gcc/ada/ * exp_util.adb (Requires_Cleanup_Actions): Remove N_Protected_Body from the case statement, so that case will be covered by "raise Program_Error".
2022-05-17[Ada] Output.w always writes to stderrBob Duff1-4/+42
There are several debugging procedures called Output.w, and some output-redirection features. This patch modifies Output.w so their output is not redirected; it always goes to standard error. Otherwise, debugging output can get mixed in with some "real" output (perhaps to a file), which causes confusion and in some cases failure to build. gcc/ada/ * output.adb (Pop_Output, Set_Output): Unconditionally flush output when switching from one output destination to another. Otherwise buffering can cause garbled output. (w): Push/pop the current settings, and temporarily Set_Standard_Error during these procedures.
2022-05-17[Ada] Generic binary search implementationDmitriy Anisimkov5-169/+412
Allows binary search in sorted anonymous array (or array-like container). gcc/ada/ * libgnat/g-binsea.ads, libgnat/g-binsea.adb (GNAT.Binary_Search): New package. * Makefile.rtl (GNATRTL_NONTASKING_OBJS): New item in list. * doc/gnat_rm/the_gnat_library.rst (GNAT.Binary_Search): New package record. * gnat_rm.texi: Regenerate.
2022-05-17[Ada] Fix bogus visibility error with partially parameterized formal packageEric Botcazou3-79/+167
The problem comes from the special instantiation (abbreviated instantiation in GNAT parlance) done to check conformance between a formal package and its corresponding actual in a generic instantiation: the compiler instantiates the formal package, in the context of the generic instantiation, so that it can check the conformance of the actual with the result. More precisely, it occurs with formal packages that are only partially parameterized, i.e. that have at least one parameter association and an (others => <>) choice. In this case, RM 12.7(10/2) says that the visible part of the formal package contains a copy of the formal parameters that are not explicitly associated. The analysis of these copies for the abbreviated instantiation is not done in the correct context when the generic unit is a child generic unit. gcc/ada/ * sem_ch12.ads (Is_Abbreviated_Instance): Declare. * sem_ch12.adb (Check_Abbreviated_Instance): Declare. (Requires_Conformance_Checking): Declare. (Analyze_Association.Process_Default): Fix subtype of parameter. (Analyze_Formal_Object_Declaration): Check whether it is in the visible part of abbreviated instance. (Analyze_Formal_Subprogram_Declaration): Likewise. (Analyze_Formal_Type_Declaration): Likewise. (Analyze_Package_Instantiation): Do not check for a generic child unit in the case of an abbreviated instance. (Check_Abbreviated_Instance): New procedure. (Check_Formal_Packages): Tidy up. (Copy_Generic_Elist): Fix comment. (Instantiate_Formal_Package): Tidy up. If the generic unit is a child unit, copy the qualified name onto the abbreviated instance. (Is_Abbreviated_Instance): New function. (Collect_Previous_Instances): Call Is_Abbreviated_Instance. (Requires_Conformance_Checking): New function. * sem_ch7.adb (Analyze_Package_Specification): Do not install the private declarations of the parent for an abbreviated instance.
2022-05-17[Ada] Take full view of private typeEtienne Servais1-1/+3
This allows to resolve the following: type Rec (<>) is private; type Arr (<>) is private; private type Arr is array (Positive range <>) of Natural; type Rec (L : Natural) is record F1 : Integer; F2 : Arr (1 .. L); end record; gcc/ada/ * sem_ch3.adb (Analyze_Subtype_Declaration): Use underlying type of Indic_Typ. (Constrain_Array): Ditto for T.
2022-05-17[Ada] Allow 'Reduce with -gnat2022Arnaud Charlet2-12/+1
After a period of experimentation, allow 'Reduce in Ada 2022 mode. gcc/ada/ * sem_attr.adb (Analyze_Attribute [Attribute_Reduce]): Allow 'Reduce for Ada 2022 and above. * sem_attr.ads (Attribute_Impl_Def): 'Reduce is no longer implementation defined.
2022-05-17[Ada] Don't create calls to Abort_Undefer when not Abort_AllowedGhjuvan Lacambre1-1/+3
Prevent creation of references to Abort_Undefer when aborts aren't allowed. Another solution could have been an early return at Expand_N_Asynchronous_Select's beginning, but this would break backends that currently expect trees that do not contain any N_Asynchronous_Selects in their AST (e.g. CodePeer). gcc/ada/ * exp_ch9.adb (Expand_N_Asynchronous_Select): Don't generate Abort_Undefers when not Abort_Allowed.
2022-05-17[Ada] Typo fix in finalization commentMarc Poulhiès1-8/+8
Add missing 's' and reformat the comment block. gcc/ada/ * exp_ch7.adb: Fix typo.
2022-05-17[Ada] Initialize Compiler_State to avoid Constraint_ErrorEtienne Servais1-1/+1
When building gnat1 with `-gnatVa` as we do locally, rules like: `gcc -c -gnatyM79 <any adb file with lines longer than 79>` will throw a constraint error as `lib.compiler_state` is initialized by par.adb, ie after scanning. Therefore any error_msg thrown during scanning will perform this uninitialized read (which raises a Constraint_Error when the compiler was compiled with `-gnatVa`). Initialize this flag to `Parsing`. gcc/ada/ * lib.ads: initialize `Compiler_State` to `Parsing`.
2022-05-17[Ada] Deal with derived record types in Has_Compatible_RepresentationEric Botcazou1-0/+10
More precisely, untagged record types, as tagged record types are already handled by the predicate. If the derived type has not been given its own representation clause, then the representations are the same. gcc/ada/ * sem_ch13.adb (Has_Compatible_Representation): Return true for derived untagged record types without representation clause.
2022-05-17[Ada] Streamline implementation of Has_Compatible_RepresentationEric Botcazou4-49/+31
The predicate is only concerned with the internal representation of types and this representation is shared by the subtypes of a given type, so the implementation can directly look into the (implementation) base types. No functional changes. gcc/ada/ * sem_ch13.ads (Has_Compatible_Representation): Minor tweaks. * sem_ch13.adb (Has_Compatible_Representation): Look directly into the (implementation) base types and simplifiy accordingly. * exp_ch5.adb (Change_Of_Representation): Adjust. * exp_ch6.adb (Expand_Actuals): Likewise.
2022-05-17[Ada] Remove superfluous call to Original_NodeEtienne Servais1-1/+1
The function Same_Object starts by taking the Original_Node of its arguments. gcc/ada/ * sem_ch5.adb (Analyze_Assignment): Remove superfluous call to Original_Node.
2022-05-17[Ada] Crash freezing declaration that will raise constraint errorJavier Miranda1-2/+6
When the compiler is built with assertions enabled and processes the following declarations: type Vector_Boolean_Array is array (1 .. 10) of Boolean; O2 : constant Vector_Boolean_Array := [for J in 2 => True]; The expression is rewritten by the frontend with an N_Raise_CE node, which leads to an assertion error at the freezing point of the object declaration. gcc/ada/ * freeze.adb (Freeze_Entity): Protect the call to Declaration_Node against entities of expressions replaced by the frontend with an N_Raise_CE node.
2022-05-17[Ada] Spurious error on subprogram with class-wide preconditionsJavier Miranda2-0/+40
gcc/ada/ * freeze.adb (Build_DTW_Spec): Do not inherit the not-overriding indicator because the DTW wrapper overrides its wrapped subprogram. * contracts.ads (Make_Class_Precondition_Subps): Adding documentation.
2022-05-17[Ada] Use Actions field of freeze nodes for subprogramsEric Botcazou4-11/+25
This has a couple of advantages: 1) the actions are analyzed with checks disabled and 2) they are considered elaboration code by Sem_Elab. gcc/ada/ * exp_ch13.adb (Expand_N_Freeze_Entity): Delete freeze nodes for subprograms only if they have no actions. * exp_ch6.adb (Freeze_Subprogram): Put the actions into the Actions field of the freeze node instead of inserting them after it. * sem_elab.adb (Is_SPARK_Semantic_Target): Fix typo in comment. * gcc-interface/trans.cc (process_freeze_entity): Return early for freeze nodes of subprograms with Interface_Alias set.
2022-05-17[Ada] Implement calls to abstract subprograms in class-wide pre/post-conditionsJavier Miranda1-2/+12
In some special cases involving class-wide pre/post conditions, Ada allows a non-dispatching call to an abstract function (which is usually illegal). Fix a bug in the implementation of Ada's rules about the run-time behavior of such a call. Thanks to Javier Miranda for producing this patch. gcc/ada/ * contracts.adb (Build_Call_Helper_Body): Improve handling of the case of a (legal) non-dispatching call to an abstract subprogram.
2022-05-17[Ada] Fix documentation of using attribute Loop_Entry in pragmasPiotr Trojanek2-8/+14
Attribute Loop_Entry was initially only allowed to appear in pragmas Loop_Variant and Loop_Invariant. Then it was also allowed to appear in pragmas Assert, Assert_And_Cut and Assume, but this change was not reflected in the GNAT RM. gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst (Loop_Entry): Mention pragmas Assert, Assert_And_Cut and Assume; refill. * gnat_rm.texi: Regenerate.
2022-05-17[Ada] Check token to be "access", reject it if notEtienne Servais1-0/+8
The parser skips the token without verifying it is indeed "access". So any token is accepted. gcc/ada/ * par-ch3.adb (P_Access_Type_Definition): Outputs an error if token is not "access".
2022-05-17[Ada] Enable current value propagation within pragma expressionsPiotr Trojanek2-14/+1
This patch fixes an odd incomplete optimization within pragma expressions. For example, in this code: X := True; pragma Assert (X = True); pragma Assert (X); the first assertion was eliminated by the frontend (regardless of the optimization switches), while the second assertion was only eliminated by the backend and only with switch -O1 or similar. The problem was that the current value propagation was disabled for references immediately within pragma argument associations. This was meant to avoid a crash when such a reference appears in pragma Inspection_Point, but this wasn't a proper fix. The proper solution is rather to not expand references in pragma Inspection_Point at all. Actually, this expansion was enabled to avoid a yet another crash, when the parameter of pragma Inspection_Point is a prival (i.e. a renaming of private protected component). It turns out that none of these suspicious problematic fixes is no longer necessary. Cleanup related to fixes of current value propagation in expansion of attribute Loop_Entry. gcc/ada/ * exp_ch2.adb (Expand_Current_Value): Remove special case for references immediately within pragma argument associations. * exp_prag.adb (Expand_Pragma_Inspection_Point): Remove special case for privals.
2022-05-17Daily bump.GCC Administrator1-0/+264
2022-05-16[Ada] Fix fallout of change in equality for untagged record typesEric Botcazou1-3/+27
The problem is that the resolution of expanded names implicitly assumes that the visible and private homonyms in a given scope are segregated on the homonym chain, and this was no longer the case for equality operators in the specific case at stake. gcc/ada/ * sem_ch7.adb (Inspect_Untagged_Record_Completion): Also move the equality operator on the homonym chain if there is another equality operator in the private part.