aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/c-family/c-common.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-05-17 17:03:43 -0700
committerBen Cheng <bccheng@google.com>2014-05-17 17:12:35 -0700
commit8c493ead6366b552adee796de296936b78f34c5a (patch)
tree4936e52fb9b84edbcd9293bd321027413d1835bf /gcc-4.9/gcc/c-family/c-common.c
parent9750bde7e561731ce8a07cdbd0165a688e74a696 (diff)
downloadtoolchain_gcc-8c493ead6366b552adee796de296936b78f34c5a.tar.gz
toolchain_gcc-8c493ead6366b552adee796de296936b78f34c5a.tar.bz2
toolchain_gcc-8c493ead6366b552adee796de296936b78f34c5a.zip
[4.9] Refresh GCC 4.9 to the 20140514 snapshot.
For critical bug fixes including devirtualization and codegen. Change-Id: I8138d3dc408fc12db5eecb01d2753d39219712f2
Diffstat (limited to 'gcc-4.9/gcc/c-family/c-common.c')
-rw-r--r--gcc-4.9/gcc/c-family/c-common.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc-4.9/gcc/c-family/c-common.c b/gcc-4.9/gcc/c-family/c-common.c
index 03731b4b8..f7f2bb3e3 100644
--- a/gcc-4.9/gcc/c-family/c-common.c
+++ b/gcc-4.9/gcc/c-family/c-common.c
@@ -11770,8 +11770,21 @@ convert_vector_to_pointer_for_subscript (location_t loc,
c_common_mark_addressable_vec (*vecp);
type = build_qualified_type (TREE_TYPE (type), TYPE_QUALS (type));
- type = build_pointer_type (type);
type1 = build_pointer_type (TREE_TYPE (*vecp));
+ bool ref_all = TYPE_REF_CAN_ALIAS_ALL (type1);
+ if (!ref_all
+ && !DECL_P (*vecp))
+ {
+ /* If the original vector isn't declared may_alias and it
+ isn't a bare vector look if the subscripting would
+ alias the vector we subscript, and if not, force ref-all. */
+ alias_set_type vecset = get_alias_set (*vecp);
+ alias_set_type sset = get_alias_set (type);
+ if (!alias_sets_must_conflict_p (sset, vecset)
+ && !alias_set_subset_of (sset, vecset))
+ ref_all = true;
+ }
+ type = build_pointer_type_for_mode (type, ptr_mode, ref_all);
*vecp = build1 (ADDR_EXPR, type1, *vecp);
*vecp = convert (type, *vecp);
}