https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82895
Harald Anlauf <anlauf at gmx dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gmx dot de --- Comment #3 from Harald Anlauf <anlauf at gmx dot de> --- (In reply to Arjen Markus from comment #2) > Clear, so the workaround I found actually constitutes the proper method of > doing this? Well, Jakub explained the main issue, but there are more problems with your code: - loop_body accesses the host-associated, non-threadprivate variables q, x, and id, and you get data races - it does not make sense that q appears in the omp private declaration, try to make it a local variable in loop_body - the I/O (write) is not thread-safe If possible, try to make the subroutine thread-safe, do not access variables by host association unless properly annotated. Hint: use valgrind or some other thread-checker.