78 lines · cpp
1// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized2 3// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized4 5void xxx(int argc) {6 int x; // expected-note {{initialize the variable 'x' to silence this warning}}7#pragma omp taskgroup8 argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}9}10 11int foo();12 13int main() {14 #pragma omp taskgroup15 ;16 #pragma omp taskgroup unknown // expected-warning {{extra tokens at the end of '#pragma omp taskgroup' are ignored}}17 foo();18 {19 #pragma omp taskgroup20 } // expected-error {{expected statement}}21 #pragma omp taskgroup22 #pragma omp taskgroup23 for (int i = 0; i < 10; ++i) {24 foo();25 #pragma omp parallel26 #pragma omp for27 for (int j = 0; j < 10; j++) {28 foo();29 #pragma omp taskgroup30 foo();31 }32 }33 #pragma omp taskgroup34 #pragma omp taskgroup35 for (int i = 0; i < 10; ++i) {36 foo();37 #pragma omp parallel38 #pragma omp for39 for (int j = 0; j < 10; j++) {40 #pragma omp taskgroup41 foo();42 }43 }44 #pragma omp taskgroup45 #pragma omp taskgroup46 for (int i = 0; i < 10; ++i) {47 foo();48 #pragma omp parallel49 #pragma omp for50 for (int j = 0; j < 10; j++) {51 #pragma omp taskgroup52 foo();53 }54 }55 56 return 0;57}58 59int foo() {60 L1:61 foo();62 #pragma omp taskgroup63 {64 foo();65 goto L1; // expected-error {{use of undeclared label 'L1'}}66 }67 goto L2; // expected-error {{use of undeclared label 'L2'}}68 #pragma omp taskgroup69 {70 L2:71 foo();72 }73 74#pragma omp taskgroup initi // expected-warning {{extra tokens at the end of '#pragma omp taskgroup' are ignored}}75 ;76 return 0;77}78