https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121105
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Dominic Plunkett <[email protected]>: https://gcc.gnu.org/g:ea7aa335f1708a0f7cac26042bb6b8e2835cf87f commit r17-6360-gea7aa335f1708a0f7cac26042bb6b8e2835cf87f Author: Dominic P <[email protected]> Date: Fri Oct 9 17:49:51 2026 +0100 expr: Clear an empty constructor of a poly-sized type [PR121105] expand_constructor passed int_expr_size to store_constructor, which is -1 for a type whose size is a POLY_INT_CST. The RECORD_TYPE case then skipped clear_storage, so an empty CONSTRUCTOR of an SVE or RVV tuple type stored nothing: a register target got only a clobber and a memory target was left unchanged. Pass the poly size instead; only types with a POLY_INT_CST size are affected. store_constructor now asserts that SIZE is nonnegative, so an unknown size from any caller ICEs instead of leaving the object uninitialized. Bootstrapped and regression tested on x86_64-pc-linux-gnu, including Ada. On aarch64-linux-gnu (qemu), regression tested dg.exp, aarch64.exp and the SVE tests at SVE VL128, and the SVE tests at VL2048. On riscv64, compiling gcc.target/riscv/rvv/base changes the asm of the new test only. Assisted-by: Claude Opus 5 (Anthropic) PR middle-end/121105 gcc/ChangeLog: * expr.cc (store_constructor): Assert that SIZE is nonnegative. Drop the then-redundant known_size_p check. (expand_constructor): Pass the poly_int64 size of the type to store_constructor. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/pr121105_1.c: New test. * gcc.target/aarch64/sve/pr121105_2.c: New test. * g++.target/aarch64/sve/pr121105.C: New test. * gcc.target/riscv/rvv/base/pr121105.c: New test. Signed-off-by: Dominic P <[email protected]>
