https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122139
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by David Faust <[email protected]>: https://gcc.gnu.org/g:239535e9b0c4313072dda0ee1dcbd8ad8636a326 commit r16-4471-g239535e9b0c4313072dda0ee1dcbd8ad8636a326 Author: David Faust <[email protected]> Date: Wed Oct 15 13:36:38 2025 -0700 bpf: fix memset miscompilation with larger stores [PR122139] The BPF backend expansion of setmem was broken, because it could elect to use stores of HI, SI or DI modes based on the destination alignment when the value was QI, but fail to duplicate the byte value across to those larger sizes. This resulted in not all bytes of the destination actually being set to the desired value. Fix bpf_expand_setmem to ensure the desired byte value is really duplicated as necessary, whether it is constant or a (sub)reg:QI. PR target/122139 gcc/ * config/bpf/bpf.cc (bpf_expand_setmem): Duplicate byte value across to new mode when using larger modes for store. gcc/testsuite/ * gcc.target/bpf/memset-3.c: New. * gcc.target/bpf/memset-4.c: New.
