]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end/118695 - missed misalign handling in MEM_REF expansion
authorRichard Biener <rguenther@suse.de>
Thu, 30 Jan 2025 10:22:37 +0000 (11:22 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 30 Jan 2025 12:05:37 +0000 (13:05 +0100)
commit9ba2de71815c0ea6cc940ecb50af7cc1a84579f7
tree8d96196c314af8f5b75c71c225b64eeee1615855
parent34d8c842b8d12c69b9335f1b63453920f056e6e1
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.
gcc/expr.cc
gcc/testsuite/gcc.dg/pr118695.c [new file with mode: 0644]