https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124348

            Bug ID: 124348
           Summary: [OpenMP] rejects valid, parsing problem with omp
                    target unroll partial while with nested brackets, i.e.
                     #pragma omp target     {     #pragma omp unroll
                    partial would work
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: schulz.benjamin at googlemail dot com
  Target Milestone: ---

compile with:


/usr/bin/g++-16  -fopenmp  -fopenmp -foffload=nvptx-none -O2 main.cpp

int
main ()
{
    int a[200];
    #pragma omp target enter data map (to: a[0:200])

    #pragma omp target unroll partial
    for (int i = 0; i < 200; i++)
    {
        a[i] = 2*i + 1;
    }

    return 0;
}


will stop with the following error

/home/benni/projects/openmptestnew/openmpoffloatest/main.cpp: In function 'int
main()':
/home/benni/projects/openmptestnew/openmpoffloatest/main.cpp:8:23: error:
expected an OpenMP clause before 'unroll'
    8 |    #pragma omp target unroll partial
      |                       ^~~~~~
gmake[3]: *** [CMakeFiles/gpu_compiler_test.dir/build.



while the following with a bracket between pragma omp target and pragma omp
unroll would work:

int
main ()
{

    int a[200];
    #pragma omp target enter data map (to: a[0:200])

   #pragma omp target
   {
      #pragma omp unroll partial
    for (int i = 0; i < 200; i++)
    {
        a[i] = 2*i + 1;
    }
   }


    return 0;
}

would compile without warning...

Reply via email to