https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114754
Bug ID: 114754 Summary: [OpenMP] Missing 'uses_allocators' diagnostic Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: accepts-invalid, diagnostic, openmp Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- Cf. https://github.com/SOLLVE/sollve_vv/pull/802 "LLVM error: error: allocator must be specified in the 'uses_allocators' clause adding uses_allocators(omp_default_mem_alloc) fixes the problem" OpenMP spec has under 'Restrictions to the *target* construct are as follows:' "Memory allocators that do not appear in a *uses_allocators* clause cannot appear as an allocator in an *allocate* clause or be used in the *target* region unless a *requires* directive with the *dynamic_allocators* clause is present in the same compilation unit." Example snippets, based on the sollve_vv testcase. The OG13 patch only diagnose the issue in the last/4th directive; clang diagnoses both the 'allocate' clause variants (2nd + 4th) but neither diagnoses the 1st/4th one. * * * omp_allocator_handle_t al = omp_init_allocator(omp_default_mem_space, 0, NULL); #pragma omp target { int *y = omp_alloc(omp_default_mem_alloc, sizeof(1)); } #pragma omp target allocate(omp_default_mem_alloc:x) firstprivate(x) map(from: device_result) { for (int i = 0; i < N; i++) x += i; device_result = x; } #pragma omp target firstprivate(al) { int *y = omp_alloc(al, sizeof(1)); } #pragma omp target allocate(al:x) firstprivate(x) map(from: device_result) { for (int i = 0; i < N; i++) x += i; device_result = x; }