This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[gomp] C++ #pragma omp for and -fno-for-scope
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>, Diego Novillo <dnovillo at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 25 Oct 2005 14:56:54 -0400
- Subject: [gomp] C++ #pragma omp for and -fno-for-scope
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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