Syntax error on for-loop structure with multiple variable in

On for-loop structure with multiple variable in, I get the following error

#pragma acc parallel loop
    for (int i = 0, j = 0; i < 16; ++i, j += 4) { 
        // Some stuff ..  
    }

PGC-S-0035-Syntax error: Recovery attempted by replacing ‘,’ by ‘%=’
PGC-S-0058-Illegal lvalue

I’m not sure what I’m missing. I’ve looked over documentation for how a for-loop should look and I’m still confused. What’s wrong here?

One solution would be to replace by

    int i, j;
    j = 0;
#pragma acc parallel loop
    for (i = 0; i < 16; ++i)
    {
        j += 4;
        // Some stuff ..
    }

Is this correct with OpenACC?

Hi LeMoussel,

I believe we should support multiple initialization expressions and the syntax error you’re getting is an error on our part. I’ll submit a ticket to get that looked at.

In the meantime I would suggest sticking with the workaround you posted and leaving the loops to be as simple/standard as possible.

Hi LeMoussel,

The error should be fixed for pgcc on Linux with 20.1, once it is released.