Currently, using the ISO version of C and C++ will disable the OpenMP and OpenACC intrinsics, which is rather surprising. The reason is that those imply -fno-nonansi-builtins and the OpenMP/OpenACC are marked as non-ansi builtins.
While the latter is true, -fopenmp/-fopenacc seems to be rather orthogonal and should be regarded as category of their own, uneffected by -std=c23 vs. -std=gnu23 or -std=c++23 vs. -std=gnu++23. Comments before I commit this patch? Tobias
builtins.def: Enable OpenMP/OpenACC builtins also with -fno-nonansi-builtins The -std=c.. and -std=c++.. imply -fno-nonansi-builtins, which disabled the OpenMP/OpenACC intrinsics - but -fopenmp/-fopenacc builtin use should be rather othogonal to the user's choice between -std=c... and -std=gnuc... gcc/ChangeLog: * builtins.def (DEF_GOACC_BUILTIN_COMPILER, DEF_GOMP_BUILTIN_COMPILER): Set NONANSI_P = false to enable those also with -fno-nonansi-builtins. diff --git a/gcc/builtins.def b/gcc/builtins.def index fdcad54a5d7..825e7598d37 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -217,6 +217,8 @@ along with GCC; see the file COPYING3. If not see DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \ false, true, true, ATTRS, false, \ flag_openacc) +/* Set NONANSI_P = false to enable the builtins also with -fno-nonansi-builtins + as -std=c++23 (which implies the former) and -fopenacc should be othogonal. */ #undef DEF_GOACC_BUILTIN_COMPILER #define DEF_GOACC_BUILTIN_COMPILER(ENUM, NAME, TYPE, ATTRS) \ DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \ @@ -232,10 +234,12 @@ along with GCC; see the file COPYING3. If not see (flag_openacc \ || flag_openmp \ || flag_tree_parallelize_loops > 1)) +/* Set NONANSI_P = false to enable the builtins also with -fno-nonansi-builtins + as -std=c++23 (which implies the former) and -fopenmp should be othogonal. */ #undef DEF_GOMP_BUILTIN_COMPILER #define DEF_GOMP_BUILTIN_COMPILER(ENUM, NAME, TYPE, ATTRS) \ DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \ - flag_openmp, true, true, ATTRS, false, flag_openmp) + flag_openmp, true, false, ATTRS, false, flag_openmp) /* Builtin used by the implementation of GNU TM. These functions are mapped to the actual implementation of the STM library. */