* gcc.dg/torture/stackalign/builtin-apply-2.c: Fix skip-if syntax.
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-prof / val-profiler-threads-1.c
blob95d6ee3b4a3184be9ae489561fecd49285cb443b
1 /* { dg-options "-O0 -pthread -fprofile-update=atomic" } */
2 /* { dg-require-effective-target profile_update_atomic } */
4 #include <pthread.h>
6 #define NUM_THREADS 8
7 #define SIZE 1024
8 #define ITERATIONS (1000 * 1000)
10 char buffer[SIZE];
11 char buffer2[SIZE];
13 void *copy_memory(char *dst, char *src, unsigned size)
15 for (unsigned i = 0; i < ITERATIONS; i++)
17 dst[size % 10] = src[size % 20];
21 void *foo(void *d)
23 copy_memory (buffer, buffer2, SIZE);
26 int main(int argc, char *argv[])
28 pthread_t threads[NUM_THREADS];
29 int rc;
30 long t;
31 for(t=0;t<NUM_THREADS;t++){
32 rc = pthread_create(&threads[t], NULL, foo, 0);
33 if (rc){
34 return 1;
38 int retval;
39 for(t=0;t<NUM_THREADS;t++)
40 pthread_join (threads[t], (void**)&retval);
42 return buffer[10];