2020-03-20 19:03:01 +08:00
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ferror-limit 100 %s
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 %s
template < class T >
2020-03-27 03:47:50 +08:00
T tmain ( T argc ) {
2020-03-20 19:03:01 +08:00
# pragma omp for
for ( int i = 0 ; i < 10 ; + + i ) {
2020-03-20 21:41:22 +08:00
# pragma omp scan // expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
2020-03-20 19:03:01 +08:00
;
}
# pragma omp for
for ( int i = 0 ; i < 10 ; + + i ) {
2020-03-20 21:41:22 +08:00
# pragma omp scan allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp scan'}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
# pragma omp scan untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp scan'}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
# pragma omp scan unknown // expected-warning {{extra tokens at the end of '#pragma omp scan' are ignored}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp for simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
if ( argc )
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
if ( argc ) {
2020-03-27 03:47:50 +08:00
# pragma omp scan inclusive(argc)
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
while ( argc )
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
while ( argc ) {
2020-03-27 03:47:50 +08:00
# pragma omp scan inclusive(argc)
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
do
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
while ( argc )
;
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
do {
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc)
2020-03-20 19:03:01 +08:00
} while ( argc ) ;
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
switch ( argc )
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
switch ( argc )
case 1 :
2020-03-27 03:47:50 +08:00
# pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
switch ( argc )
case 1 : {
2020-03-27 03:47:50 +08:00
# pragma omp scan inclusive(argc)
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
switch ( argc ) {
2020-03-23 22:41:08 +08:00
# pragma omp scan exclusive(argc) // expected-note 2 {{previous 'scan' directive used here}}
2020-03-20 19:03:01 +08:00
case 1 :
2020-03-23 22:41:08 +08:00
# pragma omp scan exclusive(argc) // expected-error {{exactly one 'scan' directive must appear in the loop body of an enclosing directive}}
2020-03-20 19:03:01 +08:00
break ;
default : {
2020-03-23 22:41:08 +08:00
# pragma omp scan exclusive(argc) // expected-error {{exactly one 'scan' directive must appear in the loop body of an enclosing directive}}
2020-03-20 19:03:01 +08:00
} break ;
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
for ( ; ; )
2020-03-23 22:41:08 +08:00
# pragma omp scan exclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
for ( ; ; ) {
2020-03-27 03:47:50 +08:00
# pragma omp scan exclusive(argc)
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i ) {
label :
2020-03-23 22:41:08 +08:00
# pragma omp scan exclusive(argc)
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i ) {
label1 : {
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc)
2020-03-20 19:03:01 +08:00
} }
return T ( ) ;
}
2020-03-27 03:47:50 +08:00
int main ( int argc , char * * argv ) {
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i ) {
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc) inclusive(argc) // expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
2020-03-20 19:03:01 +08:00
;
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i ) {
2020-03-23 22:41:08 +08:00
# pragma omp scan exclusive(argc) inclusive(argc) // expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
;
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-23 22:41:08 +08:00
for ( int i = 0 ; i < 10 ; + + i ) {
# pragma omp scan exclusive(argc) exclusive(argc) // expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
;
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-23 22:41:08 +08:00
for ( int i = 0 ; i < 10 ; + + i ) {
2020-03-20 21:41:22 +08:00
# pragma omp scan untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp scan'}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
# pragma omp scan unknown // expected-warning {{extra tokens at the end of '#pragma omp scan' are ignored}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
if ( argc )
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
if ( argc ) {
2020-03-27 03:47:50 +08:00
# pragma omp scan inclusive(argc)
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
while ( argc )
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
while ( argc ) {
2020-03-27 03:47:50 +08:00
# pragma omp scan inclusive(argc)
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
do
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
while ( argc )
;
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
do {
2020-03-23 22:41:08 +08:00
# pragma omp scan exclusive(argc)
2020-03-20 19:03:01 +08:00
} while ( argc ) ;
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
switch ( argc )
2020-03-23 22:41:08 +08:00
# pragma omp scan exclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
switch ( argc )
case 1 :
2020-03-27 03:47:50 +08:00
# pragma omp scan exclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
switch ( argc )
case 1 : {
2020-03-27 03:47:50 +08:00
# pragma omp scan exclusive(argc)
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
switch ( argc ) {
2020-03-21 03:27:16 +08:00
# pragma omp scan inclusive(argc) // expected-note 2 {{previous 'scan' directive used here}}
2020-03-20 19:03:01 +08:00
case 1 :
2020-03-21 03:27:16 +08:00
# pragma omp scan inclusive(argc) // expected-error {{exactly one 'scan' directive must appear in the loop body of an enclosing directive}}
2020-03-20 19:03:01 +08:00
break ;
default : {
2020-03-21 03:27:16 +08:00
# pragma omp scan inclusive(argc) // expected-error {{exactly one 'scan' directive must appear in the loop body of an enclosing directive}}
2020-03-20 19:03:01 +08:00
} break ;
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i )
for ( ; ; )
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
2020-03-20 19:03:01 +08:00
for ( ; ; ) {
2020-03-27 03:47:50 +08:00
# pragma omp scan inclusive(argc)
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i ) {
label :
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc)
2020-03-20 19:03:01 +08:00
}
2020-03-27 03:47:50 +08:00
# pragma omp simd
2020-03-20 19:03:01 +08:00
for ( int i = 0 ; i < 10 ; + + i ) {
label1 : {
2020-03-20 21:41:22 +08:00
# pragma omp scan inclusive(argc)
2020-03-20 19:03:01 +08:00
}
}
2020-03-27 03:47:50 +08:00
return tmain ( argc ) ;
2020-03-20 19:03:01 +08:00
}