2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / bind_c_usage_23.f90
blob3917b9d3001de1e9ca8157f20eb2aaf344dede53
1 ! { dg-do compile }
2 ! { dg-options "-std=f2008" }
4 ! PR fortran/48858
5 ! PR fortran/48820
7 ! OPTIONAL + BIND(C) is allowed since TS 29113
10 ! VALID
11 subroutine sub(z) bind(C)
12 use iso_c_binding
13 integer(c_int), value :: z
14 end subroutine sub
16 ! VALID since TS29113
17 subroutine sub2(z) bind(C) ! { dg-error "with OPTIONAL attribute in procedure" }
18 use iso_c_binding
19 integer(c_int), optional :: z
20 end subroutine sub2
22 ! VALID since TS29113
23 subroutine sub2a(z) bind(C) ! { dg-error "with OPTIONAL attribute in procedure" }
24 use iso_c_binding
25 integer(c_int) :: z
26 optional :: z
27 end subroutine sub2a
29 ! VALID since TS29113
30 subroutine sub2b(z) bind(C) ! { dg-error "with OPTIONAL attribute in procedure" }
31 use iso_c_binding
32 optional :: z
33 integer(c_int) :: z
34 end subroutine sub2b
36 ! Invalid
37 subroutine sub3(z) bind(C) ! { dg-error "cannot have both the OPTIONAL and the VALUE attribute" }
38 use iso_c_binding
39 integer(c_int), value, optional :: z
40 end subroutine sub3
42 ! Invalid
43 subroutine sub3a(z) bind(C) ! { dg-error "cannot have both the OPTIONAL and the VALUE attribute" }
44 use iso_c_binding
45 integer(c_int) :: z
46 optional :: z
47 value :: z
48 end subroutine sub3a
50 ! Invalid
51 subroutine sub3b(z) bind(C) ! { dg-error "cannot have both the OPTIONAL and the VALUE attribute" }
52 use iso_c_binding
53 optional :: z
54 value :: z
55 integer(c_int) :: z
56 end subroutine sub3b
58 ! Invalid
59 subroutine sub3c(z) bind(C) ! { dg-error "cannot have both the OPTIONAL and the VALUE attribute" }
60 use iso_c_binding
61 value :: z
62 integer(c_int) :: z
63 optional :: z
64 end subroutine sub3c