brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · f4c6834 Raw
165 lines · c
1// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized2 3// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized4 5void xxx(int argc) {6  int x; // expected-note {{initialize the variable 'x' to silence this warning}}7#pragma omp single8  argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}9}10 11void foo(void);12 13// expected-error@+1 {{unexpected OpenMP directive '#pragma omp single'}}14#pragma omp single15 16// expected-error@+1 {{unexpected OpenMP directive '#pragma omp single'}}17#pragma omp single foo18 19void test_no_clause(void) {20  int i;21#pragma omp single22  foo();23 24#pragma omp single25  ++i;26}27 28void test_branch_protected_scope(void) {29  int i = 0;30L1:31  ++i;32 33  int x[24];34 35#pragma omp parallel36#pragma omp single37  {38    if (i == 5)39      goto L1; // expected-error {{use of undeclared label 'L1'}}40    else if (i == 6)41      return; // expected-error {{cannot return from OpenMP region}}42    else if (i == 7)43      goto L2;44    else if (i == 8) {45    L2:46      x[i]++;47    }48  }49 50  if (x[0] == 0)51    goto L2; // expected-error {{use of undeclared label 'L2'}}52  else if (x[1] == 1)53    goto L1;54}55 56void test_invalid_clause(void) {57  int i;58#pragma omp parallel59// expected-warning@+1 {{extra tokens at the end of '#pragma omp single' are ignored}}60#pragma omp single foo bar61  foo();62}63 64void test_non_identifiers(void) {65  int i, x;66 67#pragma omp parallel68// expected-warning@+1 {{extra tokens at the end of '#pragma omp single' are ignored}}69#pragma omp single;70  foo();71#pragma omp parallel72// expected-error@+2 {{unexpected OpenMP clause 'linear' in directive '#pragma omp single'}}73// expected-warning@+1 {{extra tokens at the end of '#pragma omp single' are ignored}}74#pragma omp single linear(x);75  foo();76 77#pragma omp parallel78// expected-warning@+1 {{extra tokens at the end of '#pragma omp single' are ignored}}79#pragma omp single private(x);80  foo();81 82#pragma omp parallel83// expected-warning@+1 {{extra tokens at the end of '#pragma omp single' are ignored}}84#pragma omp single, private(x);85  foo();86}87 88void test_private(void) {89  int i;90#pragma omp parallel91// expected-error@+2 {{expected expression}}92// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}93#pragma omp single private(94  foo();95#pragma omp parallel96// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}97// expected-error@+1 2 {{expected expression}}98#pragma omp single private(,99  foo();100#pragma omp parallel101// expected-error@+1 2 {{expected expression}}102#pragma omp single private(, )103  foo();104#pragma omp parallel105// expected-error@+1 {{expected expression}}106#pragma omp single private()107  foo();108#pragma omp parallel109// expected-error@+1 {{expected expression}}110#pragma omp single private(int)111  foo();112#pragma omp parallel113// expected-error@+1 {{expected variable name}}114#pragma omp single private(0)115  foo();116 117  int x, y, z;118#pragma omp parallel119#pragma omp single private(x)120  foo();121#pragma omp parallel122#pragma omp single private(x, y)123  foo();124#pragma omp parallel125#pragma omp single private(x, y, z)126  foo();127}128 129void test_firstprivate(void) {130  int i;131#pragma omp parallel132// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}133// expected-error@+1 {{expected expression}}134#pragma omp single firstprivate(135  foo();136 137#pragma omp parallel138// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}139// expected-error@+1 2 {{expected expression}}140#pragma omp single firstprivate(,141  foo();142#pragma omp parallel143// expected-error@+1 2 {{expected expression}}144#pragma omp single firstprivate(, )145  foo();146#pragma omp parallel147// expected-error@+1 {{expected expression}}148#pragma omp single firstprivate()149  foo();150#pragma omp parallel151// expected-error@+1 {{expected expression}}152#pragma omp single firstprivate(int)153  foo();154#pragma omp parallel155// expected-error@+1 {{expected variable name}}156#pragma omp single firstprivate(0)157  foo();158}159 160void test_nowait(void) {161#pragma omp single nowait nowait // expected-error {{directive '#pragma omp single' cannot contain more than one 'nowait' clause}}162  for (int i = 0; i < 16; ++i)163    ;164}165