OSDN Git Service

2007-07-09 Thomas Koenig <tkoenig@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / enum_10.f90
1 ! { dg-do run }
2 ! { dg-additional-sources enum_10.c }
3 ! { dg-options "-fshort-enums -w" }
4 ! Make sure short enums are indeed interoperable with the
5 ! corresponding C type.
6
7 module enum_10
8 enum, bind( c )
9    enumerator :: one1 = 1, two1, max1 = huge(1_1)
10 end enum
11
12 enum, bind( c )
13    enumerator :: one2 = 1, two2, max2 = huge(1_2)
14 end enum
15
16 enum, bind( c )
17    enumerator :: one4 = 1, two4, max4 = huge(1_4)
18 end enum
19 end module enum_10
20
21 use enum_10
22
23 interface f1
24   subroutine f1(i,j)
25     use enum_10
26     integer (kind(max1)) :: i
27     integer :: j
28   end subroutine f1
29 end interface
30
31
32 interface f2
33   subroutine f2(i,j)
34     use enum_10
35     integer (kind(max2)) :: i
36     integer :: j
37   end subroutine f2
38 end interface
39
40
41 interface f4
42   subroutine f4(i,j)
43     use enum_10
44     integer (kind(max4)) :: i
45     integer :: j
46   end subroutine f4
47 end interface
48
49
50 call f1 (one1, 1)
51 call f1 (two1, 2)
52 call f1 (max1, huge(1_1)+0) ! Adding 0 to get default integer
53
54 call f2 (one2, 1)
55 call f2 (two2, 2)
56 call f2 (max2, huge(1_2)+0)
57
58 call f4 (one4, 1)
59 call f4 (two4, 2)
60 call f4 (max4, huge(1_4)+0)
61 end
62
63 ! { dg-final { cleanup-modules "enum_10" } }