https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101849
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- If you are using build_simple_mem_ref then the pointer type has to be "correct", but you can simply build the MEM_REF with build2 giving it the desired access type - the pointer type is irrelevant. Note the TBAA relevant alias set is represented in the offset operand.