From 8c493ead6366b552adee796de296936b78f34c5a Mon Sep 17 00:00:00 2001 From: Ben Cheng Date: Sat, 17 May 2014 17:03:43 -0700 Subject: [4.9] Refresh GCC 4.9 to the 20140514 snapshot. For critical bug fixes including devirtualization and codegen. Change-Id: I8138d3dc408fc12db5eecb01d2753d39219712f2 --- gcc-4.9/gcc/c-family/c-common.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'gcc-4.9/gcc/c-family/c-common.c') 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); } -- cgit v1.2.3