https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118933
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This is because `len` is vec.end() - vec.begin() where end is a pointer load. and then `data + len` gets re-optimized to just vec.end(). And so len is no longer taken into account in std::accumulate loop.