Restrictions on directives with no language statement

The public comment period closed January 31, 2008. This forum is now locked (read only).

Restrictions on directives with no language statement

Postby dmikh » Wed Jan 23, 2008 10:17 am

I have a question about example A.23.
A.23 (p216, l17-18) says "The following example is non-conforming, because the flush, barrier, and taskwait directives cannot be the immediate substatement of an if statement." but would the following program be conforming?

Code: Select all
void foo()
{
  int a = 1;
#pragma omp parallel
  {
    if (a != 0)
#pragma omp flush(a)
    {
    }

    if (a != 0)
#pragma omp barrier
    {
    }

    if (a != 0)
#pragma omp taskwait
    {
    }
  }
}

void bar()
{
  int a = 1;
#pragma omp parallel
  {
    if (a != 0)
#pragma omp flush(a)
      ;

    if (a != 0)
#pragma omp barrier
      ;

    if (a != 0)
#pragma omp taskwait
      ;
  }
}


The program also has flush, barrier, and taskwait directives as "immediate substatements" (although this term is not defined anywhere).
In my opinion this program is valid, because all these directives can be deleted without getting incorrect syntax. It conforms to 2.8.3 (p64, l6-9), 2.8.6 (p69, l12-15) and 2.8.4 (p65, l13-16) "The directive ... may only be placed in the program at a position where ignoring or deleting the directive would result in a program with correct syntax".

Also, flush, barrier, and taskwait directives have no sense if placed at file-scope level. But according to previously noted Draft sections it is allowed.
dmikh
 
Posts: 5
Joined: Wed Jan 23, 2008 8:44 am

Re: Restrictions on directives with no language statement

Postby lfm » Tue Jan 29, 2008 2:58 pm

I have added this to the language committee's list. Thanks.
lfm
 
Posts: 135
Joined: Sun Oct 21, 2007 4:58 pm
Location: OpenMP ARB


Return to Draft 3.0 Public Comment

Who is online

Users browsing this forum: No registered users and 1 guest