Issue 86907
Summary [Flang][OpenMP] Issues in copyprivate
Labels flang:openmp
Assignees luporl
Reporter harishch4
    Here is a list of test cases that are failing in flang-new but are working in other compilers.
Godbolt [link](https://godbolt.org/z/b3hKvKjEj)
```
subroutine test1
    use omp_lib
    implicit none
    character xz
    common/c/xz
 !$omp threadprivate(/c/)
    !$omp parallel num_threads(4)
 !$omp single
        xz = 'c'
        !$omp end single copyprivate(/c/)
    !$omp end parallel
end

error: COMMON block must be declared in the same scoping unit in which the OpenMP directive or clause appears
          !$omp end single copyprivate(/c/)
```

```
!fails in gfortran but all other compilers accepting this

subroutine test2
    real z
    !$omp parallel private(z) num_threads(2)
    !$omp single
        z = -2
 !$omp end single copyprivate(z,z)
    !$omp end parallel
end 
```

```
subroutine test3
    use omp_lib
    !$omp parallel private(xz) num_threads(2)
    xz = f()
    !$omp end parallel
contains
    function f() result(rz)
        !$omp single
        rz = 42
        !$omp end single copyprivate(rz)
 end function
end subroutine

error: COPYPRIVATE variable 'rz' is not PRIVATE or THREADPRIVATE in outer context
          !$omp end single copyprivate(rz)
 ^^
```


```
subroutine test4
    use omp_lib
 implicit none
    call test
contains
    subroutine test
 real, pointer :: xz
        !$omp parallel private(xz) num_threads(2)
 xz => fz()
        !$omp end parallel
    end subroutine
 function fz()
        real, pointer :: fz
        nullify (fz)
 !$omp single
        allocate (fz)
        fz = 42
        !$omp end single copyprivate(fz)
    end function
end subroutine

 error: COPYPRIVATE variable 'fz' is not PRIVATE or THREADPRIVATE in outer context
          !$omp end single copyprivate(fz)
 ^^
```


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

Reply via email to