summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/enum_10.f90
blob: 99a16901c4b5a94070895bdb196e919cdacf73c3 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
! { dg-do run }
! { dg-additional-sources enum_10.c }
! { dg-options "-fshort-enums -w" }
! { dg-options "-fshort-enums -w -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
! Make sure short enums are indeed interoperable with the
! corresponding C type.

module enum_10
enum, bind( c )
   enumerator :: one1 = 1, two1, max1 = huge(1_1)
end enum

enum, bind( c )
   enumerator :: one2 = 1, two2, max2 = huge(1_2)
end enum

enum, bind( c )
   enumerator :: one4 = 1, two4, max4 = huge(1_4)
end enum
end module enum_10

use enum_10

interface f1
  subroutine f1(i,j)
    use enum_10
    integer (kind(max1)) :: i
    integer :: j
  end subroutine f1
end interface


interface f2
  subroutine f2(i,j)
    use enum_10
    integer (kind(max2)) :: i
    integer :: j
  end subroutine f2
end interface


interface f4
  subroutine f4(i,j)
    use enum_10
    integer (kind(max4)) :: i
    integer :: j
  end subroutine f4
end interface


call f1 (one1, 1)
call f1 (two1, 2)
call f1 (max1, huge(1_1)+0) ! Adding 0 to get default integer

call f2 (one2, 1)
call f2 (two2, 2)
call f2 (max2, huge(1_2)+0)

call f4 (one4, 1)
call f4 (two4, 2)
call f4 (max4, huge(1_4)+0)
end

! { dg-final { cleanup-modules "enum_10" } }