https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120286
Bug ID: 120286
Summary: [OpenMP] Double free detected when using openmp
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: itou.tetsuya at fujitsu dot com
Target Milestone: ---
The following program terminated with SIGSEGV.
This does not occur in gfortran-11 and earlier versions, but seems to occur in
gfortran-12 and later versions. It also did not occur with flang or ifort.
This does not occur if -fopenmp is not specified.
---
program main
implicit none
type fooPtr_t
class(foo_t), pointer :: p
end type fooPtr_t
type fooPtrStack_t
class(fooPtr_t), allocatable :: list(:)
end type fooPtrStack_t
type foo_t
integer :: dummy
end type foo_t
type(fooPtrStack_t) :: x
class(foo_t), pointer :: ptr
integer it, itmax, n, nmax
nmax = 1
allocate(x%list(nmax))
allocate(x%list(nmax)%p)
itmax = 32
do it = 1, itmax
!$omp parallel do default(none) private(n,ptr) shared(nmax,x)
do n = 1, nmax
ptr => x%list(n)%p
end do
end do
write(*,'(a)') 'done'
end program main
---
Results for 11.4 and 15.1:
https://godbolt.org/z/6f9KvG1av