"Fossies" - the Fresh Open Source Software Archive

Member "cfe-9.0.0.src/test/OpenMP/target_teams_distribute_parallel_for_simd_safelen_messages.cpp" (8 Jul 2019, 7511 Bytes) of package /linux/misc/cfe-9.0.0.src.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "target_teams_distribute_parallel_for_simd_safelen_messages.cpp": 8.0.1_vs_9.0.0.

    1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
    2 // RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s -Wuninitialized
    3 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized
    4 
    5 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
    6 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wuninitialized
    7 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized
    8 
    9 void foo() {
   10 }
   11 
   12 #if __cplusplus >= 201103L
   13 // expected-note@+2 4 {{declared here}}
   14 #endif
   15 bool foobool(int argc) {
   16   return argc;
   17 }
   18 
   19 struct S1; // expected-note {{declared here}}
   20 
   21 template <class T, typename S, int N, int ST> // expected-note {{declared here}}
   22 T tmain(T argc, S **argv) { //expected-note 2 {{declared here}}
   23 
   24 #pragma omp target teams distribute parallel for simd safelen // expected-error {{expected '(' after 'safelen'}}
   25   for (int i = ST; i < N; i++)
   26     argv[0][i] = argv[0][i] - argv[0][i-ST];
   27 
   28 #pragma omp target teams distribute parallel for simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
   29   for (int i = ST; i < N; i++)
   30     argv[0][i] = argv[0][i] - argv[0][i-ST];
   31 
   32 #pragma omp target teams distribute parallel for simd safelen () // expected-error {{expected expression}}
   33   for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
   34 
   35 #pragma omp target teams distribute parallel for simd safelen (argc // expected-note {{to match this '('}} expected-error 2 {{expression is not an integral constant expression}} expected-note 2 {{read of non-const variable 'argc' is not allowed in a constant expression}} expected-error {{expected ')'}}
   36   for (int i = ST; i < N; i++) 
   37     argv[0][i] = argv[0][i] - argv[0][i-ST];
   38   
   39 #pragma omp target teams distribute parallel for simd safelen (ST // expected-error {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error {{expected ')'}} expected-note {{to match this '('}}
   40   for (int i = ST; i < N; i++)
   41     argv[0][i] = argv[0][i] - argv[0][i-ST];
   42 
   43 #pragma omp target teams distribute parallel for simd safelen (1)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}}
   44   for (int i = ST; i < N; i++)
   45      argv[0][i] = argv[0][i] - argv[0][i-ST];
   46 
   47 #pragma omp target teams distribute parallel for simd safelen ((ST > 0) ? 1 + ST : 2)
   48   for (int i = ST; i < N; i++) 
   49     argv[0][i] = argv[0][i] - argv[0][i-ST];
   50 
   51 #if __cplusplus >= 201103L
   52   // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
   53 #endif
   54 // expected-error@+3 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'safelen' clause}}
   55 // expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}}
   56 // expected-error@+1 2 {{expression is not an integral constant expression}}
   57 #pragma omp target teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5)
   58   for (int i = ST; i < N; i++)
   59     argv[0][i] = argv[0][i] - argv[0][i-ST];
   60 
   61 #pragma omp target teams distribute parallel for simd safelen (S) // expected-error {{'S' does not refer to a value}}
   62   for (int i = ST; i < N; i++)
   63     argv[0][i] = argv[0][i] - argv[0][i-ST];
   64 
   65 #if __cplusplus <= 199711L
   66   // expected-error@+4 2 {{expression is not an integral constant expression}}
   67 #else
   68   // expected-error@+2 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
   69 #endif
   70 #pragma omp target teams distribute parallel for simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
   71   for (int i = ST; i < N; i++)
   72     argv[0][i] = argv[0][i] - argv[0][i-ST];
   73 
   74 #pragma omp target teams distribute parallel for simd safelen (4)
   75   for (int i = ST; i < N; i++)
   76     argv[0][i] = argv[0][i] - argv[0][i-ST];
   77 
   78 #pragma omp target teams distribute parallel for simd safelen (N) // expected-error {{argument to 'safelen' clause must be a strictly positive integer value}}
   79   for (T i = ST; i < N; i++)
   80     argv[0][i] = argv[0][i] - argv[0][i-ST];
   81 
   82   return argc;
   83 }
   84 
   85 int main(int argc, char **argv) {
   86 #pragma omp target teams distribute parallel for simd safelen // expected-error {{expected '(' after 'safelen'}}
   87   for (int i = 4; i < 12; i++)
   88     argv[0][i] = argv[0][i] - argv[0][i-4];
   89 
   90 #pragma omp target teams distribute parallel for simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
   91   for (int i = 4; i < 12; i++)
   92     argv[0][i] = argv[0][i] - argv[0][i-4];
   93 
   94 #pragma omp target teams distribute parallel for simd safelen () // expected-error {{expected expression}}
   95   for (int i = 4; i < 12; i++)
   96     argv[0][i] = argv[0][i] - argv[0][i-4];
   97 
   98 #pragma omp target teams distribute parallel for simd safelen (4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
   99   for (int i = 4; i < 12; i++)
  100     argv[0][i] = argv[0][i] - argv[0][i-4];
  101 
  102 #pragma omp target teams distribute parallel for simd safelen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for simd' are ignored}}
  103   for (int i = 4; i < 12; i++)
  104     argv[0][i] = argv[0][i] - argv[0][i-4];
  105   
  106 #if __cplusplus >= 201103L
  107   // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
  108 #endif
  109 #pragma omp target teams distribute parallel for simd safelen (foobool(1) > 0 ? 1 : 2) // expected-error {{expression is not an integral constant expression}}
  110   for (int i = 4; i < 12; i++)
  111     argv[0][i] = argv[0][i] - argv[0][i-4];
  112 
  113 #if __cplusplus >= 201103L
  114   // expected-note@+5 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
  115 #endif
  116 // expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}}
  117 // expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'safelen' clause}}
  118 // expected-error@+1 {{expression is not an integral constant expression}}
  119 #pragma omp target teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5)
  120   for (int i = 4; i < 12; i++)
  121     argv[0][i] = argv[0][i] - argv[0][i-4];
  122 
  123 #pragma omp target teams distribute parallel for simd safelen (S1) // expected-error {{'S1' does not refer to a value}}
  124   for (int i = 4; i < 12; i++)
  125     argv[0][i] = argv[0][i] - argv[0][i-4];
  126 
  127 #if __cplusplus <= 199711L
  128   // expected-error@+4 {{expression is not an integral constant expression}}
  129 #else
  130   // expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
  131 #endif
  132 #pragma omp target teams distribute parallel for simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
  133   for (int i = 4; i < 12; i++)
  134     argv[0][i] = argv[0][i] - argv[0][i-4];
  135 
  136 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
  137 #pragma omp target teams distribute parallel for simd safelen(safelen(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
  138   foo(); // expected-error {{statement after '#pragma omp target teams distribute parallel for simd' must be a for loop}}
  139 
  140   // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 12, 4>' requested here}}
  141   return tmain<int, char, 12, 4>(argc, argv);
  142 }
  143