char_array_structure_constructor.f90

来自「用于进行gcc测试」· F90 代码 · 共 31 行

F90
31
字号
! { dg-do run }! This test the fix of PR19107, where character array actual! arguments in derived type constructors caused an ICE.! It also checks that the scalar counterparts are OK.! Contributed by Paul Thomas  pault@gcc.gnu.org!MODULE global  TYPE :: dt    CHARACTER(4) a    CHARACTER(4) b(2)  END TYPE  TYPE (dt), DIMENSION(:), ALLOCATABLE, SAVE :: cEND MODULE globalprogram char_array_structure_constructor  USE global  call alloc (2)  if ((any (c%a /= "wxyz")) .OR. &      (any (c%b(1) /= "abcd")) .OR. &      (any (c%b(2) /= "efgh"))) call abort ()contains  SUBROUTINE alloc (n)    USE global    ALLOCATE (c(n), STAT=IALLOC_FLAG)    DO i = 1,n      c (i) = dt ("wxyz",(/"abcd","efgh"/))    ENDDO  end subroutine allocEND program char_array_structure_constructor! { dg-final { cleanup-modules "global" } }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?