diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-25 15:02:19 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-25 15:02:19 +0000 |
commit | 1e5ec9ee3f16455cf9ab831de590217fb9b6da97 (patch) | |
tree | f7857a6dd43c7cecbaa9c1e23de6832efeed3ba3 /gcc/ada | |
parent | 0fd53ac9e79421de9b0d1f42521f15e9845983e7 (diff) | |
download | gcc-1e5ec9ee3f16455cf9ab831de590217fb9b6da97.tar.gz |
* gimplify.c (prepare_gimple_addressable): New static function.
(gimplify_modify_expr_to_memcpy): Invoke it on the RHS before marking
it addressable.
(gimplify_addr_expr): Invoke it similarly on the operand instead of
manually fiddling with it.
ada/
* gcc-interface/trans.c (call_to_gnu): Tidy.
(gnat_to_gnu) <N_Slice>: Set TYPE_ARRAY_MAX_SIZE if the slice has
non-constant size but the array itself has constant size.
* gcc-interface/utils.c (convert_vms_descriptor64): Fix type
consistency error.
(convert_vms_descriptor32): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151082 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 18 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 4 |
3 files changed, 23 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3cf2429cb06..ede9b4da101 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2009-08-25 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (call_to_gnu): Tidy. + (gnat_to_gnu) <N_Slice>: Set TYPE_ARRAY_MAX_SIZE if the slice has + non-constant size but the array itself has constant size. + * gcc-interface/utils.c (convert_vms_descriptor64): Fix type + consistency error. + (convert_vms_descriptor32): Likewise. + 2009-08-22 Aurelien Jarno <aurelien@aurel32.net> * gcc-interface/Makefile.in: Add Ada support for diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index b3a201fcc8e..7333f8c7b4b 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -2506,7 +2506,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) && (gnu_name_type = gnat_to_gnu_type (Etype (gnat_name))) && !addressable_p (gnu_name, gnu_name_type)) { - tree gnu_copy = gnu_name, gnu_temp; + tree gnu_copy = gnu_name; /* If the type is by_reference, a copy is not allowed. */ if (Is_By_Reference_Type (Etype (gnat_formal))) @@ -2569,10 +2569,10 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) /* Set up to move the copy back to the original. */ if (Ekind (gnat_formal) != E_In_Parameter) { - gnu_temp = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_copy, - gnu_name); - set_expr_location_from_node (gnu_temp, gnat_node); - append_to_statement_list (gnu_temp, &gnu_after_list); + tree stmt = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_copy, + gnu_name); + set_expr_location_from_node (stmt, gnat_node); + append_to_statement_list (stmt, &gnu_after_list); } } @@ -3889,8 +3889,8 @@ gnat_to_gnu (Node_Id gnat_node) case N_Slice: { - tree gnu_type; Node_Id gnat_range_node = Discrete_Range (gnat_node); + tree gnu_type; gnu_result = gnat_to_gnu (Prefix (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node)); @@ -3963,6 +3963,12 @@ gnat_to_gnu (Node_Id gnat_node) /* Simply return the naked low bound. */ gnu_expr = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_result_type)); + /* If this is a slice with non-constant size of an array with constant + size, set the maximum size for the allocation of temporaries. */ + if (!TREE_CONSTANT (TYPE_SIZE_UNIT (gnu_result_type)) + && TREE_CONSTANT (TYPE_SIZE_UNIT (gnu_type))) + TYPE_ARRAY_MAX_SIZE (gnu_result_type) = TYPE_SIZE_UNIT (gnu_type); + gnu_result = build_binary_op (ARRAY_RANGE_REF, gnu_result_type, gnu_result, gnu_expr); } diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index f209dcc8bdb..9748caf5463 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -3244,7 +3244,7 @@ convert_vms_descriptor64 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog) tree_cons (TREE_CHAIN (TYPE_FIELDS (template_type)), ufield, NULL_TREE)); template_tree = gnat_build_constructor (template_type, t); - template_tree = build3 (COND_EXPR, p_bounds_type, u, + template_tree = build3 (COND_EXPR, template_type, u, build_call_raise (CE_Length_Check_Failed, Empty, N_Raise_Constraint_Error), template_tree); @@ -3365,7 +3365,7 @@ convert_vms_descriptor32 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog) t = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (t)))); template_tree = build3 (COMPONENT_REF, TREE_TYPE (t), desc, t, NULL_TREE); - template_tree = build3 (COND_EXPR, p_bounds_type, u, + template_tree = build3 (COND_EXPR, TREE_TYPE (t), u, build_call_raise (CE_Length_Check_Failed, Empty, N_Raise_Constraint_Error), template_tree); |