https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95119
--- Comment #1 from Bill Long <longb at cray dot com> --- Appears to be a regression. The original submitter thinks it is hanging in __lll_lock_wait inside CLOSE. Th same hang can be observed if the references to omp_get_num_threads are removed, but you still compile with -fopenmp (even though there is no openmp in the code). Appears to be related to linking with -lpthreads.