(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
goacc/
privatization-1-routine_gang.c
       1  /* OpenACC privatization: 'routine' */
       2  
       3  /* { dg-additional-options "-fopt-info-omp-note" } */
       4  /* { dg-additional-options "--param=openacc-privatization=noisy" } for
       5     testing/documenting aspects of that functionality.  */
       6  
       7  /* See also '../../gfortran.dg/goacc/privatization-1-routine_gang.f90'.  */
       8  
       9  /* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
      10     passed to 'incr' may be unset, and in that case, it will be set to [...]",
      11     so to maintain compatibility with earlier Tcl releases, we manually
      12     initialize counter variables:
      13     { dg-line l_dummy[variable c_routine 0] }
      14     { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
      15     "WARNING: dg-line var l_dummy defined, but not used".  */
      16  
      17  extern int e;
      18  static int s;
      19  int g;
      20  #pragma acc declare device_resident(e, s, g)
      21  
      22  #pragma acc routine gang /* { dg-line l_routine[incr c_routine] } */
      23  void
      24  f (int i, int j, int a)
      25  {
      26    extern int ex;
      27    static int st;
      28  #pragma acc declare device_resident(ex /* , st */)
      29    int x, y;
      30        {
      31  	__label__ ll;
      32  	/* Nested scopes fun.  */
      33  	{
      34  	  struct s_ss { int i; } ss;
      35  	  {
      36  	    extern int func (int *, int *, int *);
      37  	    /* Don't know how to effect a 'CONST_DECL' here.  (See Fortran example.)  */
      38  	    /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'.  */
      39  
      40  	    a = func (&i, &j, &a);
      41  	  }
      42  	  ss.i = a;
      43  	  {
      44  	    extern int func2 (int *, int *, int *, int *, int *, int *, int *);
      45  	    extern int ext;
      46  	    static int sta;
      47  #pragma acc declare device_resident(ext /* , sta */)
      48  	    a = func2 (&e, &s, &g, &ex, &st, &ext, &sta);
      49  	  }
      50  	}
      51  	x = a;
      52  #pragma acc atomic write
      53  	y = a;
      54  	{
      55  	  int xx, yy;
      56  	  xx = a;
      57  #pragma acc atomic write
      58  	  yy = a;
      59  	}
      60  
      61        ll:
      62  	;
      63        }
      64  }
      65    /* { dg-note {variable 'y' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
      66       { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      67    /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */
      68    /* { dg-note {variable 'st' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
      69       { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      70    /* { dg-note {variable 'ex' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
      71       { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      72    /* { dg-note {variable 'g' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
      73       { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      74    /* { dg-note {variable 's' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
      75       { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      76    /* { dg-note {variable 'e' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
      77       { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      78    /* { dg-note {variable 'a' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
      79       { dg-note {variable 'a' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      80    /* { dg-note {variable 'j' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
      81       { dg-note {variable 'j' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      82    /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
      83       { dg-note {variable 'i' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      84    /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      85    /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c xfail *-*-* } l_routine$c_routine }
      86       { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ xfail *-*-* } l_routine$c_routine } */
      87    /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */
      88    /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      89    /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
      90    /* { dg-note {variable 'ext' declared in block isn't candidate for adjusting OpenACC privatization level: external} "TODO" { xfail *-*-* } l_routine$c_routine } */
      91    /* { dg-note {variable 'sta' declared in block isn't candidate for adjusting OpenACC privatization level: static} "TODO" { xfail *-*-* } l_routine$c_routine } */
      92    /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */
      93    /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
      94       { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */