Unsupported local variable with pgi 16.1/16.3

Hi all,
one of our codes is giving us an “Unsupported local variable” error at compile time when compiling with pgi 16.1 or 16.3, while it is working smoothly when compiled with pgi 15.9.

Are we doing something it is not supposed to be done?

Thanks in advance and Best Regards,


Here is a small reproducing example:

#include <openacc.h>
#include <accelmath.h>
#include <complex.h>

#define size 256

typedef struct vec_t {
    double complex c[size];
} vec;

static inline void f(__restrict vec * const u, const int idx) {
  u->c[idx] = 0;

void g( __restrict vec * const u) {

  int idx;

  #pragma acc kernels
  for(idx=0; idx<size; idx++) {

    // This is not working with pgi 16.1/16.3
    f(u, idx);

    // While this works:
    // u->c[d0h] = 0;

Hi Enrico,

I’m not sure what’s wrong but it’s most likely a compiler issue. Hence I wrote up a report (TPR#22450) and sent it to engineering for further review. Unfortunately I don’t see a work around other than keep using 15.10.


TPR 22450 - OpenACC: user code gets “Unsupported local variable” with 16.1, compiles with 15.10.

This problem appears to have been fixed in 16.4, but we did not verify
until later.