https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111591
--- Comment #22 from Richard Biener <rguenth at gcc dot gnu.org> --- I see the mems properly get their base adjusted: (insn 384 383 0 (set (mem/c:V2DI (plus:DI (reg/f:DI 112 virtual-stack-vars) (const_int 16 [0x10])) [7 MEM[(struct Vec128D.30433 *)_10]+0 S16 A128]) (reg:V2DI 616)) -1 (nil)) vs. (insn 389 388 390 (set (reg:HI 619) (mem/c:HI (plus:DI (reg/f:DI 112 virtual-stack-vars) (const_int 16 [0x10])) [4 MEM[(struct Vec128D.30212 *)_10].rawD.30221[0]+0 S2 A128])) "test.cc":218:14 -1 (nil)) both are based off a fake _10. But we get alias sets 7 and 4 used here which might be a problem. See update_alias_info_with_stack_vars and uses of decls_to_pointers, in particular from set_mem_attributes_minus_bitpos where we preserve TBAA info with the rewrite. I'm not sure why that should be OK ... (but I'm sure I must have thought of this problem back in time) Does the following fix the testcase? diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc index 84b6833225e..81c0a63eddc 100644 --- a/gcc/emit-rtl.cc +++ b/gcc/emit-rtl.cc @@ -2128,7 +2128,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, tree *orig_base = &attrs.expr; while (handled_component_p (*orig_base)) orig_base = &TREE_OPERAND (*orig_base, 0); - tree aptrt = reference_alias_ptr_type (*orig_base); + tree aptrt = ptr_type_node; *orig_base = build2 (MEM_REF, TREE_TYPE (*orig_base), *namep, build_int_cst (aptrt, 0)); }