[flang][cuda] Do not register global constants (#118582)
[llvm-project.git] / openmp / runtime / test / worksharing / single / omp_single.c
blob49635798c2d085920fcfcee2be5b047ecff6d94e
1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include "omp_testsuite.h"
5 int test_omp_single()
7 int nr_threads_in_single;
8 int result;
9 int nr_iterations;
10 int i;
12 nr_threads_in_single = 0;
13 result = 0;
14 nr_iterations = 0;
16 #pragma omp parallel private(i)
18 for (i = 0; i < LOOPCOUNT; i++) {
19 #pragma omp single
21 #pragma omp flush
22 nr_threads_in_single++;
23 #pragma omp flush
24 nr_iterations++;
25 nr_threads_in_single--;
26 result = result + nr_threads_in_single;
30 return ((result == 0) && (nr_iterations == LOOPCOUNT));
31 } /* end of check_single*/
33 int main()
35 int i;
36 int num_failed=0;
38 for(i = 0; i < REPETITIONS; i++) {
39 if(!test_omp_single()) {
40 num_failed++;
43 return num_failed;