From e6695318f92193af6ddccc88d40b10c0eddec9f0 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Sun, 17 May 2015 18:08:11 +0000 Subject: [PATCH] * varasm.c (compare_constant) : Compare TYPE_REVERSE_STORAGE_ORDER. ada/ * gcc-interface/utils.c (gnat_types_compatible_p): Take into account the scalar storage order for array types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/scalar-storage-order@223271 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/gcc-interface/utils.c | 5 +++-- gcc/varasm.c | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index ac39dad819e..063d34c7224 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -3385,7 +3385,7 @@ gnat_types_compatible_p (tree t1, tree t2) return 1; /* Array types are also compatible if they are constrained and have the same - domain(s) and the same component type. */ + domain(s), the same component type and the same scalar storage order. */ if (code == ARRAY_TYPE && (TYPE_DOMAIN (t1) == TYPE_DOMAIN (t2) || (TYPE_DOMAIN (t1) @@ -3396,7 +3396,8 @@ gnat_types_compatible_p (tree t1, tree t2) TYPE_MAX_VALUE (TYPE_DOMAIN (t2))))) && (TREE_TYPE (t1) == TREE_TYPE (t2) || (TREE_CODE (TREE_TYPE (t1)) == ARRAY_TYPE - && gnat_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2))))) + && gnat_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2)))) + && TYPE_REVERSE_STORAGE_ORDER (t1) == TYPE_REVERSE_STORAGE_ORDER (t2)) return 1; return 0; diff --git a/gcc/varasm.c b/gcc/varasm.c index e336c891e2b..5f22f4f2494 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -3148,10 +3148,12 @@ compare_constant (const tree t1, const tree t2) if (typecode == ARRAY_TYPE) { HOST_WIDE_INT size_1 = int_size_in_bytes (TREE_TYPE (t1)); - /* For arrays, check that the sizes all match. */ + /* For arrays, check that mode, size and storage order match. */ if (TYPE_MODE (TREE_TYPE (t1)) != TYPE_MODE (TREE_TYPE (t2)) || size_1 == -1 - || size_1 != int_size_in_bytes (TREE_TYPE (t2))) + || size_1 != int_size_in_bytes (TREE_TYPE (t2)) + || TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (t1)) + != TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (t2))) return 0; } else -- 2.11.4.GIT