[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / loop_collapse_1.c
blobc9877419223dde4d89028656d7b8ac5826a264a2
1 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -verify %s
3 void func( double *A, int N, int M, int NB ) {
4 #pragma omp parallel
6 int nblks = (N-1)/NB;
7 int lnb = ((N-1)/NB)*NB;
9 #pragma omp for collapse(2)
10 for (int jblk = 0 ; jblk < nblks ; jblk++ ) {
11 int jb = (jblk == nblks - 1 ? lnb : NB);
12 for (int jk = 0; jk < N; jk+=jb) { // expected-error{{cannot use variable 'jb' in collapsed imperfectly-nested loop increment statement}}
16 #pragma omp for collapse(2)
17 for (int a = 0; a < N; a++) {
18 for (int b = 0; b < M; b++) {
19 int cx = a+b < NB ? a : b;
20 for (int c = 0; c < cx; c++) {
25 #pragma omp for collapse(3)
26 for (int a = 0; a < N; a++) {
27 for (int b = 0; b < M; b++) {
28 int cx = a+b < NB ? a : b;
29 for (int c = 0; c < cx; c++) { // expected-error{{cannot use variable 'cx' in collapsed imperfectly-nested loop condition statement}}
36 int main(void) {
37 double arr[256];
38 func (arr, 16, 16, 16);
39 return 0;