https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113665
--- Comment #1 from Christoph RĂ¼thing <christoph at muppetnet dot net> --- Note, that the volatile variables are just there to provide a minimal example and not have the entire loop optimized away. In the origian implementation I deduced this minimal example from, there was actually a useful implementation. But putting e.g. a std::cout at this place also solved the issue.