alloc_comp_default_init_2.f90

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

F90
27
字号
! { dg-do run }! Tests the fix for PR35959, in which the structure subpattern was declared static! so that this test faied on the second recursive call.!! Contributed by Micha雔 Baudin <michael.baudin@gmail.com>!program testprog  type :: t_type    integer, dimension(:), allocatable :: chars  end type t_type  integer, save :: callnb = 0  type(t_type) :: this  allocate ( this % chars ( 4))  if (.not.recursivefunc (this) .or. (callnb .ne. 10)) call abort ()contains  recursive function recursivefunc ( this ) result ( match )    type(t_type), intent(in) :: this    type(t_type) :: subpattern    logical :: match    callnb = callnb + 1    match = (callnb == 10)    if ((.NOT. allocated (this % chars)) .OR. match) return    allocate ( subpattern % chars ( 4 ) )    match = recursivefunc ( subpattern )  end function recursivefuncend program testprog

⌨️ 快捷键说明

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