diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-01-27 18:05:59 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-01-27 18:05:59 +0000 |
commit | 33731c666114349344848ddd4218f98ef486398e (patch) | |
tree | 281d1c868cfdf5263d1e9097f609eb1abe8ad4e9 /gcc/ada | |
parent | b253f94d4f7639adea7469fb7a8481cb05f8d960 (diff) | |
download | gcc-33731c666114349344848ddd4218f98ef486398e.zip gcc-33731c666114349344848ddd4218f98ef486398e.tar.gz gcc-33731c666114349344848ddd4218f98ef486398e.tar.bz2 |
decl.c (array_type_has_nonaliased_component): Return the same value for every dimension of a multidimensional array type.
* gcc-interface/decl.c (array_type_has_nonaliased_component): Return
the same value for every dimension of a multidimensional array type.
From-SVN: r268314
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 14 |
2 files changed, 10 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6e71b25..4a14777 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-01-27 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (array_type_has_nonaliased_component): Return + the same value for every dimension of a multidimensional array type. + 2019-01-26 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/trans.c (Regular_Loop_to_gnu): Use the SLOC of the diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 4a2f6a6..a1cd694 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -6237,12 +6237,6 @@ same_discriminant_p (Entity_Id discr1, Entity_Id discr2) static bool array_type_has_nonaliased_component (tree gnu_type, Entity_Id gnat_type) { - /* If the array type is not the innermost dimension of the GNAT type, - then it has a non-aliased component. */ - if (TREE_CODE (TREE_TYPE (gnu_type)) == ARRAY_TYPE - && TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_type))) - return true; - /* If the array type has an aliased component in the front-end sense, then it also has an aliased component in the back-end sense. */ if (Has_Aliased_Components (gnat_type)) @@ -6253,15 +6247,17 @@ array_type_has_nonaliased_component (tree gnu_type, Entity_Id gnat_type) if (Is_Derived_Type (gnat_type)) { tree gnu_parent_type = gnat_to_gnu_type (Etype (gnat_type)); - int index; if (TREE_CODE (gnu_parent_type) == UNCONSTRAINED_ARRAY_TYPE) gnu_parent_type = TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_parent_type)))); - for (index = Number_Dimensions (gnat_type) - 1; index > 0; index--) - gnu_parent_type = TREE_TYPE (gnu_parent_type); return TYPE_NONALIASED_COMPONENT (gnu_parent_type); } + /* For a multi-dimensional array type, find the component type. */ + while (TREE_CODE (TREE_TYPE (gnu_type)) == ARRAY_TYPE + && TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_type))) + gnu_type = TREE_TYPE (gnu_type); + /* Consider that an array of pointers has an aliased component, which is sort of logical and helps with Taft Amendment types in LTO mode. */ if (POINTER_TYPE_P (TREE_TYPE (gnu_type))) |