2 ! { dg-options "-fbounds-check" }
3 ! { dg-shouldfail "foo" }
8 elemental
subroutine set_optional(i
,idef
,iopt
)
9 integer, intent(out
) :: i
10 integer, intent(in
) :: idef
11 integer, intent(in
), optional
:: iopt
12 if (present(iopt
)) then
17 end subroutine set_optional
20 integer , intent(in
), optional
:: ivec(:)
22 call set_optional(ivec_
,(/1,2/))
23 if (any (ivec_
/= (/1,2/))) call abort
24 call set_optional(ivec_
,(/1,2/),ivec
)
25 if (present (ivec
)) then
26 if (any (ivec_
/= ivec
)) call abort
28 if (any (ivec_
/= (/1,2/))) call abort
34 use sub_mod
, only
: sub
39 ! { dg-output "Fortran runtime error: Array bound mismatch" }
40 ! { dg-final { cleanup-modules "sub_mod" } }