(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.c/
target-41.c
       1  /* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */
       2  
       3  #include <omp.h>
       4  #include <stdlib.h>
       5  
       6  int v;
       7  
       8  void
       9  foo (void)
      10  {
      11    v++;
      12  }
      13  
      14  #pragma omp declare target enter (v, foo)
      15  
      16  int
      17  main ()
      18  {
      19    /* OMP_TARGET_OFFLOAD=mandatory shouldn't fail for host fallback
      20       if it is because the program explicitly asked for the host
      21       fallback through if(false) or omp_get_initial_device () or
      22       omp_initial_device as the device.  */
      23    #pragma omp target if (v)
      24    foo ();
      25    #pragma omp target device (omp_initial_device)
      26    foo ();
      27    #pragma omp target device (omp_get_initial_device ())
      28    foo ();
      29    omp_set_default_device (omp_get_initial_device ());
      30    #pragma omp target
      31    foo ();
      32    if (v != 4)
      33      abort ();
      34    return 0;
      35  }