Daily bump.
7 March 2023 at 00:16
Fix assertion failure on VSS library 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.
Fix musl build on Linux 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.
ada: Fix latent bug exposed by recent work on extended return statements 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.
ada: Fix pessimization of some CW objects initialized with function call 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.
ada: Use static references to tag in more cases for interface objects 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.
ada: Fix premature finalization of temporaries for interface objects This restores the proper finalization of temporaries for interface objects in the case where the initializing expression is not of an interface type. It turns out that neither Is_Temporary_For_Interface_Object nor its previous incarnation are sufficient to catch all the various cases, so it is replaced by a small enhancement to Is_Aliased, which is more robust. gcc/ada/ * exp_util.adb (Is_Temporary_For_Interface_Object): Delete. (Is_Finalizable_Transient.Is_Aliased): Deal with the specific case of temporaries generated for interface objects.
ada: Update copyright years. 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.
ada: Further optimize interface objects initialized with function calls This further optimizes the usual case of (class-wide) interface objects that are initialized with calls to functions whose result type is the type of the objects (this is not necessary as any result type implementing the interface would do) by avoiding a back-and-forth displacement of the objects' address. This exposed a latent issue whereby the displacement was missing in the case of a simple return statement whose expression is a call to a function whose result type is a specific tagged type that needs finalization. And, in order to avoid pessimizing the expanded code, this in turn required avoiding to create temporaries for allocators by calling Remove_Side_Effects up front, in the common cases when they are not necessary. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Do not generate a back- and-forth displacement of the object's address when using a renaming for an interface object with an expression of the same type. * exp_ch4.adb (Expand_Allocator_Expression): Do not remove the side effects of the expression up front for the simple allocators. Do not call the Adjust primitive if the expression is a function call. * exp_ch6.adb (Expand_Ctrl_Function_Call): Do not expand the call unnecessarily for a special return object. (Expand_Simple_Function_Return): Restore the displacement of the return object's address in the case where the expression is the call to a function whose result type is a type that needs finalization. * exp_util.adb (Expand_Subtype_From_Expr): Do not remove the side effects of the expression before calling Make_Subtype_From_Expr. (Make_CW_Equivalent_Type): If the expression has the tag of its type and this type has a uniform size, use 'Object_Size of this type in lieu of 'Size of the expression to compute the expression's size.
ada: Lift restriction on optimization of aliased objects It turns out that the only blocking case is an aliased object whose nominal subtype is an unconstrained array because the bounds must be allocated. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Also optimize aliased objects if their nominal subtype is not an unconstrained array.