Skip to content

[Flang][OpenMP] Execution error (Segmentation fault) when an allocatable array is used in task construct with a firstprivate clause in a parallel construct with a private clause #86621

Closed
@ohno-fj

Description

@ohno-fj
Version of flang-new : 19.0.0(cbcdf126ccc774c063b5d5140c1393ff5305dded)/AArch64

When an allocatable array is used in task construct with a firstprivate clause in a parallel construct with a private clause, the execution terminates abnormally (Segmentation fault).

Execution terminates normally in the following cases:

  • Array (a) is not an allocatable array, or
  • Do not write task construct

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

omp3_task_firstprivate_013_232.f90:

program main
  integer(4),allocatable::a(:)
  allocate(a(10))
  a(9)=100
!$omp parallel private(a)
!$omp task firstprivate(a)
  a(9)=10
!$omp end task
!$omp end parallel
  write(6,*) "a(9) = ", a(9)
end program main
$ export OMP_NUM_THREADS=2; flang-new -fopenmp omp3_task_firstprivate_013_232.f90; ./a.out
Segmentation fault (core dumped)
$
$ export OMP_NUM_THREADS=2; gfortran -fopenmp omp3_task_firstprivate_013_232.f90; ./a.out
 a(9) =          100
$
$ export OMP_NUM_THREADS=2; ifort -qopenmp -diag-disable=10448 omp3_task_firstprivate_013_232.f90; ./a.out
 a(9) =          100
$

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions