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