Issue 184345
Summary parsing problem #pragma omp target unroll partial ignores unroll partial on -O2, while nesting with brackets #pragma omp target {#pragma omp unroll ...} works in clang 22
Labels clang
Assignees
Reporter bschulz81
    compile with 

 /usr/lib/llvm/22/bin/clang++ -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -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;
}
```

creates a warning

> CMakeFiles/gpu_compiler_test.dir/main.cpp.o.d -o CMakeFiles/gpu_compiler_test.dir/main.cpp.o -c /home/benni/projects/openmptestnew/openmpoffloatest/main.cpp
> /home/benni/projects/openmptestnew/openmpoffloatest/main.cpp:8:24: warning: extra tokens at the end of '#pragma omp target' are ignored [-Wextra-tokens]
>     8 |     #pragma omp target unroll partial
>       | ^
> 1 warning generated.
> /home/benni/projects/openmptestnew/openmpoffloatest/main.cpp:8:24: warning: extra tokens at the end of '#pragma omp target' are ignored [-Wextra-tokens]


That it ignores unroll partial, 


The code below, which merely puts a bracket between the openmp pragmas, compiles without the warning (it appears the partial unroll is then compiled) 


```
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;
}
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to