https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114342
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Severity|normal |enhancement Last reconfirmed| |2024-03-14 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- If you change `arr` to be: `static const int arr[]`. then GCC can do it with only one memcpy. So basically GCC does not know it remove arr from being a stack variable. clang/LLVM is able to figure that out but it definitely requires inlining to do that. ``` arr = *.LC0; ... __builtin_memcpy (_21, &arr, 444); ``` Basically GCC does not realize it can "remove" the local variable arr here. Note there are duplicates of this bug report already too.