From 89bf88bfbf4fdabcd687009119e307d3de85bee1 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Sat, 7 Jul 2018 10:10:29 +0000 Subject: [PATCH] * gcc-interface/trans.c (lvalue_required_p): Remove ALIASED parameter and adjust recursive calls. (Identifier_to_gnu): Adjust calls to lvalue_required_p. (gnat_to_gnu): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262496 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/gcc-interface/trans.c | 31 ++++++++++++++----------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c5cf06c4cdd..bc353c5c52f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,12 @@ 2018-07-07 Eric Botcazou + * gcc-interface/trans.c (lvalue_required_p): Remove ALIASED parameter + and adjust recursive calls. + (Identifier_to_gnu): Adjust calls to lvalue_required_p. + (gnat_to_gnu): Likewise. + +2018-07-07 Eric Botcazou + * gcc-interface/decl.c (gnat_to_gnu_param): Minor tweak. (gnat_to_gnu_subprog_type): New pure_flag local variable. Set it for a pure Ada function with a by-ref In parameter. Propagate it onto the diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index dabf2bb8b02..e7992e8a938 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -246,7 +246,7 @@ static tree maybe_implicit_deref (tree); static void set_expr_location_from_node (tree, Node_Id, bool = false); static void set_gnu_expr_location_from_node (tree, Node_Id); static bool set_end_locus_from_node (tree, Node_Id); -static int lvalue_required_p (Node_Id, tree, bool, bool, bool); +static int lvalue_required_p (Node_Id, tree, bool, bool); static tree build_raise_check (int, enum exception_info_kind); static tree create_init_temporary (const char *, tree, tree *, Node_Id); @@ -806,8 +806,8 @@ lvalue_required_for_attribute_p (Node_Id gnat_node) is the type that will be used for GNAT_NODE in the translated GNU tree. CONSTANT indicates whether the underlying object represented by GNAT_NODE is constant in the Ada sense. If it is, ADDRESS_OF_CONSTANT indicates - whether its value is the address of a constant and ALIASED whether it is - aliased. If it isn't, ADDRESS_OF_CONSTANT and ALIASED are ignored. + whether its value is the address of another constant. If it isn't, then + ADDRESS_OF_CONSTANT is ignored. The function climbs up the GNAT tree starting from the node and returns 1 upon encountering a node that effectively requires an lvalue downstream. @@ -816,7 +816,7 @@ lvalue_required_for_attribute_p (Node_Id gnat_node) static int lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant, - bool address_of_constant, bool aliased) + bool address_of_constant) { Node_Id gnat_parent = Parent (gnat_node), gnat_temp; @@ -861,14 +861,12 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant, if (Prefix (gnat_parent) != gnat_node) return 0; - aliased |= Has_Aliased_Components (Etype (gnat_node)); return lvalue_required_p (gnat_parent, gnu_type, constant, - address_of_constant, aliased); + address_of_constant); case N_Selected_Component: - aliased |= Is_Aliased (Entity (Selector_Name (gnat_parent))); return lvalue_required_p (gnat_parent, gnu_type, constant, - address_of_constant, aliased); + address_of_constant); case N_Object_Renaming_Declaration: /* We need to preserve addresses through a renaming. */ @@ -908,7 +906,7 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant, an intermediate conversion that is meant to be purely formal. */ return lvalue_required_p (gnat_parent, get_unpadded_type (Etype (gnat_parent)), - constant, address_of_constant, aliased); + constant, address_of_constant); case N_Allocator: /* We should only reach here through the N_Qualified_Expression case. @@ -922,7 +920,7 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant, if (constant && address_of_constant) return lvalue_required_p (gnat_parent, get_unpadded_type (Etype (gnat_parent)), - true, false, true); + true, false); /* ... fall through ... */ @@ -1123,8 +1121,8 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) && !Is_Imported (gnat_temp) && Present (Address_Clause (gnat_temp))) { - require_lvalue = lvalue_required_p (gnat_node, gnu_result_type, true, - false, Is_Aliased (gnat_temp)); + require_lvalue + = lvalue_required_p (gnat_node, gnu_result_type, true, false); use_constant_initializer = !require_lvalue; } @@ -1161,7 +1159,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) else if (TREE_CODE (gnu_result) == CONST_DECL && !(DECL_CONST_ADDRESS_P (gnu_result) && lvalue_required_p (gnat_node, gnu_result_type, true, - true, false))) + true))) gnu_result = DECL_INITIAL (gnu_result); /* If it's a renaming pointer, get to the renamed object. */ @@ -1201,7 +1199,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) if ((!constant_only || address_of_constant) && require_lvalue < 0) require_lvalue = lvalue_required_p (gnat_node, gnu_result_type, true, - address_of_constant, Is_Aliased (gnat_temp)); + address_of_constant); /* Finally retrieve the initializer if this is deemed valid. */ if ((constant_only && !address_of_constant) || !require_lvalue) @@ -1217,8 +1215,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) { if (require_lvalue < 0) require_lvalue - = lvalue_required_p (gnat_node, gnu_result_type, true, false, - Is_Aliased (gnat_temp)); + = lvalue_required_p (gnat_node, gnu_result_type, true, false); if (!require_lvalue) gnu_result = fold_constant_decl_in_expr (gnu_result); } @@ -7860,7 +7857,7 @@ gnat_to_gnu (Node_Id gnat_node) || kind == N_Indexed_Component || kind == N_Selected_Component) && TREE_CODE (get_base_type (gnu_result_type)) == BOOLEAN_TYPE - && !lvalue_required_p (gnat_node, gnu_result_type, false, false, false)) + && !lvalue_required_p (gnat_node, gnu_result_type, false, false)) { gnu_result = build_binary_op (NE_EXPR, gnu_result_type, -- 2.11.4.GIT