https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107424
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
For completeness, the C testcase to previous comment (comment 3) is as follows.
Contrary to Fortran, I put a 'lastprivate' to all variables – to match the
current
patch (→ see (A) in comment 3).
int n,m,p, i,j,k;
n = 11; m = 23; p = 27;
#pragma omp simd collapse(3) lastprivate(k) lastprivate(i) lastprivate(j)
for (i = 1; i <= n; i++)
for (j = 1; j <= m; j++)
for (k = j - 41; k <= p; k++)
if (k < 1 - 41 || k > p)
__builtin_printf ("%d %d %d\n", i, j, k);
if (i != n + 1) __builtin_abort ();
if (j != m + 1) __builtin_abort ();
if (k != p + 1) __builtin_abort ();
The code works fine. The original dump is also the same, except for the '* 1':
#pragma omp simd lastprivate(j) lastprivate(i) lastprivate(k) collapse(3)
...
for (k = j * 1 + -41; k <= p; k++ )
but in the gimple dump, the result is:
#pragma omp simd lastprivate(j) lastprivate(i) lastprivate(k) collapse(3) \
private(k.2) private(j.1) private(i.0)
for (i.0 = 1; i.0 <= n; i.0 = i.0 + 1)
for (j.1 = 1; j.1 <= m; j.1 = j.1 + 1)
for (k.2 = j.1 * 1 + -41; k.2 <= p; k.2 = k.2 + 1)
where 'j' has been replaced by 'j.1' and not been hosted before the loop.