Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flang][OpenMP] Compilation error when lastprivate clause specified in do construct has a derived type with an allocatable variable #91928

Closed
ohno-fj opened this issue May 13, 2024 · 3 comments · Fixed by #100417

Comments

@ohno-fj
Copy link

ohno-fj commented May 13, 2024

Version of flang-new : 19.0.0(1a498103ee5c4d101e70dc49db11938d8b87b518)/AArch64

When lastprivate clause specified in do construct has a derived type with an allocatable variable, a compilation terminates abnormally.
When lastprivate clause in do construct is removed, a compilation terminates normally.

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

lp10_32.f90:

subroutine s4
  type y3
     integer,allocatable::x
  end type y3
  type(y3)::v
  allocate(v%x)
  v%x=0
!$omp parallel
  if (.not. allocated(v%x)) print *,'101'
!$omp do lastprivate(v)
  do i=1,10
     v%x=i
  end do
!$omp end do
!$omp end parallel
end subroutine s4

program main
  call s4
  print *,'pass'
end program main
$ export OMP_NUM_THREADS=2; flang-new -fopenmp lp10_32.f90; ./a.out

fatal Fortran runtime error(/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_omp40/lp10_32.f90:12): Assign: mismatching types (to code 64 != from code 9)
fatal Fortran runtime error(/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_omp40/lp10_32.f90:12): Assign: mismatching types (to code 64 != from code 9)

Aborted (core dumped)
$
$ export OMP_NUM_THREADS=2; gfortran -fopenmp lp10_32.f90; ./a.out
 pass
$
$ export OMP_NUM_THREADS=2; ifort -qopenmp -diag-disable=10448 lp10_32.f90; ./a.out
 pass
$
@ohno-fj ohno-fj added openmp flang Flang issues not falling into any other category labels May 13, 2024
@llvmbot
Copy link
Member

llvmbot commented May 13, 2024

@llvm/issue-subscribers-openmp

Author: None (ohno-fj)

``` Version of flang-new : 19.0.0(1a49810)/AArch64 ```

When lastprivate clause specified in do construct has a derived type with an allocatable variable, a compilation terminates abnormally.
When lastprivate clause in do construct is removed, a compilation terminates normally.

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

lp10_32.f90:

subroutine s4
  type y3
     integer,allocatable::x
  end type y3
  type(y3)::v
  allocate(v%x)
  v%x=0
!$omp parallel
  if (.not. allocated(v%x)) print *,'101'
!$omp do lastprivate(v)
  do i=1,10
     v%x=i
  end do
!$omp end do
!$omp end parallel
end subroutine s4

program main
  call s4
  print *,'pass'
end program main
$ export OMP_NUM_THREADS=2; flang-new -fopenmp lp10_32.f90; ./a.out

fatal Fortran runtime error(/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_omp40/lp10_32.f90:12): Assign: mismatching types (to code 64 != from code 9)
fatal Fortran runtime error(/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_omp40/lp10_32.f90:12): Assign: mismatching types (to code 64 != from code 9)

Aborted (core dumped)
$
$ export OMP_NUM_THREADS=2; gfortran -fopenmp lp10_32.f90; ./a.out
 pass
$
$ export OMP_NUM_THREADS=2; ifort -qopenmp -diag-disable=10448 lp10_32.f90; ./a.out
 pass
$

@tblah
Copy link
Contributor

tblah commented Jul 24, 2024

Thank you for reporting this. It should be fixed by #100417

@EugeneZelenko EugeneZelenko added flang:ir flang:openmp and removed openmp flang Flang issues not falling into any other category labels Jul 24, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 24, 2024

@llvm/issue-subscribers-flang-ir

Author: None (ohno-fj)

``` Version of flang-new : 19.0.0(1a49810)/AArch64 ```

When lastprivate clause specified in do construct has a derived type with an allocatable variable, a compilation terminates abnormally.
When lastprivate clause in do construct is removed, a compilation terminates normally.

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

lp10_32.f90:

subroutine s4
  type y3
     integer,allocatable::x
  end type y3
  type(y3)::v
  allocate(v%x)
  v%x=0
!$omp parallel
  if (.not. allocated(v%x)) print *,'101'
!$omp do lastprivate(v)
  do i=1,10
     v%x=i
  end do
!$omp end do
!$omp end parallel
end subroutine s4

program main
  call s4
  print *,'pass'
end program main
$ export OMP_NUM_THREADS=2; flang-new -fopenmp lp10_32.f90; ./a.out

fatal Fortran runtime error(/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_omp40/lp10_32.f90:12): Assign: mismatching types (to code 64 != from code 9)
fatal Fortran runtime error(/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_omp40/lp10_32.f90:12): Assign: mismatching types (to code 64 != from code 9)

Aborted (core dumped)
$
$ export OMP_NUM_THREADS=2; gfortran -fopenmp lp10_32.f90; ./a.out
 pass
$
$ export OMP_NUM_THREADS=2; ifort -qopenmp -diag-disable=10448 lp10_32.f90; ./a.out
 pass
$

llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Jul 25, 2024
yuxuanchen1997 pushed a commit that referenced this issue Jul 25, 2024
Summary: Fixes #91928

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250643
tru pushed a commit to llvmbot/llvm-project that referenced this issue Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants