(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.c-c++-common/
requires-2.c
       1  /* { dg-do link { target offloading_enabled } } */
       2  /* { dg-additional-options "-foffload=disable -flto" } */
       3  /* { dg-additional-sources requires-2-aux.c } */
       4  
       5  /* Check diagnostic by host's lto1.
       6     Other file does not have any 'omp requires'. */
       7  
       8  #pragma omp requires unified_shared_memory
       9  
      10  int a[10];
      11  extern void foo (void);
      12  
      13  int
      14  main (void)
      15  {
      16    #pragma omp target
      17    for (int i = 0; i < 10; i++)
      18      a[i] = 0;
      19  
      20    foo ();
      21    return 0;
      22  }
      23  
      24  /* { dg-error "OpenMP 'requires' directive with 'unified_shared_memory' specified only in some compilation units" "" { target *-*-* } 0 }
      25       { dg-note {requires-2\.c' has 'unified_shared_memory'} {} { target *-*-* } 0 }
      26       { dg-note {but '[^']*requires-2-aux\.c' has not} {} { target *-*-* } 0 } */
      27  /* { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" } */