Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s |
| 2 | |
| 3 | int foo() { |
| 4 | L1: |
| 5 | foo(); |
| 6 | #pragma omp atomic |
| 7 | // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} |
| 8 | { |
| 9 | foo(); |
| 10 | goto L1; // expected-error {{use of undeclared label 'L1'}} |
| 11 | } |
| 12 | goto L2; // expected-error {{use of undeclared label 'L2'}} |
| 13 | #pragma omp atomic |
| 14 | // expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} |
| 15 | { |
| 16 | foo(); |
| 17 | L2: |
| 18 | foo(); |
| 19 | } |
| 20 | |
| 21 | return 0; |
| 22 | } |
| 23 | |
| 24 | struct S { |
| 25 | int a; |
| 26 | }; |
| 27 | |
| 28 | int readint() { |
| 29 | int a = 0, b = 0; |
| 30 | // Test for atomic read |
| 31 | #pragma omp atomic read |
| 32 | // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}} |
| 33 | // expected-note@+1 {{expected an expression statement}} |
| 34 | ; |
| 35 | #pragma omp atomic read |
| 36 | // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}} |
| 37 | // expected-note@+1 {{expected built-in assignment operator}} |
| 38 | foo(); |
| 39 | #pragma omp atomic read |
| 40 | // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}} |
| 41 | // expected-note@+1 {{expected built-in assignment operator}} |
| 42 | a += b; |
| 43 | #pragma omp atomic read |
| 44 | // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}} |
| 45 | // expected-note@+1 {{expected lvalue expression}} |
| 46 | a = 0; |
| 47 | #pragma omp atomic read |
| 48 | a = b; |
| 49 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}} |
| 50 | #pragma omp atomic read read |
| 51 | a = b; |
| 52 | |
| 53 | return 0; |
| 54 | } |
| 55 | |
| 56 | int readS() { |
| 57 | struct S a, b; |
| 58 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}} |
| 59 | #pragma omp atomic read read |
| 60 | // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}} |
| 61 | // expected-note@+1 {{expected expression of scalar type}} |
| 62 | a = b; |
| 63 | |
| 64 | return a.a; |
| 65 | } |