https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118695
--- Comment #11 from GCC 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:9ba2de71815c0ea6cc940ecb50af7cc1a84579f7 commit r15-7287-g9ba2de71815c0ea6cc940ecb50af7cc1a84579f7 Author: Richard Biener <rguent...@suse.de> Date: Thu Jan 30 11:22:37 2025 +0100 middle-end/118695 - missed misalign handling in MEM_REF expansion When MEM_REF expansion of a non-MEM falls back to a stack temporary we fail to handle the case where the offset adjusted reference to the temporary is not aligned according to the requirement of the mode. We have to go through bitfield extraction or movmisalign in this case. Fortunately there's a helper for this. This fixes an ICE observed on arm which has sanity checks in its move patterns for this. PR middle-end/118695 * expr.cc (expand_expr_real_1): When expanding a MEM_REF to a non-MEM by committing it to a stack temporary make sure to handle misaligned accesses correctly. * gcc.dg/pr118695.c: New testcase.