Skip to content

[Flang][OpenMP] Execution error when derived type is specified in lastprivate clause of sections construct #114889

@ohno-fj

Description

@ohno-fj
Version of flang-new : 20.0.0(5621929f7f4878c318deecb592cd03f5ecbb83ba)/AArch64

When derived type is specified in lastprivate clause of sections construct, segmentation fault (core dumped) occurs.

The following are the test program, Flang-new, Gfortran and ifx compilation/execution result.

FT_OMP_LastPrivate_009_2232.f90:

program main
  type x
     integer::x2
     character(len=5)::c1
     integer,allocatable::x1(:,:)
  end type x
  type(x) :: v(2)
  allocate(v(1)%x1(2,2))
  v(1)%x1 = 11
!$omp parallel
!$omp sections lastprivate(v)
  if (any(v(1)%x1/=11)) print *,1201,v(1)%x1
  deallocate(v(1)%x1)
  allocate(v(1)%x1(4,6))
  v(1)%x1 = 21
!$omp end sections
!$omp end parallel
  print *,'PASS'
end program main
$ export OMP_NUM_THREADS=2; flang-new -fopenmp FT_OMP_LastPrivate_009_2232.f90; ./a.out
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
Segmentation fault (core dumped)
$
$ export OMP_NUM_THREADS=2; gfortran -fopenmp FT_OMP_LastPrivate_009_2232.f90; ./a.out
        1201           0           0           0           0
 PASS
$
$ export OMP_NUM_THREADS=2; ifx -qopenmp FT_OMP_LastPrivate_009_2232.f90; ./a.out
        1201           0           0           0           0
 PASS
$

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions