https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122139
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by David Faust <[email protected]>: https://gcc.gnu.org/g:1e86fa1d9e2c47ab2b28a880341231833bc69cd5 commit r14-13011-g1e86fa1d9e2c47ab2b28a880341231833bc69cd5 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. (cherry picked from commit 239535e9b0c4313072dda0ee1dcbd8ad8636a326)
