https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93334
--- Comment #3 from N Schaeffer <nathanael.schaeffer at gmail dot com> --- Hi, Thanks for pointing out the issue about writing different values. This makes sense. However, since memset deals with bytes, whenever the type of array is floating point data (or anything longer than bytes), it will not be possible to use memset to set different values. Indeed, the code snippet you propose is not compiled with memset for 1.0. So I think only zeros and NaNs are possible to optimize to memset anyway (and some other very special cases, that is probably not worth considering anyway).