| Issue |
171943
|
| Summary |
[Flang][OpenMP] Execution occasionally terminates abnormally when the component of derived type with ALLOCATABLE attribute is referenced within PARALLEL COPYIN construct
|
| Labels |
flang:openmp
|
| Assignees |
|
| Reporter |
ohno-fj
|
```
Version of flang : 22.0.0(8378a6fa4f5c83298fb0b5e240bb7f254f7b1137)/AArch64
```
In the attached program (`snggr547_21.f90`), the component (`v1%a5`) of `derived type` with `ALLOCATABLE attribute` is referenced within `PARALLEL COPYIN construct`.
When attempting to execute this program, it terminates normally if the value of `environment variable (OMP_NUM_THREADS)` is 2 or less.
However, if that value is 4 or greater, the probability of an abnormal termination (segmentation fault) during execution appears to increase.
As shown below, when `OMP_NUM_THREADS=16`, 4 out of 10 runs terminated abnormally.
In the following cases, abnormal termination does not seem to occur.
- Use the component (`a5`) of `derived type` without `ALLOCATABLE attribute`
The above program is `snggr547_22.f90`.
The attached log shows 10 runs. I performed an additional 100 runs, but no abnormal termination occurred.
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
snggr547_21.f90:
```fortran
module m1
type:: x1
sequence
character(3),allocatable:: a5
end type x1
type (x1),save::v1
!$omp threadprivate(v1)
end module m1
subroutine s1
use m1
allocate(v1%a5,stat=k)
if (k/=0)print *,10001
v1%a5 = "abc"
!$omp parallel copyin(v1)
if ((v1%a5/='abc'))print *,105
!$omp end parallel
deallocate(v1%a5)
end subroutine s1
program main
call s1
print *,'pass'
end program main
```
```
$ export OMP_NUM_THREADS=16; flang -fopenmp snggr547_21.f90
$ ./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out
Segmentation fault (core dumped)
Segmentation fault (core dumped)
pass
Segmentation fault (core dumped)
pass
pass
pass
pass
Segmentation fault (core dumped)
pass
$
```
```
$ export OMP_NUM_THREADS=16; gfortran -fopenmp snggr547_21.f90
$ ./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
$
```
```
$ export OMP_NUM_THREADS=16; ifx -qopenmp snggr547_21.f90
$ ./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
$
```
snggr547_22.f90:
```fortran
module m1
type:: x1
sequence
character(3):: a5
end type x1
type (x1),save::v1
!$omp threadprivate(v1)
end module m1
subroutine s1
use m1
v1%a5 = "abc"
!$omp parallel copyin(v1)
if ((v1%a5/='abc'))print *,105
!$omp end parallel
end subroutine s1
program main
call s1
print *,'pass'
end program main
```
```
$ export OMP_NUM_THREADS=16; flang -fopenmp snggr547_22.f90
$ ./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out;./a.out
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
$
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs