ada: Small cleanups and fixes in expansion of aggregates This streamlines the handling of qualified expressions in the expansion of aggregates and plugs a couple of loopholes that may cause memory leaks. gcc/ada/ * exp_aggr.adb (Build_Array_Aggr_Code): Move the declaration of Typ to the beginning. (Initialize_Array_Component): Test the unqualified version of the expression for the nested array case. (Initialize_Ctrl_Array_Component): Do not duplicate the expression here. Do the pattern matching of the unqualified version of it. (Gen_Assign): Call Unqualify to compute Expr_Q and use Expr_Q in subsequent pattern matching. (Initialize_Ctrl_Record_Component): Do the pattern matching of the unqualified version of the aggregate. (Build_Record_Aggr_Code): Call Unqualify. (Convert_Aggr_In_Assignment): Likewise. (Convert_Aggr_In_Object_Decl): Likewise. (Component_OK_For_Backend): Likewise. (Is_Delayed_Aggregate): Likewise.
ada: Small cleanups and fixes in expansion of aggregates
ada: Fix internal error on array constant in expression function
ada: Fix internal error on array constant in expression function This happens when the peculiar check emitted by Check_Large_Modular_Array is applied to an object whose actual subtype is an itype with dynamic size, because the first reference to the itype in the expanded code may turn out to be within the raise statement, which is problematic for the eloboration of this itype by the code generator at library level. gcc/ada/ * freeze.adb (Check_Large_Modular_Array): Fix head comment, use Standard_Long_Long_Integer_Size directly and generate a reference just before the raise statement if the Etype of the object is an itype declared in an open scope.
ada: Fix fallout of recent fix for missing finalization
ada: Fix fallout of recent fix for missing finalization The original fix makes it possible to create transient scopes around return statements in more cases, but it overlooks that transient scopes are reused and, in particular, that they can be promoted to secondary stack management. gcc/ada/ * exp_ch7.adb (Find_Enclosing_Transient_Scope): Return the index in the scope table instead of the scope's entity. (Establish_Transient_Scope): If an enclosing scope already exists, do not set the Uses_Sec_Stack flag on it if the node to be wrapped is a return statement which requires secondary stack management.
ada: Fix wrong expansion of array aggregate with noncontiguous choices
ada: Fix wrong expansion of array aggregate with noncontiguous choices This extends an earlier fix done for the others choice of an array aggregate to all the choices of the aggregate, since the same sharing issue may happen when the choices are not contiguous. gcc/ada/ * exp_aggr.adb (Build_Array_Aggr_Code.Get_Assoc_Expr): Duplicate the expression here instead of... (Build_Array_Aggr_Code): ...here.
ada: Fix wrong access for qualified aggregate with storage model
ada: Fix wrong access for qualified aggregate with storage model The previous fix to get_storage_model_access was incomplete and needs to be extended to the node itself. gcc/ada/ * gcc-interface/trans.cc (get_storage_model_access): Also strip any type conversion in the node when unwinding the components.
ada: Add System.Traceback.Symbolic.Module_Name support on AArch64 Linux
ada: Add System.Traceback.Symbolic.Module_Name support on AArch64 Linux This commit changes the runtime on aarch64-linux to use the Linux version of s-tsmona.adb, so as to add support for this functionality on aarch64-linux. gcc/ada/ * Makefile.rtl: Use libgnat/s-tsmona__linux.adb on aarch64-linux. Link libgnat with -ldl, as the use of s-tsmona__linux.adb requires it.
ada: Fix minor issues in user's guide
ada: Fix minor issues in user's guide gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix minor issues. * doc/gnat_ugn/the_gnat_compilation_model.rst: Fix minor issues. * gnat_ugn.texi: Regenerate.
ada: Only build access-to-subprogram wrappers when expander is active
ada: Only build access-to-subprogram wrappers when expander is active For access-to-subprogram types with Pre/Post aspects we create a wrapper routine that evaluates these aspects. Spec of this wrapper was created always, while its body was only created when expansion was enabled. Now we only create these wrappers when expansion is enabled. In particular, we don't create them in GNATprove mode; instead, GNATprove picks the Pre/Post expressions directly from the aspects. gcc/ada/ * exp_ch3.adb (Build_Access_Subprogram_Wrapper_Body): Build wrapper body if requested by routine that builds wrapper spec. * sem_ch3.adb (Analyze_Full_Type_Declaration): Only build wrapper when expander is active. (Build_Access_Subprogram_Wrapper): Remove special-case for GNATprove.
ada: Fix internal error on qualified aggregate with storage model
ada: Fix internal error on qualified aggregate with storage model It comes from a small oversight in get_storage_model_access. gcc/ada/ * gcc-interface/trans.cc (node_is_component): Remove parentheses. (node_is_type_conversion): New predicate. (get_atomic_access): Use it. (get_storage_model_access): Likewise and look into the parent to find a component if it returns true. (present_in_lhs_or_actual_p): Likewise.
ada: Add missing guards for degenerate storage models
ada: Add missing guards for degenerate storage models gcc/ada/ * gcc-interface/trans.cc (Attribute_to_gnu) <Attr_Size>: Check that the storage model has Copy_From before instantiating loads for it. <Attr_Length>: Likewise. <Attr_Bit_Position>: Likewise. (gnat_to_gnu) <N_Indexed_Component>: Likewise. <N_Slice>: Likewise.
ada: Fix incorrect copies being used with 'Address
ada: Fix incorrect copies being used with 'Address When using 'Address on an object with a size clause, gigi would end up creating a copy and using its address instead of the one of the original object, leading to incorrect behavior. Remove the conversion (that triggers the copy) when 'Address is applied to a declaration. gcc/ada/ * gcc-interface/trans.cc (Attribute_to_gnu): Also strip conversion in case of DECL.
ada: Fix bogus Storage_Error on dynamic array with static zero length
ada: Fix bogus Storage_Error on dynamic array with static zero length This works around the limitations present for the support of arrays in the middle-end by clearing the TREE_OVERFLOW flag for arrays with zero length. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Type>: Use a local variable for the GNAT index type. <E_Array_Subtype>: Likewise. Call Is_Null_Range on the bounds and force the zero on TYPE_SIZE and TYPE_SIZE_UNIT if it returns true.
ada: Fix minor issue with Mod operator
ada: Minor generic tweaks left and and right
ada: Minor generic tweaks left and and right No functional changes. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Replace integer_zero_node with null_pointer_node for pointer types. * gcc-interface/trans.cc (gnat_gimplify_expr) <NULL_EXPR>: Likewise. * gcc-interface/utils.cc (maybe_pad_type): Do not attempt to make a packable type from a fat pointer type. * gcc-interface/utils2.cc (build_atomic_load): Use a local variable. (build_atomic_store): Likewise.
ada: Make internal_error_function more robust
ada: Adjust again the implementation of storage models
ada: Adjust again the implementation of storage models The code generator must now be prepared to translate assignment statements to objects allocated with a storage model and that are not initialized yet. gcc/ada/ * gcc-interface/trans.cc (Attribute_to_gnu) <Attr_Size>: Tweak. (gnat_to_gnu) <N_Assignment_Statement>: Declare a local variable. For a target with a storage model, use the Actual_Designated_Subtype to compute the size if it is present.
ada: Simplify the implementation of storage models
ada: Simplify the implementation of storage models As the additional temporaries required by the semantics of nonnative storage models are now created by the front-end, in particular for actual parameters and assignment statements, the corresponding code in gigi can be removed. gcc/ada/ * gcc-interface/trans.cc (Call_to_gnu): Remove code implementing the by-copy semantics for actuals with nonnative storage models. (gnat_to_gnu) <N_Assignment_Statement>: Remove code instantiating a temporary for assignments between nonnative storage models.
ada: Make use of Cannot_Be_Superflat flag on N_Range nodes
ada: Make use of Cannot_Be_Superflat flag on N_Range nodes gcc/ada/ * gcc-interface/decl.cc (range_cannot_be_superflat): Return true immediately if Cannot_Be_Superflat is set. * gcc-interface/misc.cc (gnat_post_options): Do not override the -Wstringop-overflow setting.