On Tue, Jan 28, 2025 at 04:26:11PM +0100, Richard Biener wrote: > The following fixes a not properly aligned stack temporary created > during RTL expansion of a MEM_REF that we handle as a BIT_FIELD_REF > whose base was allocated to a register but which was originally > aligned to allow a larger load not trapping. While probably UB > in C the vectorizer creates aligned accesses that might overread > a (static) allocation because it is then known not to trap. > > Bootstrapped and tested on x86_64-unknown-linux-gnu. > > This came originally up in the context of PR117424 and would > re-surface when the tree_could_trap_p fix would take into > account alignment as well. > > OK? > > Thanks, > Richard. > > PR middle-end/118684 > * expr.cc (expand_expr_real_1): When expanding a reference > based on a register and we end up needing a MEM make sure > that's aligned as the original reference required. > > * gcc.dg/pr118684.c: New testcase.
LGTM. Jakub