http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60819
--- Comment #9 from rguenther at suse dot de <rguenther at suse dot de> --- On Fri, 11 Apr 2014, glisse at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60819 > > --- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> --- > (In reply to rguent...@suse.de from comment #6) > > Not exactly - it's again the wrapping that will fail. > > That seems strange to me. From the doc of may_alias: > > "Accesses through pointers to types with this attribute are not subject to > type-based alias analysis, but are instead assumed to be able to alias any > other type of objects." "This extension exists to support some vector APIs, in > which pointers to one vector type are permitted to alias pointers to a > different vector type." > > and indeed the x86 *intrin.h files cast between __m128i and __v4si (and many > other combinations) all the time. But the actual access will be that generated by the frontend via a pointer to a scalar (that doesn't have the ref-all flag set). Patch that should make your 2nd testcase work as expected: Index: gcc/c-family/c-common.c =================================================================== --- gcc/c-family/c-common.c (revision 209298) +++ gcc/c-family/c-common.c (working copy) @@ -11770,8 +11770,9 @@ convert_vector_to_pointer_for_subscript 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)); + type = build_pointer_type_for_mode (type, ptr_mode, + TYPE_REF_CAN_ALIAS_ALL (type1)); *vecp = build1 (ADDR_EXPR, type1, *vecp); *vecp = convert (type, *vecp); }