ieee_9.f90: XFAIL on arm*-*-gnueabi[hf].
[official-gcc.git] / gcc / testsuite / gfortran.dg / value_5.f90
blob4b0dcefb3409aaee312b84a0db8ab291cb7361f3
1 ! { dg-do compile }
2 ! Length of character dummy variable with VALUE attribute:
3 ! - must be initialization expression or omitted
4 ! - C interoperable: must be initialization expression of length one
5 ! or omitted
7 ! Contributed by Tobias Burnus
8 program x
9 implicit none
10 character(10) :: c1,c10
11 c1 = 'H'
12 c10 = 'Main'
13 call foo1(c1)
14 call foo2(c1)
15 call foo3(c10)
16 call foo4(c10)
17 call bar1(c1)
18 call bar2(c1)
19 call bar3(c10)
20 call bar4(c10)
22 contains
24 subroutine foo1(a)
25 character :: a
26 value :: a
27 end subroutine foo1
29 subroutine foo2(a)
30 character(1) :: a
31 value :: a
32 end subroutine foo2
34 subroutine foo3(a)
35 character(10) :: a
36 value :: a
37 end subroutine foo3
39 subroutine foo4(a) ! { dg-error "VALUE attribute must have constant length" }
40 character(*) :: a
41 value :: a
42 end subroutine foo4
44 subroutine bar1(a)
45 use iso_c_binding, only: c_char
46 character(kind=c_char) :: a
47 value :: a
48 end subroutine bar1
50 subroutine bar2(a)
51 use iso_c_binding, only: c_char
52 !character(kind=c_char,len=1) :: a
53 character(1,kind=c_char) :: a
54 value :: a
55 end subroutine bar2
57 subroutine bar3(a) ! { dg-error "VALUE attribute must have length one" }
58 use iso_c_binding, only: c_char
59 character(kind=c_char,len=10) :: a
60 value :: a
61 end subroutine bar3
63 subroutine bar4(a) ! { dg-error "VALUE attribute must have constant length" }
64 use iso_c_binding, only: c_char
65 character(kind=c_char,len=*) :: a
66 value :: a
67 end subroutine bar4
68 end program x