1  /* Verify column location information.  */
       2  
       3  /* See also 'gfortran.dg/goacc/pr92793-1.f90'.  */
       4  
       5  /* { dg-additional-options "-fdump-tree-original-lineno" }, and also
       6     { dg-additional-options "-fdump-tree-gimple-lineno" } as the former doesn't
       7     actually contain location information.  */
       8  
       9  /* No tabs.  Funny indentation/spacing for a reason.  */
      10  
      11  
      12  static void
      13  check ()
      14  {
      15    int i, j, sum, diff;
      16  
      17   #pragma   acc  parallel \
      18    /* C, C++ location information points to the 'a' in '#pragma acc parallel'.  */ \
      19    /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:17:12\\\] #pragma acc parallel" 1 "original" { xfail *-*-* } } } */ \
      20    /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:17:12\\\] #pragma omp target oacc_parallel" 1 "gimple" } } */
      21    {
      22  #pragma     acc loop \
      23    /* C, C++ location information points to the 'a' in '#pragma acc loop'.  */ \
      24    /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:22:13\\\] #pragma acc loop" 1 "original" { xfail *-*-* } } } */ \
      25    /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:22:13\\\] #pragma acc loop" 1 "gimple" } } */ \
      26         reduction  (  + :   sum) /* { dg-line sum1 } */ \
      27    /* C location information points to the '(' in 'reduction(+:sum)'.  */ \
      28    /* { dg-message "19: location of the previous reduction for 'sum'" "" { target c } sum1 } */ \
      29    /* C++ location information points to 'sum' in 'reduction(+:sum)'.  */ \
      30    /* { dg-message "28: location of the previous reduction for 'sum'" "" { target c++ } sum1 } */ \
      31    independent
      32      for (i = 1; i <= 10; i++)
      33        {
      34       #pragma      acc     loop \
      35    /* C, C++ location information points to the 'a' in '#pragma acc loop'.  */ \
      36    /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:34:19\\\] #pragma acc loop" 1 "original" { xfail *-*-* } } } */ \
      37    /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:34:19\\\] #pragma acc loop" 1 "gimple" } } */ \
      38   reduction  ( -  : diff  ) \
      39  reduction(-:sum  ) /* { dg-line sum2 } */ \
      40    /* C location information points to the '(' in 'reduction(-:sum)'.  */ \
      41    /* { dg-warning "10: conflicting reduction operations for 'sum'" "" { target c } sum2 } */ \
      42    /* C++ location information points to 'sum' in 'reduction(-:sum)'.  */ \
      43    /* { dg-warning "13: conflicting reduction operations for 'sum'" "" { target c++ } sum2 } */ \
      44    independent
      45          for (j = 1; j <= 10; j++)
      46            {
      47                  sum
      48                    =
      49               1 ;
      50              /* C, C++ location information points to the '=' in 'sum = 1'.  */ \
      51              /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:48:19\\\] sum = 1" 1 "original" { xfail *-*-* } } } */ \
      52              /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:48:19\\\] sum = 1" 1 "gimple" } } */
      53            }
      54        }
      55    }
      56  }
      57  
      58  
      59  void
      60  gwv_sl_1() {
      61  #pragma acc serial loop /* { dg-message "9: enclosing parent compute construct" } */ \
      62      gang(num:5) /* { dg-error "5: argument not permitted on 'gang' clause" } */ \
      63    worker(num:5) /* { dg-error "3: argument not permitted on 'worker' clause" } */ \
      64     vector(length:5) /* { dg-error "4: argument not permitted on 'vector' clause" } */
      65    for (int i = 0; i < 10; i++)
      66      ;
      67  }
      68  
      69  void
      70  gwv_sl_2() {
      71  #pragma acc serial loop /* { dg-message "9: enclosing parent compute construct" } */
      72    for (int i = 0; i < 10; i++)
      73      {
      74  #pragma acc loop /* { dg-bogus "enclosing parent compute construct" } */
      75        for (int j = 0; j < 10; j++)
      76  	{
      77  #pragma acc loop \
      78          gang(num:5) /* { dg-error "9: argument not permitted on 'gang' clause" } */ \
      79      worker(num:5) /* { dg-error "5: argument not permitted on 'worker' clause" } */ \
      80    vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
      81  	  for (int k = 0; k < 10; k++)
      82  	    ;
      83  	}
      84      }
      85  }
      86  
      87  void
      88  gwv_s_l() {
      89  #pragma acc serial /* { dg-message "9: enclosing parent compute construct" } */
      90    {
      91  #pragma acc loop \
      92         gang(num:5) /* { dg-error "8: argument not permitted on 'gang' clause" } */ \
      93     worker(num:5) /* { dg-error "4: argument not permitted on 'worker' clause" } */ \
      94    vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
      95      for (int i = 0; i < 10; i++)
      96        ;
      97  
      98  #pragma acc loop
      99      for (int i = 0; i < 10; i++)
     100        {
     101  #pragma acc loop /* { dg-bogus "enclosing parent compute construct" } */
     102  	for (int j = 0; j < 10; j++)
     103  	  {
     104  #pragma acc loop \
     105           gang(num:5) /* { dg-error "10: argument not permitted on 'gang' clause" } */ \
     106        worker(num:5) /* { dg-error "7: argument not permitted on 'worker' clause" } */ \
     107      vector(length:5) /* { dg-error "5: argument not permitted on 'vector' clause" } */
     108  	    for (int k = 0; k < 10; k++)
     109  	      ;
     110  	  }
     111        }
     112    }
     113  }
     114  
     115  void gwv_r();
     116  #pragma acc routine(gwv_r)
     117  
     118  void
     119  gwv_r() { /* { dg-message "1: enclosing routine" } */
     120  #pragma acc loop \
     121     gang(num:5) /* { dg-error "4: argument not permitted on 'gang' clause" } */ \
     122      worker(num:5) /* { dg-error "5: argument not permitted on 'worker' clause" } */ \
     123    vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
     124    for (int i = 0; i < 10; i++)
     125      ;
     126  
     127  #pragma acc loop
     128      for (int i = 0; i < 10; i++)
     129        {
     130  #pragma acc loop
     131  	for (int j = 0; j < 10; j++)
     132  	  {
     133  #pragma acc loop \
     134       gang(num:5) /* { dg-error "6: argument not permitted on 'gang' clause" } */ \
     135     worker(num:5) /* { dg-error "4: argument not permitted on 'worker' clause" } */ \
     136       vector(length:5) /* { dg-error "6: argument not permitted on 'vector' clause" } */
     137  	    for (int k = 0; k < 10; k++)
     138  	      ;
     139  	  }
     140        }
     141  }