Hi!

While looking at PR c++/24512, I have noticed that for
#pragma omp {,parallel }for loops we don't handle -fno-for-scope
and don't emit the default error messages that point people to
the problem otherwise.

So my question is, should we consider #pragma omp for and
#pragma omp parallel for a separate scope around the for loop for
this kind of purpose or not?  I think it would be better to be
consistent with -fno-openmp (i.e. if there is a declaration
in the for loop, move the DECL_EXPR right before the loop, either
into a separate sk_for scope if flag_new_for_scope > 0, or just into
the parent scope at that point) and create sk_omp scope for the
rest of the construct.

What do you think?

extern void bar (int);

void foo ()
{
#pragma omp for lastprivate (i)
  for (int i = 0; i < 10; i++)
    bar (i);
  bar (i);
#pragma omp parallel for lastprivate (j)
  for (int j = 0; j < 10; j++)
    bar (j);
  bar (j);
}

        Jakub

Reply via email to