On Tue, Dec 05, 2023 at 02:11:27PM +0100, Richard Biener wrote: > The following avoids turning aggregate copy involving non-default > address-spaces to memcpy since that is not prepared for that. > > GIMPLE verification no longer accepts WITH_SIZE_EXPR in aggregate > copies, the following re-allows that for the RHS. I also needed > to adjust one assert in DCE. > > get_memory_address is used for string builtin expansion, so instead > of fixing that up for non-generic address-spaces I've put an assert > there. > > I'll note that the same issue exists for initialization from an > empty CTOR which we gimplify to a memset call but since we are > not prepared to handle RTL expansion of the original VLA init and > I failed to provide test coverage (without extending the GNU C > extension for VLA structs) and the Ada frontend (or other frontends) > to not have address-space support the patch instead asserts we only > see generic address-spaces there. > > Bootstrapped and tested on x86_64-unknown-linux-gnu for all languages. > > OK? > > Thanks, > Richard. > > PR middle-end/112830 > * gimplify.cc (gimplify_modify_expr): Avoid turning aggregate > copy of non-generic address-spaces to memcpy. > (gimplify_modify_expr_to_memcpy): Assert we are dealing with > a copy inside the generic address-space. > (gimplify_modify_expr_to_memset): Likewise. > * tree-cfg.cc (verify_gimple_assign_single): Allow > WITH_SIZE_EXPR as part of the RHS of an assignment. > * builtins.cc (get_memory_address): Assert we are dealing > with the generic address-space. > > * gcc.target/avr/pr112830.c: New testcase. > * gcc.target/i386/pr112830.c: Likewise.
LGTM. Jakub