Open
Description
Version of flang : 21.0.0(8c7c791284877e36f73c41ffa56b52c13e613993)/AArch64
As in the attached program, when derived-type array (str)
is defined using derived type (ty1)
and reshape intrinsic function
in where construct
, a compilation error occurs.
When the compilation option (-flang-deprecated-no-hlfir) is specified, the following message is outputted:
not yet implemented: allocatable components in derived type assignment
The above program is snfmm509_21.f90
.
When reshape intrinsic function
is not used, the compilation succeeds.
The above program is snfmm509_22.f90
.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
snfmm509_21.f90:
program main
call test06()
print *,'pass'
end program main
subroutine test06()
type ty1
integer ,allocatable :: a(:,:,:)
end type ty1
type(ty1) :: str(1)
integer ,allocatable :: b(:,:,:)
allocate(str(1)%a(1,1,1),b(1,1,1))
b=1
write(6,*) "b = ", b
write(6,*) "reshape((/(b,jj=1,1)/),(/1,1,1/)) = ", reshape((/(b,jj=1,1)/),(/1,1,1/))
! where ((/.true./)) str=(/(ty1(b ),ii=1,1)/) ! compilation normal termination
where ((/.true./)) str=(/(ty1(reshape((/(b,jj=1,1)/),(/1,1,1/))),ii=1,1)/) ! compilation error
end subroutine test06
$ flang snfmm509_21.f90 -flang-deprecated-no-hlfir
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/Metro/fe2_05/snfmm509_21.f90":17:3): /work/groups/ssoft/compiler/llvm/src/llvm-main/flang/lib/Lower/ConvertExpr.cpp:1012: not yet implemented: allocatable components in derived type assignment
LLVM ERROR: aborting
$ flang snfmm509_21.f90
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/Metro/fe2_05/snfmm509_21.f90":17:3): failed to legalize operation 'hlfir.exactly_once'
error: failure in HLFIR bufferization pass
error: Lowering to LLVM IR failed
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/Metro/fe2_05/snfmm509_21.f90":1:1): cannot be converted to LLVM IR: missing `LLVMTranslationDialectInterface` registration for dialect for op: func.func
error: failed to create the LLVM module
$
$ gfortran snfmm509_21.f90; ./a.out
b = 1
reshape((/(b,jj=1,1)/),(/1,1,1/)) = 1
pass
$
$ ifx snfmm509_21.f90; ./a.out
b = 1
reshape((/(b,jj=1,1)/),(/1,1,1/)) = 1
pass
$
snfmm509_22.f90:
program main
call test06()
print *,'pass'
end program main
subroutine test06()
type ty1
integer ,allocatable :: a(:,:,:)
end type ty1
type(ty1) :: str(1)
integer ,allocatable :: b(:,:,:)
allocate(str(1)%a(1,1,1),b(1,1,1))
b=1
write(6,*) "b = ", b
write(6,*) "reshape((/(b,jj=1,1)/),(/1,1,1/)) = ", reshape((/(b,jj=1,1)/),(/1,1,1/))
where ((/.true./)) str=(/(ty1(b ),ii=1,1)/) ! compilation normal termination
! where ((/.true./)) str=(/(ty1(reshape((/(b,jj=1,1)/),(/1,1,1/))),ii=1,1)/) ! compilation error
end subroutine test06
$ flang snfmm509_22.f90; ./a.out
b = 1
reshape((/(b,jj=1,1)/),(/1,1,1/)) = 1
pass
$
Metadata
Metadata
Assignees
Type
Projects
Status
Todo