diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index f4c8bdf9431..8bfc71315f9 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -13629,6 +13629,14 @@ omp_instantiate_mapper (gimple_seq *pre_p, continue; } + if (OMP_CLAUSE_HAS_ITERATORS (clause)) + { + sorry_at (OMP_CLAUSE_LOCATION (clause), + "user-defined mapper that uses a % clause " + "with %"); + continue; + } + tree decl = OMP_CLAUSE_DECL (clause); tree unshared, type; bool nonunit_array_with_mapper = false; diff --git a/gcc/testsuite/c-c++-common/gomp/pr122866.c b/gcc/testsuite/c-c++-common/gomp/pr122866.c new file mode 100644 index 00000000000..bb42bc634db --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr122866.c @@ -0,0 +1,21 @@ +/* { dg-do "compile" } */ + +struct test { int x; }; + +#pragma omp begin declare target +void froggify (struct test); +#pragma omp end declare target + +#pragma omp declare mapper(struct test v) map(iterator(i = 0:1), tofrom: v.x) +/* { dg-message "sorry, unimplemented: user-defined mapper that uses a .map. clause with .iterator." "" { target *-*-* } .-1 } */ + +int +main () +{ + struct test s; + s.x = -1; + #pragma omp target + { + froggify (s); + } +}