I intent to commit this tomorrow, unless there are comments. It does as it says (see commit log): It initializes default-device-var to the value using the algorithm described in OpenMP 5.2, which depends on whether OMP_TARGET_OFFLOAD=mandatory was set. NOTE: With -foffload=disable there is no binary code but still devices get found - such that default-device-var == 0 (= first nonhost device). Thus, in that case, libgomp runs the code on that device but as no binary data is available, host fallback is used. (Even if there would be executable code for another device on the system.) With mandatory, this unintended host fallback is detected and an error is diagnosed. One can argue whether keeping the devices makes sense (e.g. because in a dynamic library device code will be loaded later) or not (don't list if no code is available). Note that TR11 (future OpenMP 6.0) extends OMP_DEFAULT_DEVICE and adds OMP_AVAILABLE_DEVICES which permit a finer-grained control about the device, including OMP_DEFAULT_DEVICE=initial (and 'invalid') which the current scheme does not permit. (Well, there is OMP_TARGET_OFFLOAD=disabled, but that's a too big hammer.) Tobias PS: DejaGNU testing was done without offloading configured and with remote testing on a system having an offload device, which which does not support setting environment variables. Manual testing was done with offloading enabled and depending on the testcase, running on a system with and/or without offloading hardware. ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955