Commit e5969b73 by Eric Botcazou Committed by Eric Botcazou

utils.c (build_template): Deal with parameters passed by pointer to component of…

utils.c (build_template): Deal with parameters passed by pointer to component of multi-dimensional arrays.

	* gcc-interface/utils.c (build_template): Deal with parameters
	passed by pointer to component of multi-dimensional arrays.

From-SVN: r275190
parent 37cf9302
2019-08-30 Eric Botcazou <ebotcazou@adacore.com> 2019-08-30 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (build_template): Deal with parameters
passed by pointer to component of multi-dimensional arrays.
2019-08-30 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (annotate_value) <CALL_EXPR>: Inline the call * gcc-interface/decl.c (annotate_value) <CALL_EXPR>: Inline the call
also if List_Representation_Info is greater than 3. also if List_Representation_Info is greater than 3.
......
...@@ -3953,27 +3953,30 @@ build_template (tree template_type, tree array_type, tree expr) ...@@ -3953,27 +3953,30 @@ build_template (tree template_type, tree array_type, tree expr)
&& TYPE_HAS_ACTUAL_BOUNDS_P (array_type))) && TYPE_HAS_ACTUAL_BOUNDS_P (array_type)))
bound_list = TYPE_ACTUAL_BOUNDS (array_type); bound_list = TYPE_ACTUAL_BOUNDS (array_type);
/* First make the list for a CONSTRUCTOR for the template. Go down the /* First make the list for a CONSTRUCTOR for the template. Go down
field list of the template instead of the type chain because this the field list of the template instead of the type chain because
array might be an Ada array of arrays and we can't tell where the this array might be an Ada array of array and we can't tell where
nested arrays stop being the underlying object. */ the nested array stop being the underlying object. */
for (field = TYPE_FIELDS (template_type);
for (field = TYPE_FIELDS (template_type); field; field;
(bound_list
? (bound_list = TREE_CHAIN (bound_list))
: (array_type = TREE_TYPE (array_type))),
field = DECL_CHAIN (DECL_CHAIN (field))) field = DECL_CHAIN (DECL_CHAIN (field)))
{ {
tree bounds, min, max; tree bounds, min, max;
/* If we have a bound list, get the bounds from there. Likewise /* If we have a bound list, get the bounds from there. Likewise
for an ARRAY_TYPE. Otherwise, if expr is a PARM_DECL with for an ARRAY_TYPE. Otherwise, if expr is a PARM_DECL with
DECL_BY_COMPONENT_PTR_P, use the bounds of the field in the template. DECL_BY_COMPONENT_PTR_P, use the bounds of the field in the
This will give us a maximum range. */ template, but this will only give us a maximum range. */
if (bound_list) if (bound_list)
{
bounds = TREE_VALUE (bound_list); bounds = TREE_VALUE (bound_list);
bound_list = TREE_CHAIN (bound_list);
}
else if (TREE_CODE (array_type) == ARRAY_TYPE) else if (TREE_CODE (array_type) == ARRAY_TYPE)
{
bounds = TYPE_INDEX_TYPE (TYPE_DOMAIN (array_type)); bounds = TYPE_INDEX_TYPE (TYPE_DOMAIN (array_type));
array_type = TREE_TYPE (array_type);
}
else if (expr && TREE_CODE (expr) == PARM_DECL else if (expr && TREE_CODE (expr) == PARM_DECL
&& DECL_BY_COMPONENT_PTR_P (expr)) && DECL_BY_COMPONENT_PTR_P (expr))
bounds = TREE_TYPE (field); bounds = TREE_TYPE (field);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment