https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121353
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> --- For the ICE, update the test case as follows (note the added 'a' in the following). TODO: Come more checks whether this works correctly, including reference-type members. - Also check for other tricky code which is handled for 'map' but now needs to be handled also for mapper. TODO: Do those checks already for 'declare mapper' - and not only when using it. GCC accepts it silently (until using it) while Clang-20 rejects it already during parsing: error: subscripted value is not an array or pointer 11 | #pragma omp declare mapper (RGB_vector v) map(v, v[:v.sz], v.a[:4]) * * * struct RGB_vector { size_t sz; RGB *v; int a; }; #pragma omp declare mapper (RGB_vector v) map(v, v[:v.sz], v.a[:4]) * * * --- a/gcc/c-family/c-omp.cc +++ b/gcc/c-family/c-omp.cc @@ -4423,2 +4423,10 @@ omp_instantiate_mapper (tree *outlist, tree mapper, tree + type = TREE_TYPE (t); + if (TREE_CODE (type) != POINTER_TYPE + && TREE_CODE (type) != ARRAY_TYPE) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE does not have pointer or array type", t2); + continue; + } if (t2 == t) @@ -4428,9 +4436,6 @@ omp_instantiate_mapper (tree *outlist, tree mapper, tree look that one up. */ - type = TREE_TYPE (TREE_TYPE (t)); + type = TREE_TYPE (type); } else - { - t = t2; - type = TREE_TYPE (t); - } + t = t2; }