https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109594
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:7bcdcf86e8272eeb524cc1dcb0ada8c8cfe6f27e commit r14-285-g7bcdcf86e8272eeb524cc1dcb0ada8c8cfe6f27e Author: Richard Biener <rguent...@suse.de> Date: Mon Apr 24 13:20:25 2023 +0200 tree-optimization/109594 - wrong register promotion We fail to verify the constraints under which we allow handled components to wrap registers. The gcc.dg/pr70022.c testcase shows that we happily end up with _2 = VIEW_CONVERT_EXPR<int[4]>(v_1(D)) as produced by SSA rewrite and update_address_taken. But the intent was that we wrap registers with at most a single level of handled components and specifically only allow __real, __imag, BIT_FIELD_REF and VIEW_CONVERT_EXPR on them, but not ARRAY_REF or COMPONENT_REF. Together with the improved gimple_load predicate taking advantage of the above and ASAN this eventually ICEd. The following fixes update_address_taken as to this constraint. PR tree-optimization/109594 * tree-ssa.cc (non_rewritable_mem_ref_base): Constrain what we rewrite to a register based on the above.