// RUN: %libomp-compile-and-run

/*
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=36720

Assertion failure at kmp_runtime.cpp(1715): nthreads > 0.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(1715).

The assertion fails even with OMP_NUM_THREADS=1. If the second task is removed,
everything runs to completion. If the "omp parallel for" directives are removed
from inside the tasks, once again everything runs fine.
*/

#define N 1024

int main() {
  #pragma omp task
  {
    #pragma omp parallel for
    for (int i = 0; i < N; i++)
      (void)0;
  }

  #pragma omp task
  {
    #pragma omp parallel for
    for (int i = 0; i < N; ++i)
      (void)0;
  }

  #pragma omp taskwait

  return 0;
}

// RUN: %libomp-compile-and-run

/*
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=36720

Assertion failure at kmp_runtime.cpp(1715): nthreads > 0.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(1715).

The assertion fails even with OMP_NUM_THREADS=1. If the second task is removed,
everything runs to completion. If the "omp parallel for" directives are removed
from inside the tasks, once again everything runs fine.
*/

#define N 1024

int main() {
  #pragma omp task
  {
    int i;
    #pragma omp parallel for
    for (i = 0; i < N; i++)
      (void)0;
  }

  #pragma omp task
  {
    int i;
    #pragma omp parallel for
    for (i = 0; i < N; ++i)
      (void)0;
  }

  #pragma omp taskwait

  return 0;
}

Convert test for PR36720 to c89
[test] Convert test for PR36720 to c89

GCC 4.8.5 defaults to this old C standard. I think we should make the
tests pass a newer -std=c99|c11 but that's too intrusive for now...

Differential Revision: https://reviews.llvm.org/D50084

git-svn-id: f99161ee8ccfe2101cbe1bdda2220bce2ed25485@338490 91177308-0d34-0410-b5e6-96231b3b80d8
