Debian Codegraph @

gcc/testsuite/gfortran.dg/function_charlen_2.f90

raw
1 ! { dg-do compile }
2 ! Tests the fix for PR34429 in which function charlens that were
3 ! USE associated would cause an error.
4 !
5 ! Contributed by Tobias Burnus <[email protected]>
6 !
7 module m
8 integer, parameter :: l = 2
9 character(2) :: cl
10 end module m
11
12 program test
13 implicit none
14 integer, parameter :: l = 5
15 character(len = 10) :: c
16 character(4) :: cl
17 c = f ()
18 if (g () /= "2") STOP 1
19 contains
20 character(len = l) function f ()
21 use m
22 if (len (f) /= 2) STOP 2
23 f = "a"
24 end function f
25 character(len = len (cl)) function g ()
26 use m
27 g = "4"
28 if (len (g) == 2) g= "2"
29 end function g
30 end program test