https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65589
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Can't reproduce here, with neither 4.8 nor 4.9. But tested just on 16 threads box (both with argument 16 and 32). Note rand () is not thread-safe, so calling it from multiple threads concurrently is undefined-behavior. Haven't spotted anything wrong in the generated code.