GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libgomp

Use GOMP_MAP_VARS_DATA for OpenACC 'data' constructs

OpenACC 'data' constructs now use the correct map kind for C++ compatibility.

This commit aligns the mapping kind used for OpenACC data constructs with OpenMP target data constructs by using GOMP_MAP_VARS_DATA. This resolves C++ compatibility issues encountered when building libgomp with -Wc++-compat, where the previous 0 value was incorrectly interpreted as an int instead of the required enum gomp_map_vars_kind for the goacc_map_vars function.

In Details

The goacc_map_vars function in libgomp, used for OpenACC data directives, was previously called with a pragma_kind of 0. This commit corrects this by using GOMP_MAP_VARS_DATA, which is the appropriate enum value for data mapping, mirroring its use in OpenMP target data constructs. This change specifically addresses a C++ compatibility error where passing 0 directly was rejected as an invalid enum conversion, ensuring correct behavior for both C and C++ OpenACC programs.

For Context
libgomp
GCC's implementation of the OpenMP runtime library, providing support for parallel programming.
GOMP_MAP_VARS_DATA
An enumeration value in libgomp representing the mapping kind for data regions, used in OpenMP and OpenACC constructs.
OpenACC
A directive-based programming standard for parallel computing that targets accelerators like GPUs.
enum gomp_map_vars_kind
An enumeration type in libgomp that categorizes different types of memory mappings used in OpenMP and OpenACC directives.
Filed Under: libgompopenaccopenmpc++ compatibility