1! { dg-do compile } 2! { dg-options "-std=f2008" } 3! 4! PR fortran/48858 5! PR fortran/48820 6! 7! OPTIONAL + BIND(C) is allowed since TS 29113 8! 9 10! VALID 11subroutine sub(z) bind(C) 12 use iso_c_binding 13 integer(c_int), value :: z 14end subroutine sub 15 16! VALID since TS29113 17subroutine sub2(z) bind(C) ! { dg-error "with OPTIONAL attribute in procedure" } 18 use iso_c_binding 19 integer(c_int), optional :: z 20end subroutine sub2 21 22! VALID since TS29113 23subroutine sub2a(z) bind(C) ! { dg-error "with OPTIONAL attribute in procedure" } 24 use iso_c_binding 25 integer(c_int) :: z 26 optional :: z 27end subroutine sub2a 28 29! VALID since TS29113 30subroutine sub2b(z) bind(C) ! { dg-error "with OPTIONAL attribute in procedure" } 31 use iso_c_binding 32 optional :: z 33 integer(c_int) :: z 34end subroutine sub2b 35 36! Invalid 37subroutine 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 40end subroutine sub3 41 42! Invalid 43subroutine 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 48end subroutine sub3a 49 50! Invalid 51subroutine 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 56end subroutine sub3b 57 58! Invalid 59subroutine 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 64end subroutine sub3c 65