(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
goacc/
privatization-1-routine_gang-loop.c
       1  /* OpenACC privatization: 'loop' construct inside '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-loop.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_loop 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  
      21  #pragma acc routine gang
      22  void
      23  f (int i, int j, int a)
      24  {
      25    extern int ex;
      26    static int st;
      27    int x, y;
      28  #pragma acc loop collapse(2) private(a) private (e, s, g) private(ex, st, x, y) /* { dg-line l_loop[incr c_loop] } */
      29    for (i = 0; i < 20; ++i)
      30      for (j = 0; j < 25; ++j)
      31        {
      32  	__label__ ll;
      33  	/* Nested scopes fun.  */
      34  	{
      35  	  struct s_ss { int i; } ss;
      36  	  {
      37  	    extern int func (int *, int *, int *);
      38  	    /* Don't know how to effect a 'CONST_DECL' here.  (See Fortran example.)  */
      39  	    /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'.  */
      40  
      41  	    a = func (&i, &j, &a);
      42  	  }
      43  	  ss.i = a;
      44  	  {
      45  	    extern int func2 (int *, int *, int *, int *, int *, int *, int *);
      46  	    extern int ext;
      47  	    static int 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    /* { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
      65       { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
      66    /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
      67    /* { dg-note {variable 'st' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
      68       { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
      69    /* { dg-note {variable 'ex' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
      70       { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
      71    /* { dg-note {variable 'g' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
      72       { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
      73    /* { dg-note {variable 's' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
      74       { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
      75    /* { dg-note {variable 'e' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
      76       { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
      77    /* { dg-note {variable 'a' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
      78       { dg-note {variable 'a' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
      79    /* { dg-note {variable 'j\.1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
      80    /* { dg-note {variable 'i\.0' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
      81    /* { dg-note {variable 'j' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
      82       { dg-note {variable 'j' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
      83    /* { dg-note {variable 'i' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
      84       { dg-note {variable 'i' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
      85    /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
      86    /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c } l_loop$c_loop }
      87       { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ } l_loop$c_loop } */
      88    /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
      89    /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
      90    /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
      91    /* { dg-note {variable 'ext' declared in block isn't candidate for adjusting OpenACC privatization level: external} "" { target *-*-* } l_loop$c_loop } */
      92    /* { dg-note {variable 'sta' declared in block isn't candidate for adjusting OpenACC privatization level: static} "" { target *-*-* } l_loop$c_loop } */
      93    /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
      94    /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
      95       { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
      96  }