14967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar// RUN: %clang_cc1 -verify -fopenmp %s 24967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 34967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarnamespace X { 44967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int x; 54967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar}; 64967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 74967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarstruct B { 84967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar static int ib; // expected-note {{'B::ib' declared here}} 94967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar static int bfoo() { return 8; } 104967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar}; 114967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 124967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarint bfoo() { return 4; } 134967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 144967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarint z; 154967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarconst int C1 = 1; 164967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarconst int C2 = 2; 174967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarvoid test_linear_colons() 184967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar{ 194967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int B = 0; 204967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 214967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 224967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 234967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(B:bfoo()) 244967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 10; ++i) ; 254967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 264967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 274967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 284967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(B::ib:B:bfoo()) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'}} 294967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 10; ++i) ; 304967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 314967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 324967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 334967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(B:ib) // expected-error {{use of undeclared identifier 'ib'; did you mean 'B::ib'}} 344967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 10; ++i) ; 354967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 364967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 374967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 384967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(z:B:ib) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'?}} 394967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 10; ++i) ; 404967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 414967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 424967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 434967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(B:B::bfoo()) 444967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 10; ++i) ; 454967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 464967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 474967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 484967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(X::x : ::z) 494967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 10; ++i) ; 504967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 514967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 524967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 534967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(B,::z, X::x) 544967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 10; ++i) ; 554967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 564967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 574967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 584967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(::z) 594967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 10; ++i) ; 604967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 614967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 624967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 634967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(B::bfoo()) // expected-error {{expected variable name}} 644967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 10; ++i) ; 654967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 664967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 674967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 684967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(B::ib,B:C1+C2) 694967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 10; ++i) ; 704967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar} 714967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 724967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainartemplate<int L, class T, class N> T test_template(T* arr, N num) { 734967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar N i; 744967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar T sum = (T)0; 754967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar T ind2 = - num * L; // expected-note {{'ind2' defined here}} 764967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 774967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 784967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 794967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(ind2:L) // expected-error {{argument of a linear clause should be of integral or pointer type}} 804967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (i = 0; i < num; ++i) { 814967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar T cur = arr[(int)ind2]; 824967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar ind2 += L; 834967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar sum += cur; 844967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar } 854967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar return T(); 864967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar} 874967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 884967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainartemplate<int LEN> int test_warn() { 894967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int ind2 = 0; 904967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp target 914967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp teams 924967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp parallel for simd linear(ind2:LEN) // expected-warning {{zero linear step (ind2 should probably be const)}} 934967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int i = 0; i < 100; i++) { 944967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar ind2 += LEN; 954967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar } 964967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar return ind2; 974967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar} 984967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 994967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarstruct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}} 1004967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarextern S1 a; 1014967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarclass S2 { 1024967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar mutable int a; 1034967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarpublic: 1044967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar S2():a(0) { } 1054967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar}; 1064967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarconst S2 b; // expected-note 2 {{'b' defined here}} 1074967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarconst S2 ba[5]; 1084967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarclass S3 { 1094967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int a; 1104967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarpublic: 1114967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar S3():a(0) { } 1124967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar}; 1134967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarconst S3 ca[5]; 1144967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarclass S4 { 1154967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int a; 1164967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar S4(); 1174967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarpublic: 1184967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar S4(int v):a(v) { } 1194967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar}; 1204967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarclass S5 { 1214967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int a; 1224967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar S5():a(0) {} 1234967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarpublic: 1244967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar S5(int v):a(v) { } 1254967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar}; 1264967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1274967a710c84587c654b56c828382219c3937dacbPirama Arumuga NainarS3 h; 1284967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} 1294967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1304967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainartemplate<class I, class C> int foomain(I argc, C **argv) { 1314967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar I e(4); 1324967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar I g(5); 1334967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int i; 1344967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int &j = i; 1354967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1364967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1374967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1384967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear // expected-error {{expected '(' after 'linear'}} 1394967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1404967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1414967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1424967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1434967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 1444967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1454967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1464967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1474967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1484967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear () // expected-error {{expected expression}} 1494967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1504967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1514967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1524967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1534967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 1544967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1554967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1564967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1574967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1584967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 1594967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1604967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1614967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1624967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1634967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} 1644967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1654967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1664967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1674967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1684967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (argc : 5) 1694967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1704967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1714967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1724967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1734967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (S1) // expected-error {{'S1' does not refer to a value}} 1744967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1754967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1764967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1774967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1784967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (a, b:B::ib) // expected-error {{linear variable with incomplete type 'S1'}} expected-error {{const-qualified variable cannot be linear}} 1794967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1804967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1814967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1824967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1834967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (argv[1]) // expected-error {{expected variable name}} 1844967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1854967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1864967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1874967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1884967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(e, g) 1894967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1904967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1914967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1924967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1934967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}} 1944967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 1954967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 1964967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 1974967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 1984967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(i) 1994967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2004967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2014967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp parallel 2024967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar { 2034967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int v = 0; 2044967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int i; 2054967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp target 2064967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp teams 2074967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp distribute simd linear(v:i) 2084967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) { i = k; v += i; } 2094967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar } 2104967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2114967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2124967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2134967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp parallel for simd linear(j) 2144967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2154967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2164967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int v = 0; 2174967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2184967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2194967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2204967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(v:j) 2214967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) { ++k; v += j; } 2224967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2234967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2244967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2254967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(i) 2264967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2274967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar return 0; 2284967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar} 2294967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2304967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarnamespace A { 2314967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainardouble x; 2324967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} 2334967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar} 2344967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarnamespace C { 2354967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarusing A::x; 2364967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar} 2374967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2384967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarint main(int argc, char **argv) { 2394967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar double darr[100]; 2404967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}} 2414967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar test_template<-4>(darr, 4); 2424967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar // expected-note@+1 {{in instantiation of function template specialization 'test_warn<0>' requested here}} 2434967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar test_warn<0>(); 2444967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2454967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar S4 e(4); // expected-note {{'e' defined here}} 2464967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar S5 g(5); // expected-note {{'g' defined here}} 2474967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int i; 2484967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int &j = i; 2494967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2504967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2514967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2524967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear // expected-error {{expected '(' after 'linear'}} 2534967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2544967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2554967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2564967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2574967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 2584967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2594967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2604967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2614967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2624967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear () // expected-error {{expected expression}} 2634967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2644967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2654967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2664967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2674967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 2684967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2694967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2704967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2714967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2724967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 2734967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2744967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2754967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2764967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2774967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} 2784967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2794967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2804967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2814967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2824967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (argc) 2834967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2844967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2854967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2864967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2874967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (S1) // expected-error {{'S1' does not refer to a value}} 2884967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2894967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2904967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2914967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2924967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2934967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (a, b) // expected-error {{linear variable with incomplete type 'S1'}} expected-error {{const-qualified variable cannot be linear}} 2944967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 2954967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 2964967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 2974967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 2984967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear (argv[1]) // expected-error {{expected variable name}} 2994967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 3004967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 3014967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 3024967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 3034967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(e, g) // expected-error {{argument of a linear clause should be of integral or pointer type, not 'S4'}} expected-error {{argument of a linear clause should be of integral or pointer type, not 'S5'}} 3044967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 3054967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 3064967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 3074967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 3084967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}} 3094967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 3104967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 3114967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp parallel 3124967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar { 3134967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar int i; 3144967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp target 3154967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp teams 3164967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp distribute simd linear(i) 3174967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 3184967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 3194967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp target 3204967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp teams 3214967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar #pragma omp distribute simd linear(i : 4) 3224967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) { ++k; i += 4; } 3234967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar } 3244967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 3254967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 3264967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 3274967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(j) 3284967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 3294967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 3304967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp target 3314967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp teams 3324967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar#pragma omp distribute simd linear(i) 3334967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar for (int k = 0; k < argc; ++k) ++k; 3344967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 3354967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar foomain<int,char>(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}} 3364967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar return 0; 3374967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar} 3384967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar 339