https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111165
--- Comment #23 from Sam James <sjames at gcc dot gnu.org> --- (Adding noipa or noinline attributes helps a lot as well, and then can easily just e.g. view values in gdb to create an artificial reproducer.)