On Mon, Jan 29, 2024 at 01:17:16PM +0100, Jakub Jelinek wrote: > On Mon, Jan 29, 2024 at 01:05:51PM +0100, Richard Biener wrote: > > The following implements storing to a non-MEM_P with a variable > > offset. We usually avoid this by forcing expansion to memory but > > this doesn't work for hard register variables. The solution is > > to spill and operate on the stack. > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu, OK? > > > > I realize the flow is a bit awkward, but short of duplicating a lot > > of code I can't see a better way. Forcing some lowering on GIMPLE > > (creating the copy there) might be another away. But then we > > could possibly lower the whole vector indexing in a different way > > in the first place ... > > > > Thanks, > > Richard. > > > > PR middle-end/113622 > > * expr.cc (expand_assignment): Spill hard registers if > > we index them with a variable offset. > > > > * gcc.target/i386/pr113622-2.c: New testcase. > > * gcc.target/i386/pr113622-3.c: Likewise. > > Ok, thanks.
Actually, better to do gcc_assert (VAR_P (tem) && DECL_HARD_REGISTER (tem)); Again, nothing guarantees tem is a VAR_DECL. Though, with tree checking it would either ICE for DECL_HARD_REGISTER (tem) being false on a VAR_DECL, or in checking on tem not being a VAR_DECL. But say with release checking it will do a weird thing. Jakub