aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2023-05-15ada: Recover proof of runtime unitsYannick Moy2-5/+7
Changes needed to make proof go through, after some change in GNAT and SPARK. gcc/ada/ * libgnat/a-strsup.adb (Super_Slice): Reorder component assignment to avoid failing predicate check related to initialization. * libgnat/s-expmod.adb (Exp_Modular): Add intermediate assertion.
2023-05-15ada: Recover proof of Interfaces.C for terminationYannick Moy1-1/+9
GNATprove reports possible non-terminating loops in functions marked as terminating. Add loop variants to prove loop termination. gcc/ada/ * libgnat/i-c.adb: Add loop variants. Remove useless initialization.
2023-05-15ada: Fix comment related to inliningBob Duff1-3/+1
Correction to previous check-in: Remove comment about Proc_Next_... procedures, which were deleted. gcc/ada/ * einfo-utils.ads: Remove comment.
2023-05-15ada: Use Inline aspect instead of pragma in Einfo.UtilsBob Duff2-299/+176
This package was using the Ada 83 renaming idiom for inlining Next_Component and other Next_... procedures without inlining the same-named functions. Using the Inline aspect avoids that sort of horsing around. We change all the other pragmas Inline in this package to aspects as well, which is a more-minor improvement. Fix too-long lines without wrapping lines. gcc/ada/ * einfo-utils.ads, einfo-utils.adb: Get rid of the Proc_Next_... procedures. Use Inline aspect instead of pragma Inline. Is_Discrete_Or_Fixed_Point_Type did not have pragma Inline, but now has the aspect; this was probably an oversight (which illustrates why aspects are better).
2023-05-15ada: Fix formatting inconsistency in User's GuideRonan Desplanques1-2/+2
gcc/ada/ * doc/gnat_ugn/gnat_utility_programs.rst: Fix formatting inconsistency.
2023-05-15ada: Remove duplicated code in Proc_Next_Component_Or_DiscriminantBob Duff1-5/+1
Proc_Next_Component_Or_Discriminant was duplicating the code in Next_Component_Or_Discriminant. gcc/ada/ * einfo-utils.adb: (Proc_Next_Component_Or_Discriminant): Call Next_Component_Or_Discriminant.
2023-05-15ada: Improve comment on First_EntityBob Duff1-5/+6
Clarify that "act as scope" overlaps with "[sub]type". gcc/ada/ * einfo.ads: (First_Entity): Update comment explaining why this exists on all [sub]types, as opposed to just the ones with associated entities.
2023-05-15ada: Clean up vanishing entity fieldsBob Duff9-96/+131
Fix all the failures caused by enabling Check_Vanishing_Fields on entities in all cases except the case of converting to or from E_Void. But leave Check_Vanishing_Fields disabled by default (controlled by -gnatd_v flag), because it might be too slow even for assertions-on mode, and we should deal with the E_Void cases eventually. The failures are fixed either by adding calls to Reinit_Field_To_Zero, or by changing which entities have which fields. Note that in a series of Reinit_Field_To_Zero calls, the optional Old_Ekind parameter is only useful on the first such call. gcc/ada/ * atree.adb (Check_Vanishing_Fields): Disable the check for "root/base type only" fields. This is a bug fix -- if we're checking some subtype S, we don't want to reach over to the root or base type and Reinit_Field_To_Zero of that, thus modifying the field for lots of subtypes other than S. Disable in the to/from E_Void cases. Misc cleanup. * gen_il-gen-gen_entities.adb: Define First_Entity, Last_Entity, and Stored_Constraint for all type entities, because there are too many cases where Reinit_Field_To_Zero would otherwise be needed. In any case, it seems cleaner to have First_Entity and Last_Entity defined in the same entity kinds. * einfo.ads: (First_Entity, Last_Entity, Stored_Constraint): Update comments to reflect gen_il-gen-gen_entities.adb changes. (Lit_Hash): Add missing "[root type only]" comment. * exp_ch5.adb: Add Reinit_Field_To_Zero calls for vanishing fields. * sem_ch10.adb: Likewise. * sem_ch6.adb: Likewise. * sem_ch7.adb: Likewise. * sem_ch8.adb: Likewise. * sem_ch3.adb: Likewise. Also remove now-unnecessary Reinit_Field_To_Zero calls.
2023-05-15ada: Fix internal error on instance in package body with -gnatnEric Botcazou1-0/+4
This plugs a small loophole in the procedure responsible for attempting to hide entities that have been previously made public by the semantic analyzer in package bodies. gcc/ada/ * sem_ch7.adb (Hide_Public_Entities): Use the same condition for subprogram bodies without specification as for those with one.
2023-05-15ada: Remove redundant protection against empty listsPiotr Trojanek1-9/+6
Calls to First on No_List intentionally return Empty node, so explicit guards against No_List are unnecessary. Code cleanup; semantics is unaffected. gcc/ada/ * sem_util.adb (New_Copy_Tree): Remove redundant calls to Present.
2023-05-15ada: Simplify lookup of predecessor in homonym chainRonan Desplanques1-2/+1
gcc/ada/ * sem_ch8.adb (End_Scope): Simplify lookup of predecessor in homonym chain.
2023-05-15ada: Accept aggregates with OTHERS clause in unchecked type conversionsPiotr Trojanek1-0/+1
When inlining subprogram calls in GNATprove mode, the actual parameter is wrapped in an unchecked conversion. If this actual parameter is an aggregate OTHERS clause, then the type of unchecked conversion allows us to resolve this clause (just like for aggregates wrapped in a qualified expression). Previously such aggregates were rejected, which caused spurious and cryptic errors; now they are accepted. gcc/ada/ * sem_aggr.adb (Resolve_Aggregate): Accept aggregates with OTHERS appearing inside unchecked conversions.
2023-05-15ada: Emit warnings for (some) ineffective static predicate testsSteve Baird5-26/+158
Generate a warning if a static predicate tests for a value that does not belong to the parent subtype. For example, in subtype S is Positive with Static_Predicate => S not in 0 | 11 | 222; the 0 is ineffective because Positive already excludes that value. Generation of this new warning is controlled by the -gnatw_s switch, which can also be enabled via -gnatwa. gcc/ada/ * warnsw.ads: Add a new element, Warn_On_Ineffective_Predicate_Test, to the Opt_Warnings_Enum enumeration type. * warnsw.adb: Bind "-gnatw_s" to the new Warn_On_Ineffective_Predicate_Test switch. Add the new switch to the set of switches enabled by -gnata . * sem_ch13.adb (Build_Discrete_Static_Predicate): Declare new local procedure, Warn_If_Test_Ineffective, which conditionally generates new warning. Call this new procedure when building a new element of an RList. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Document the -gnatw_s switch (and the corresponding -gnatw_S switch). * gnat_ugn.texi: Regenerate.
2023-05-15ada: Update comment after SPARK RM changeYannick Moy1-1/+1
gcc/ada/ * sem_attr.adb: Update comment referring to rule number.
2023-05-15ada: Improve check of attribute referenceRonan Desplanques1-2/+4
Before this patch, the front end failed to catch many illegal uses of access attributes of task types. This patch makes referring to the access attributes of a task type raise an error, except in the current instance case defined in clause 8.6 of the reference manual. gcc/ada/ * sem_attr.adb: sem_attr.adb (Analyze_Access_Attribute): Tighten validity check for task types.
2023-05-15ada: Fix minor documentation formatting issueRonan Desplanques3-4/+12
gcc/ada/ * doc/gnat_rm/implementation_defined_characteristics.rst: Fix minor documentation formatting issue. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2023-05-15ada: Optimize 2**N to avoid explicit 'if' in modular caseBob Duff1-105/+26
The compiler usually turns 2**N into Shift_Left(1,N). This patch removes the check for "shift amount too big" in the modular case, because Shift_Left works properly in that case (i.e. if N is very large, it returns 0). This removes a redundant check on most hardware; Shift_Left takes care of large shirt amounts as necessary, even though most hardware does not. gcc/ada/ * exp_ch4.adb (Expand_N_Op_Expon): Remove the too-big check. Simplify. Signed and modular cases are combined, etc. Remove code with comment "We only handle cases where the right type is a[sic] integer", because the right operand must always be an integer at this point.
2023-05-15ada: Add Check_Error_Detected before "raise Bad_Attribute"Bob Duff1-0/+1
We shouldn't raise Bad_Attribute if there is no error. This patch adds a call to Check_Error_Detected to make sure that's true. (There are other cases where we raise Bad_Attribute; this patch doesn't try to fix them all.) gcc/ada/ * sem_attr.adb (Analyze_Attribute): Add a call to Check_Error_Detected.
2023-05-15ada: Fix handling of pragma Warnings (Toolname, Off/On)Yannick Moy1-4/+5
Pragma Warnings On/Off with a preceding toolname (which could be GNAT or GNATprove) was ignored due an error in accessing the expression of a pragma association in the parser. Now fixed. gcc/ada/ * par-prag.adb (First_Arg_Is_Matching_Tool_Name): Fix access to expression in pragma association.
2023-05-15ada: Fix invalid JSON for extended variant record with -gnatRjEric Botcazou2-9/+52
This fixes the output of -gnatRj for an extension of a tagged type which has a variant part and also deals with the case where the parent type is private with unknown discriminants. gcc/ada/ * repinfo.ads (JSON output format): Document special case of Present member of a Variant object. * repinfo.adb (List_Structural_Record_Layout): Change the type of Ext_Level parameter to Integer. Restrict the first recursion with increasing levels to the fixed part and implement a second recursion with decreasing levels for the variant part. Deal with an extension of a type with unknown discriminants.
2023-05-15ada: Fix proof of runtime unit System.Value*Claire Dross2-30/+64
Use cut operations to restore the proof of System.Value*. gcc/ada/ * libgnat/s-valueu.adb: Use cut operations inside assertion to restore proofs * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add s-spark and s-spcuop dependencies.
2023-05-15ada: Allow pragmas Annotate between loop pragmasYannick Moy1-0/+8
Pragma Annotate is now allowed between loop pragmas, in order to be able to justify separate loop checks in GNATprove. gcc/ada/ * sem_prag.adb (Check_Grouping): Allow Annotate pragmas between loop pragmas.
2023-05-15ada: INOX: prototype RFC on String InterpolationJavier Miranda3-2/+223
gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (Extensions_Allowed): Document string interpolation. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2023-05-15ada: GNAT UGN: Add section documenting PIE being enabled by default on LinuxJoel Brobecker3-106/+194
This commit updates the Linux-specific chapter to add a new section documenting the fact that PIE is enabled by default, and provides some information about the impact that this might have on some projects, as well as recommendations on how to handle issues. gcc/ada/ * doc/gnat_ugn/platform_specific_information.rst (_PIE_Enabled_By_Default_On_Linux): New section. * gnat-style.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2023-05-15ada: Skip dynamic interface conversion under native runtimeJavier Miranda1-7/+91
gcc/ada/ * exp_disp.adb (Has_Dispatching_Constructor_Call): New subprogram. (Expand_Interface_Conversion): No need to perform dynamic interface conversion when the operand and the target type are interface types and the target interface type is an ancestor of the operand type. The unique exception to this rule is when the operand has a dispatching constructor call (as documented in the sources).
2023-05-15ada: Reject attribute Initialize on unchecked unionsPiotr Trojanek1-1/+8
Attribute Initialized is expanded into Valid_Scalars, which can't work on unchecked unions, so Initialized on unchecked unions needs to be rejected before expansion. gcc/ada/ * sem_attr.adb (Analyze_Attribute): Reject attribute Initialized on unchecked unions; fix grammar in comment.
2023-05-15ada: Fix Unchecked_Conversion in edge caseRonan Desplanques1-2/+2
Before this patch, Set_Can_Use_Internal_Rep was called on access to subprogram subtypes when instantiating Unchecked_Conversion from System.Address to an access to subprogram subtype (or the reverse). This was incorrect and caused an assertion failure. This patch fixes that by modifying the Can_Use_Internal_Rep attribute of the base type of the subtype instead. gcc/ada/ * sem_ch13.adb (Validate_Unchecked_Conversion): Fix behavior on System.Address to access to subprogram subtype conversion.
2023-05-15ada: Fix link to parent when copying with Copy_Separate_TreePiotr Trojanek3-61/+71
When flag More_Ids is set on a node, then syntactic children will have their Parent link set to the last node in the chain of Mode_Ids. For example, parameter associations in declaration like: procedure P (X, Y : T); will have More_Ids set for "X", Prev_Ids set on "Y" and both will have the same node of "T" as their child. However, "T" will have only one parent, i.e. "Y". This anomaly was taken into account in New_Copy_Tree, but not in Copy_Separate_Tree. This was leading to spurious errors in check for ghost-correctness applied to copied specs. gcc/ada/ * atree.ads (Is_Syntactic_Node): Refactored from New_Copy_Tree. * atree.adb (Is_Syntactic_Node): Likewise. (Copy_Separate_Tree): Use Is_Syntactic_Node. * sem_util.adb (Has_More_Ids): Move to Atree. (Is_Syntactic_Node): Likewise.
2023-04-19Daily bump.GCC Administrator1-0/+4
2023-04-18Fixed typo.Jin Ma1-1/+1
gcc/ada * gcc-interface/utils.cc (unchecked_convert): Fixed typo.
2023-04-18Daily bump.GCC Administrator1-0/+4
2023-04-17ada: bump Library_Version to 14.Martin Liska1-1/+1
gcc/ada/ChangeLog: * gnatvsn.ads: Bump Library_Version to 14.
2023-04-16Daily bump.GCC Administrator1-0/+8
2023-04-15Fix fallout of previous change on x86/LinuxEric Botcazou1-6/+16
gcc/ada/ PR bootstrap/109510 * gcc-interface/decl.cc (gnat_to_gnu_entity) <types>: Do not reset align to zero in any case. Set TYPE_USER_ALIGN on the type only if it is an aggregate type, or else a type whose default alignment is specifically capped on selected platforms.
2023-04-15Daily bump.GCC Administrator1-0/+7
2023-04-14Fix build failure of Ada runtime for Aarch64 targetsEric Botcazou1-2/+6
The Aarch64 back-end now asserts that the main variant of scalar types has TYPE_USER_ALIGN cleared, and that's not the case for scalar types declared with a confirming alignment clause in Ada. gcc/ada/ PR bootstrap/109510 * gcc-interface/decl.cc (gnat_to_gnu_entity) <types>: Reset align to zero if its value is equal to TYPE_ALIGN and the type is scalar. Set TYPE_USER_ALIGN on the type only if align is positive.
2023-03-07Daily bump.GCC Administrator1-0/+16
2023-03-06Fix assertion failure on VSS libraryJavier Miranda1-0/+15
gcc/ada/ PR ada/108858 * sem_ch6.adb (Analyze_Subprogram_Body_Helper): For functions with separate spec, if their return type was visible through a limited- with context clause, their extra formals were not added when the spec was analyzed. Now the full view must be available, and the extra formals can be created and Returns_By_Ref computed.
2023-03-06Revert "Respect GNATMAKE Makefile variable" commitEric Botcazou2-4/+4
It breaks cross native builds. gcc/ada/ PR ada/108909 PR ada/108983 * Make-generated.in: Do not use GNATMAKE. * gcc-interface/Makefile.in: Ditto.
2023-02-27Daily bump.GCC Administrator1-0/+6
2023-02-26Respect GNATMAKE Makefile variablePeter Foley2-4/+4
gcc/ada/ PR ada/108909 * Make-generated.in: Use GNATMAKE. * gcc-interface/Makefile.in: Ditto.
2023-02-15Daily bump.GCC Administrator1-0/+10
2023-02-14Fix small regression in AdaEric Botcazou1-1/+3
gcc/ * gimplify.cc (gimplify_save_expr): Add missing guard. gcc/ada/ * gcc-interface/trans.cc (gnat_gimplify_expr): Add missing guard. gcc/testsuite/ * gnat.dg/shift2.adb: New test.
2023-02-14Fix musl build on LinuxDongsheng Song1-1/+2
The commit "ada: Add PIE support to backtraces on Linux" uses _r_debug under Linux unconditionally. It is incorrect since musl libc does not define _r_debug like glibc. gcc/ada/ * adaint.c [Linux]: Include <features.h>. (__gnat_get_executable_load_address) [Linux]: Enable only for glibc and uClibc.
2023-01-17Daily bump.GCC Administrator1-0/+98
2023-01-16ada: Update copyright years.Marc Poulhiès20-22/+20
gcc/ada/ * gcc-interface/Make-lang.in: Update copyright years. * gcc-interface/Makefile.in: Likewise. * gcc-interface/ada-builtin-types.def: Likewise. * gcc-interface/ada-builtins.def: Likewise. * gcc-interface/ada-tree.def: Likewise. * gcc-interface/ada-tree.h: Likewise. * gcc-interface/ada.h: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/cuintp.cc: Likewise. * gcc-interface/decl.cc: Likewise. * gcc-interface/gadaint.h: Likewise. * gcc-interface/gigi.h: Likewise. * gcc-interface/lang-specs.h: Likewise. * gcc-interface/lang.opt: Likewise. * gcc-interface/misc.cc: Likewise. * gcc-interface/system.ads: Likewise. * gcc-interface/targtyps.cc: Likewise. * gcc-interface/trans.cc: Likewise. * gcc-interface/utils.cc: Likewise. * gcc-interface/utils2.cc: Likewise.
2023-01-16ada: Fix typo in commentEric Botcazou1-1/+1
gcc/ada/ * exp_ch3.adb (Make_Allocator_For_Return): Fix typo in comment.
2023-01-16ada: Fix latent bug exposed by recent work on extended return statementsEric Botcazou1-3/+5
When the type of the return object is a constrained array, there may be an implicit sliding that needs to be preserved during the expansion. gcc/ada/ * exp_ch3.adb (Make_Allocator_For_Return): Convert the expression to the return object's type in the constrained array case as well.
2023-01-16ada: Fix pessimization of some CW objects initialized with function callEric Botcazou1-0/+19
The recent removal of the unconditional call to Remove_Side_Effects on the expression of an object declaration or an allocator with a class-wide type has introduced a pessimization in the former case for function calls that return a specific tagged type, because the object ultimately created on the primary stack has changed from being of a specific tagged type to being of the class-wide type, the latter type always formally requiring finalization. With the current finalization machinery, this means that a dispatching call to the Deep_Finalize routine is generated, which is unnecessary. Although this is a generic finalization issue with class-wide objects, this restores the previous behavior in this case to fix the pessimization for now. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): For a class-wide non- interface stand-alone object initialized by a function call, call Remove_Side_Effects on the expression to capture the result.
2023-01-16ada: Use static references to tag in more cases for interface objectsEric Botcazou3-93/+95
This extends the use of static references to the interface tag in more cases for (class-wide) interface objects, e.g. for initialization expressions that are qualified aggregates or nondispatching calls returning a specific tagged type implementing the interface. gcc/ada/ * exp_util.ads (Has_Tag_Of_Type): Declare. * exp_util.adb (Has_Tag_Of_Type): Move to package level. Recurse on qualified expressions. * exp_ch3.adb (Expand_N_Object_Declaration): Use a static reference to the interface tag in more cases for class-wide interface objects.