From: Alexey Bataev Date: Fri, 27 Jun 2014 03:33:10 +0000 (+0000) Subject: [OPENMP] Added several test cases in nesting of OpenMP regions test after review... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d495ae49bd05aa2015c316a2e39fed0c080232d;p=platform%2Fupstream%2Fllvm.git [OPENMP] Added several test cases in nesting of OpenMP regions test after review from Samuel F Antao. llvm-svn: 211857 --- diff --git a/clang/test/OpenMP/nesting_of_regions.cpp b/clang/test/OpenMP/nesting_of_regions.cpp index 79f3cd6..0977a24 100644 --- a/clang/test/OpenMP/nesting_of_regions.cpp +++ b/clang/test/OpenMP/nesting_of_regions.cpp @@ -103,6 +103,23 @@ void foo() { bar(); } } +#pragma omp for + for (int i = 0; i < 10; ++i) { +#pragma omp parallel + { +#pragma omp single // OK + { + bar(); + } +#pragma omp for // OK + for (int i = 0; i < 10; ++i) + ; +#pragma omp sections // OK + { + bar(); + } + } + } #pragma omp sections { #pragma omp for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} @@ -143,6 +160,23 @@ void foo() { bar(); } } +#pragma omp sections + { +#pragma omp parallel + { +#pragma omp single // OK + { + bar(); + } +#pragma omp for // OK + for (int i = 0; i < 10; ++i) + ; +#pragma omp sections // OK + { + bar(); + } + } + } #pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}} { bar(); @@ -179,6 +213,23 @@ void foo() { bar(); } } +#pragma omp single + { +#pragma omp parallel + { +#pragma omp single // OK + { + bar(); + } +#pragma omp for // OK + for (int i = 0; i < 10; ++i) + ; +#pragma omp sections // OK + { + bar(); + } + } + } } void foo() { @@ -282,6 +333,23 @@ void foo() { #pragma omp single // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} bar(); } +#pragma omp for + for (int i = 0; i < 10; ++i) { +#pragma omp parallel + { +#pragma omp single // OK + { + bar(); + } +#pragma omp for // OK + for (int i = 0; i < 10; ++i) + ; +#pragma omp sections // OK + { + bar(); + } + } + } #pragma omp sections { #pragma omp for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}} @@ -319,6 +387,23 @@ void foo() { #pragma omp single // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} bar(); } +#pragma omp sections + { +#pragma omp parallel + { +#pragma omp single // OK + { + bar(); + } +#pragma omp for // OK + for (int i = 0; i < 10; ++i) + ; +#pragma omp sections // OK + { + bar(); + } + } + } #pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}} { bar(); @@ -355,6 +440,23 @@ void foo() { bar(); } } +#pragma omp single + { +#pragma omp parallel + { +#pragma omp single // OK + { + bar(); + } +#pragma omp for // OK + for (int i = 0; i < 10; ++i) + ; +#pragma omp sections // OK + { + bar(); + } + } + } return foo(); }