summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/appendix-a/a.32.1.c
blob: d2cb316f3cc0ec4cb15b898a7fcb4756f67f6a45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* { dg-do compile } */
/* { dg-require-effective-target tls } */

#include <stdlib.h>
float *work;
int size;
float tol;
void build (void);
#pragma omp threadprivate(work,size,tol)
void
a32 (float t, int n)
{
  tol = t;
  size = n;
#pragma omp parallel copyin(tol,size)
  {
    build ();
  }
}
void
build ()
{
  int i;
  work = (float *) malloc (sizeof (float) * size);
  for (i = 0; i < size; ++i)
    work[i] = tol;
}