aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/bind_c_usage_23.f90
blob: 3917b9d3001de1e9ca8157f20eb2aaf344dede53 (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 compile }
! { dg-options "-std=f2008" }
!
! PR fortran/48858
! PR fortran/48820
!
! OPTIONAL + BIND(C) is allowed since TS 29113
!

! VALID
subroutine sub(z) bind(C)
  use iso_c_binding
  integer(c_int), value :: z
end subroutine sub

! VALID since TS29113
subroutine sub2(z) bind(C) ! { dg-error "with OPTIONAL attribute in procedure" }
  use iso_c_binding
  integer(c_int), optional :: z
end subroutine sub2

! VALID since TS29113
subroutine sub2a(z) bind(C) ! { dg-error "with OPTIONAL attribute in procedure" }
  use iso_c_binding
  integer(c_int) :: z
  optional :: z
end subroutine sub2a

! VALID since TS29113
subroutine sub2b(z) bind(C) ! { dg-error "with OPTIONAL attribute in procedure" }
  use iso_c_binding
  optional :: z
  integer(c_int) :: z
end subroutine sub2b

! Invalid
subroutine sub3(z) bind(C) ! { dg-error "cannot have both the OPTIONAL and the VALUE attribute" }
  use iso_c_binding
  integer(c_int), value, optional :: z
end subroutine sub3

! Invalid
subroutine sub3a(z) bind(C) ! { dg-error "cannot have both the OPTIONAL and the VALUE attribute" }
  use iso_c_binding
  integer(c_int) :: z
  optional :: z
  value :: z
end subroutine sub3a

! Invalid
subroutine sub3b(z) bind(C) ! { dg-error "cannot have both the OPTIONAL and the VALUE attribute" }
  use iso_c_binding
  optional :: z
  value :: z
  integer(c_int) :: z
end subroutine sub3b

! Invalid
subroutine sub3c(z) bind(C) ! { dg-error "cannot have both the OPTIONAL and the VALUE attribute" }
  use iso_c_binding
  value :: z
  integer(c_int) :: z
  optional :: z
end subroutine sub3c