PGC-S-0037-Syntax error: Recovery attempted by deleting '{'

Hi, All:

I am trying to compile a simple saxpy.c file using the new PGI compiler pgcc 15.4 with OpenACC support, however during the compilation stage I met a PGC-S-0037-Syntax error: Recovery attempted by deleting '{’ error which does not occur for the previous PGI compiler versions:

[fchen14@shelob1 solution]$ cat saxpy_acc_le.c

#include <stdio.h>
#include <time.h>
#include <omp.h>

int main() {
  long long int i, n=500000000;
  float a=2.0;
  float x[n];
  float y[n];
  double start_time, end_time;

  a = 2.0;
#pragma acc data create(x[0:n],y[0:n]) copyin(a)
    {
#pragma acc kernels loop
      for (i = 0; i < n; i++){
        x[i] = 1.0;
        y[i] = 2.0;
      }

      start_time = omp_get_wtime();
#pragma acc kernels loop
    {
        for (i = 0; i < n; i++){
          y[i] = a*x[i] + y[i];
        }
    }
      end_time = omp_get_wtime();
    }

  printf ("SAXPY Time: %f\n", end_time - start_time);

}

[fchen14@shelob1 solution]$ pgcc --version

pgcc 15.4-0 64-bit target on x86-64 Linux -tp sandybridge
The Portland Group - PGI Compilers and Tools
Copyright © 2015, NVIDIA CORPORATION. All rights reserved.

[fchen14@shelob1 solution]$ pgcc -acc saxpy_acc_le.c
PGC-S-0037-Syntax error: Recovery attempted by deleting ‘{’ (saxpy_acc_le.c: 23)
PGC-S-0036-Syntax error: Recovery attempted by inserting ‘=’ before ‘(’ (saxpy_acc_le.c: 31)
PGC-S-0043-Redefinition of symbol, printf (saxpy_acc_le.c: 31)
PGC-S-0037-Syntax error: Recovery attempted by deleting ‘}’ (saxpy_acc_le.c: 33)
PGC-S-0039-Use of undeclared variable end_time (saxpy_acc_le.c: 31)
PGC-S-0039-Use of undeclared variable start_time (saxpy_acc_le.c: 31)
PGC-S-0074-Non-constant expression in initializer (saxpy_acc_le.c: 31)
PGC-W-0156-Type not specified, ‘int’ assumed (saxpy_acc_le.c: 31)
PGC/x86-64 Linux 15.4-0: compilation completed with severe errors

The program will compile fine if I remove the pair of curly braces ‘{’ and ‘}’ at line 23 and line 27, however should the compiler be able to recognize the compound statement for this case?

The problem does not occur for the pgcc 14.3 version:

[fchen14@shelob1 solution]$ pgcc --version

pgcc 14.3-0 64-bit target on x86-64 Linux -tp sandybridge
The Portland Group - PGI Compilers and Tools
Copyright © 2014, NVIDIA CORPORATION. All rights reserved.
[fchen14@shelob1 solution]$ pgcc saxpy_acc_le.c
[fchen14@shelob1 solution]$

Is there any changes for the compiler rules for PGI 15.4? Any suggestion is welcome, thanks a lot!

Feng Chen

The program will compile fine if I remove the pair of curly braces ‘{’ and ‘}’ at line 23 and line 27, however should the compiler be able to recognize the compound statement for this case?

No. The next statement after a “kernel loop” should be a loop. Your options here are to either remove the curly braces or remove “loop” to make it a kernels region.

  • Mat

Hi, Mat:

Thanks for the update, may I understand in this way that the newest compiler 15.4 is now enforcing the rule that the statement after the

#pragma acc kernels loop

must be a single loop statement?

Thanks,

Feng

Hi Feng,

It’s more that it happened to “work” in older compilers. The OpenACC standard specifies in section 2.7 that “a loop directive applies to the loop which must immediately follow this directive”.

  • Mat