1 /* { dg-do compile } */ 2 3 /****************************************************************************** 4 * OpenMP Example - Combined Parallel Loop Work-sharing - C/C++ Version 5 * FILE: omp_workshare3.c 6 * DESCRIPTION: 7 * This example attempts to show use of the parallel for construct. However 8 * it will generate errors at compile time. Try to determine what is causing 9 * the error. See omp_workshare4.c for a corrected version. 10 * SOURCE: Blaise Barney 5/99 11 * LAST REVISED: 03/03/2002 12 ******************************************************************************/ 13 14 #include <omp.h> 15 #include <stdio.h> 16 #define N 50 17 #define CHUNKSIZE 5 18 19 main () { 20 21 int i, chunk, tid; 22 float a[N], b[N], c[N]; 23 24 /* Some initializations */ 25 for (i=0; i < N; i++) 26 a[i] = b[i] = i * 1.0; 27 chunk = CHUNKSIZE; 28 29 #pragma omp parallel for \ 30 shared(a,b,c,chunk) \ 31 private(i,tid) \ 32 schedule(static,chunk) 33 { /* { dg-error "expected" } */ 34 tid = omp_get_thread_num(); 35 for (i=0; i < N; i++) 36 { 37 c[i] = a[i] + b[i]; 38 printf("tid= %d i= %d c[i]= %f\n", tid, i, c[i]); 39 } 40 } /* end of parallel for construct */ 41 42 return 0; 43 } 44