aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/deferred_character_21.f90
blob: 354c847556cc7f60d1cfed2c99028b671a12dcca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
! { dg-do compile }
! { dg-options "-O3" }
!
! Tests the fix for PR85954 in which the gimplifier could not determine
! the space required for the dummy argument data types, when inlining the
! subroutines.
!
! Contributed by G.Steinmetz  <gscfq@t-online.de>
!
program p
   character(kind=1,len=:), allocatable :: z(:)
   allocate (z, source = ["xyz"])
   print *, allocated(z), size(z), len(z), z
   call s(z)
   call t(z)
contains
   subroutine s(x)
      character(kind=1,len=:), allocatable :: x(:)
      x = ['abcd']
      print *, allocated(x), size(x), len(x), x
   end
   subroutine t(x)
      character(kind=1,len=:), allocatable :: x(:)
      associate (y => x)
         y = ['abc']
      end associate
      print *, allocated(x), size(x), len(x), x
   end
end