https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85129
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> --- > There are two test-cases excercising GOMP_OPENACC_DIM (using setenv rather > than dg-set-target-env-var, to allow remote testing setups to work where > dg-set-target-env-var is broken) Actually, using setenv as first stmt in main works for GOMP_OPENACC_DIM, because the value is read for the first time after that, in nvptx_exec. But f.i. GOMP_DEBUG is read in initialize_env, which has the constructor attribute, which "causes the function to be called automatically before execution enters main ()". So there, using setenv doesn't work. Same goes for ACC_DEVICE_TYPE and ACC_DEVICE_NUM, which are also set in initialize_env. So, GOMP_OPENACC_DIM seems to be the odd one here, and we should document the non-standard behaviour that it supports being set in main using setenv.