[Openmp-commits] [PATCH] D98838: [OpenMP] Fixed a crash in hidden helper thread

Joachim Protze via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 18 05:02:05 PDT 2021


protze.joachim added a comment.

Reproducer for the assertion in Line 3660:

  #include <omp.h>
  #include <vector>
  #include <thread>
  #include <chrono>
  
  void dummy_root(){
    int nthreads = omp_get_max_threads();
    std::this_thread::sleep_for(std::chrono::milliseconds(1000));
  }
  
  
  int main(int argc, char *argv[]) {
    const int N = 4 * omp_get_num_procs();
    std::vector<int> data(N);
    std::thread root(dummy_root);
  #pragma omp parallel for num_threads(N)
    for (unsigned i = 0; i < N; ++i) {
      data[i] += i;
    }
  
    root.join();
    return 0;
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98838/new/

https://reviews.llvm.org/D98838



More information about the Openmp-commits mailing list