1! { dg-do run } 2! Tests the fix for PR35959, in which the structure subpattern was declared static 3! so that this test faied on the second recursive call. 4! 5! Contributed by Micha�l Baudin <michael.baudin@gmail.com> 6! 7program testprog 8 type :: t_type 9 integer, dimension(:), allocatable :: chars 10 end type t_type 11 integer, save :: callnb = 0 12 type(t_type) :: this 13 allocate ( this % chars ( 4)) 14 if (.not.recursivefunc (this) .or. (callnb .ne. 10)) call abort () 15contains 16 recursive function recursivefunc ( this ) result ( match ) 17 type(t_type), intent(in) :: this 18 type(t_type) :: subpattern 19 logical :: match 20 callnb = callnb + 1 21 match = (callnb == 10) 22 if ((.NOT. allocated (this % chars)) .OR. match) return 23 allocate ( subpattern % chars ( 4 ) ) 24 match = recursivefunc ( subpattern ) 25 end function recursivefunc 26end program testprog 27