Add missing hunk for previous patch.
From-SVN: r158467
This commit is contained in:
parent
728936bb92
commit
b6c056fe9f
@ -1889,55 +1889,59 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|
|||||||
char field_name[16];
|
char field_name[16];
|
||||||
tree gnu_index_base_type
|
tree gnu_index_base_type
|
||||||
= get_unpadded_type (Base_Type (Etype (gnat_index)));
|
= get_unpadded_type (Base_Type (Etype (gnat_index)));
|
||||||
tree gnu_low_field, gnu_high_field, gnu_low, gnu_high, gnu_max;
|
tree gnu_lb_field, gnu_hb_field, gnu_orig_min, gnu_orig_max;
|
||||||
|
tree gnu_min, gnu_max, gnu_high;
|
||||||
|
|
||||||
/* Make the FIELD_DECLs for the low and high bounds of this
|
/* Make the FIELD_DECLs for the low and high bounds of this
|
||||||
type and then make extractions of these fields from the
|
type and then make extractions of these fields from the
|
||||||
template. */
|
template. */
|
||||||
sprintf (field_name, "LB%d", index);
|
sprintf (field_name, "LB%d", index);
|
||||||
gnu_low_field = create_field_decl (get_identifier (field_name),
|
gnu_lb_field = create_field_decl (get_identifier (field_name),
|
||||||
gnu_index_base_type,
|
gnu_index_base_type,
|
||||||
gnu_template_type, 0,
|
gnu_template_type, 0,
|
||||||
NULL_TREE, NULL_TREE, 0);
|
NULL_TREE, NULL_TREE, 0);
|
||||||
Sloc_to_locus (Sloc (gnat_entity),
|
Sloc_to_locus (Sloc (gnat_entity),
|
||||||
&DECL_SOURCE_LOCATION (gnu_low_field));
|
&DECL_SOURCE_LOCATION (gnu_lb_field));
|
||||||
|
|
||||||
field_name[0] = 'U';
|
field_name[0] = 'U';
|
||||||
gnu_high_field = create_field_decl (get_identifier (field_name),
|
gnu_hb_field = create_field_decl (get_identifier (field_name),
|
||||||
gnu_index_base_type,
|
gnu_index_base_type,
|
||||||
gnu_template_type, 0,
|
gnu_template_type, 0,
|
||||||
NULL_TREE, NULL_TREE, 0);
|
NULL_TREE, NULL_TREE, 0);
|
||||||
Sloc_to_locus (Sloc (gnat_entity),
|
Sloc_to_locus (Sloc (gnat_entity),
|
||||||
&DECL_SOURCE_LOCATION (gnu_high_field));
|
&DECL_SOURCE_LOCATION (gnu_hb_field));
|
||||||
|
|
||||||
gnu_temp_fields[index] = chainon (gnu_low_field, gnu_high_field);
|
gnu_temp_fields[index] = chainon (gnu_lb_field, gnu_hb_field);
|
||||||
|
|
||||||
/* We can't use build_component_ref here since the template type
|
/* We can't use build_component_ref here since the template type
|
||||||
isn't complete yet. */
|
isn't complete yet. */
|
||||||
gnu_low = build3 (COMPONENT_REF, gnu_index_base_type,
|
gnu_orig_min = build3 (COMPONENT_REF, gnu_index_base_type,
|
||||||
gnu_template_reference, gnu_low_field,
|
gnu_template_reference, gnu_lb_field,
|
||||||
NULL_TREE);
|
NULL_TREE);
|
||||||
gnu_high = build3 (COMPONENT_REF, gnu_index_base_type,
|
gnu_orig_max = build3 (COMPONENT_REF, gnu_index_base_type,
|
||||||
gnu_template_reference, gnu_high_field,
|
gnu_template_reference, gnu_hb_field,
|
||||||
NULL_TREE);
|
NULL_TREE);
|
||||||
TREE_READONLY (gnu_low) = TREE_READONLY (gnu_high) = 1;
|
TREE_READONLY (gnu_orig_min) = TREE_READONLY (gnu_orig_max) = 1;
|
||||||
|
|
||||||
/* Compute the size of this dimension. */
|
gnu_min = convert (sizetype, gnu_orig_min);
|
||||||
gnu_max
|
gnu_max = convert (sizetype, gnu_orig_max);
|
||||||
= build3 (COND_EXPR, gnu_index_base_type,
|
|
||||||
build2 (GE_EXPR, boolean_type_node, gnu_high, gnu_low),
|
/* Compute the size of this dimension. See the E_Array_Subtype
|
||||||
gnu_high,
|
case below for the rationale. */
|
||||||
build2 (MINUS_EXPR, gnu_index_base_type,
|
gnu_high
|
||||||
gnu_low, fold_convert (gnu_index_base_type,
|
= build3 (COND_EXPR, sizetype,
|
||||||
integer_one_node)));
|
build2 (GE_EXPR, boolean_type_node,
|
||||||
|
gnu_orig_max, gnu_orig_min),
|
||||||
|
gnu_max,
|
||||||
|
size_binop (MINUS_EXPR, gnu_min, size_one_node));
|
||||||
|
|
||||||
/* Make a range type with the new range in the Ada base type.
|
/* Make a range type with the new range in the Ada base type.
|
||||||
Then make an index type with the size range in sizetype. */
|
Then make an index type with the size range in sizetype. */
|
||||||
gnu_index_types[index]
|
gnu_index_types[index]
|
||||||
= create_index_type (convert (sizetype, gnu_low),
|
= create_index_type (gnu_min, gnu_high,
|
||||||
convert (sizetype, gnu_max),
|
|
||||||
create_range_type (gnu_index_base_type,
|
create_range_type (gnu_index_base_type,
|
||||||
gnu_low, gnu_high),
|
gnu_orig_min,
|
||||||
|
gnu_orig_max),
|
||||||
gnat_entity);
|
gnat_entity);
|
||||||
|
|
||||||
/* Update the maximum size of the array in elements. */
|
/* Update the maximum size of the array in elements. */
|
||||||
@ -2209,6 +2213,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|
|||||||
size_binop (MINUS_EXPR, gnu_min,
|
size_binop (MINUS_EXPR, gnu_min,
|
||||||
size_one_node));
|
size_one_node));
|
||||||
|
|
||||||
|
/* Reuse the index type for the range type. Then make an index
|
||||||
|
type with the size range in sizetype. */
|
||||||
gnu_index_types[index]
|
gnu_index_types[index]
|
||||||
= create_index_type (gnu_min, gnu_high, gnu_index_type,
|
= create_index_type (gnu_min, gnu_high, gnu_index_type,
|
||||||
gnat_entity);
|
gnat_entity);
|
||||||
|
Loading…
Reference in New Issue
Block a user