<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/114888>114888</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] [OpenMP] Execution error when derived type with nested definitions is specified in private clause of parallel construct
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:openmp
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ohno-fj
      </td>
    </tr>
</table>

<pre>
    ```
Version of flang-new : 20.0.0(5621929f7f4878c318deecb592cd03f5ecbb83ba)/AArch64
```

When `derived type` with nested definitions is specified in a `private` clause of `parallel` construct, segmentation fault (core dumped) occurs.  
The above statement is (2) in the program.  
Terminates normally if not nested. 
The above statement is (1) in the program.

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

sngg188a_2.f90:
```fortran
module m1
  type y
 integer:: y1=2
  end type y
  type x
     integer:: x1=1
 type(y),allocatable:: x2(:)
  end type x
end module m1

subroutine s1
  use m1
  type(x):: v1
  allocate( v1%x2(2:3))
  v1%x2(2:3)%y1=[2,3]
!$omp parallel private( v1 )
 v1%x1=2          ! (1)
  v1%x2%y1=-1      ! (2)
!$omp end parallel
end subroutine s1

program main
  call s1
  print *,'pass'
end program main
```

```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp sngg188a_2.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 sngg188a_2.f90; ./a.out
 pass
$
```

```
$ export OMP_NUM_THREADS=2; ifx -qopenmp sngg188a_2.f90; ./a.out
 pass
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VVGP2zYM_jXKC5HApuzEechD7q7ZXroWa7c-FrJNOypkyZPkXPLvB8l2LpcesHvogsA2JfIj-YkihXOy1UQ7lj-w_Gk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