aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/function_charlen_2.f90
blob: 5713c307bd9958192add1bae1bfa5e74a72d435a (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
30
! { dg-do compile }
! Tests the fix for PR34429 in which function charlens that were
! USE associated would cause an error.
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
!
module m
  integer, parameter :: l = 2
  character(2) :: cl
end module m

program test
  implicit none
  integer, parameter :: l = 5
  character(len = 10) :: c
  character(4) :: cl
  c = f ()
  if (g () /= "2") call abort
contains
  character(len = l) function f ()
    use m
    if (len (f) /= 2) call abort
    f = "a"
  end function f
  character(len = len (cl)) function g ()
    use m
    g = "4"
    if (len (g) == 2) g= "2"
  end function g
end program test