diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-08-30 14:44:50 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-08-30 14:44:50 +0000 |
commit | e5969b734db1e79e295372588ee2d5e6731d9713 (patch) | |
tree | e5d4fcc2cf812aaaca70d32c45f3f96c02f4f3ac /gcc | |
parent | 37cf9302639271ff141d2ff7b4e29e60a401785c (diff) | |
download | gcc-e5969b734db1e79e295372588ee2d5e6731d9713.zip gcc-e5969b734db1e79e295372588ee2d5e6731d9713.tar.gz gcc-e5969b734db1e79e295372588ee2d5e6731d9713.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 29 |
2 files changed, 21 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5f004a9..463a47a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 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 also if List_Representation_Info is greater than 3. diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index c6942fe..0202576 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -3953,27 +3953,30 @@ build_template (tree template_type, tree array_type, tree expr) && TYPE_HAS_ACTUAL_BOUNDS_P (array_type))) bound_list = TYPE_ACTUAL_BOUNDS (array_type); - /* First make the list for a CONSTRUCTOR for the template. Go down the - field list of the template instead of the type chain because this - array might be an Ada array of arrays and we can't tell where the - nested arrays stop being the underlying object. */ - - for (field = TYPE_FIELDS (template_type); field; - (bound_list - ? (bound_list = TREE_CHAIN (bound_list)) - : (array_type = TREE_TYPE (array_type))), + /* First make the list for a CONSTRUCTOR for the template. Go down + the field list of the template instead of the type chain because + this array might be an Ada array of array and we can't tell where + the nested array stop being the underlying object. */ + for (field = TYPE_FIELDS (template_type); + field; field = DECL_CHAIN (DECL_CHAIN (field))) { tree bounds, min, max; /* If we have a bound list, get the bounds from there. Likewise 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. - This will give us a maximum range. */ + DECL_BY_COMPONENT_PTR_P, use the bounds of the field in the + template, but this will only give us a maximum range. */ 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) - 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 && DECL_BY_COMPONENT_PTR_P (expr)) bounds = TREE_TYPE (field); |