Files
TheRock/compiler/amd-llvm/clang/test/OpenMP/teams_generic_loop_messages.cpp
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

146 lines
4.8 KiB
C++

// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -verify -fopenmp \
// RUN: -Wuninitialized %s
void foo()
{
int i,j,k;
int z;
// expected-error@+2 {{statement after '#pragma omp teams loop' must be a for loop}}
#pragma omp teams loop bind(thread)
i = 0;
// OpenMP 5.1 [2.22 Nesting of regions]
//
// A barrier region may not be closely nested inside a worksharing, loop,
// task, taskloop, critical, ordered, atomic, or masked region.
// expected-error@+3 {{region cannot be closely nested inside 'teams loop' region}}
#pragma omp teams loop bind(thread)
for (i=0; i<1000; ++i) {
#pragma omp barrier
}
// A masked region may not be closely nested inside a worksharing, loop,
// atomic, task, or taskloop region.
// expected-error@+3 {{region cannot be closely nested inside 'teams loop' region}}
#pragma omp teams loop bind(thread)
for (i=0; i<1000; ++i) {
#pragma omp masked filter(2)
{ }
}
// An ordered region that corresponds to an ordered construct without any
// clause or with the threads or depend clause may not be closely nested
// inside a critical, ordered, loop, atomic, task, or taskloop region.
// expected-error@+3 {{region cannot be closely nested inside 'teams loop' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
#pragma omp teams loop bind(thread)
for (i=0; i<1000; ++i) {
#pragma omp ordered
{ }
}
// expected-error@+3 {{region cannot be closely nested inside 'teams loop' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
#pragma omp teams loop bind(thread)
for (i=0; i<1000; ++i) {
#pragma omp ordered threads
{ }
}
// expected-error@+3 {{region cannot be closely nested inside 'teams loop' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
#pragma omp teams loop bind(thread)
for (i=0; i<1000; ++i) {
#pragma omp ordered depend(source)
}
// bind clause
// expected-error@+1 {{directive '#pragma omp teams loop' cannot contain more than one 'bind' clause}}
#pragma omp teams loop bind(thread) bind(thread)
for (i=0; i<1000; ++i) {
}
// expected-error@+2 {{expected 'teams', 'parallel' or 'thread' in OpenMP clause 'bind'}}
#pragma omp target
#pragma omp teams loop bind(other)
for (i=0; i<1000; ++i) {
}
// collapse clause
// expected-error@+4 {{expected 2 for loops after '#pragma omp teams loop', but found only 1}}
// expected-note@+1 {{as specified in 'collapse' clause}}
#pragma omp teams loop collapse(2) bind(thread)
for (i=0; i<1000; ++i)
z = i+11;
// expected-error@+1 {{directive '#pragma omp teams loop' cannot contain more than one 'collapse' clause}}
#pragma omp teams loop collapse(2) collapse(2) bind(thread)
for (i=0; i<1000; ++i)
for (j=0; j<1000; ++j)
z = i+j+11;
// order clause
// expected-error@+1 {{expected 'concurrent' in OpenMP clause 'order'}}
#pragma omp teams loop order(foo) bind(thread)
for (i=0; i<1000; ++i)
z = i+11;
// private clause
// expected-error@+1 {{use of undeclared identifier 'undef_var'}}
#pragma omp teams loop private(undef_var) bind(thread)
for (i=0; i<1000; ++i)
z = i+11;
// lastprivate
// A list item may not appear in a lastprivate clause unless it is the loop
// iteration variable of a loop that is associated with the construct.
// expected-error@+1 {{only loop iteration variables are allowed in 'lastprivate' clause in 'omp teams loop' directives}}
#pragma omp teams loop lastprivate(z) bind(thread)
for (i=0; i<1000; ++i) {
z = i+11;
}
// expected-error@+1 {{only loop iteration variables are allowed in 'lastprivate' clause in 'omp teams loop' directives}}
#pragma omp teams loop lastprivate(k) collapse(2) bind(thread)
for (i=0; i<1000; ++i)
for (j=0; j<1000; ++j)
for (k=0; k<1000; ++k)
z = i+j+k+11;
// reduction
// expected-error@+1 {{use of undeclared identifier 'undef_var'}}
#pragma omp teams loop reduction(+:undef_var) bind(thread)
for (i=0; i<1000; ++i)
z = i+11;
}
template <typename T, int C>
void templ_test(T t) {
T i,z;
// expected-error@+4 {{expected 2 for loops after '#pragma omp teams loop', but found only 1}}
// expected-note@+1 {{as specified in 'collapse' clause}}
#pragma omp teams loop collapse(C) bind(thread)
for (i=0; i<1000; ++i)
z = i+11;
// expected-error@+1 {{only loop iteration variables are allowed in 'lastprivate' clause in 'omp teams loop' directives}}
#pragma omp teams loop lastprivate(z) bind(thread)
for (i=0; i<1000; ++i) {
z = i+11;
}
}
void bar()
{
templ_test<int, 2>(16); // expected-note {{in instantiation of function template specialization 'templ_test<int, 2>' requested here}}
}