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/gcc-interface | |
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/gcc-interface')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 14 |
1 files changed, 5 insertions, 9 deletions
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))) |