2 ! { dg-options "-fbounds-check" }
3 ! Test the fix for PR42783, in which a bogus array bounds violation
4 ! with missing optional array argument.
6 ! Contributed by Harald Anlauf <anlauf@gmx.de>
10 character(len=8), parameter :: mnem_list(2) = "A"
12 call foo (mnem_list) ! This call succeeds
13 call foo () ! This call fails
15 subroutine foo (mnem_list)
16 character(len=8) ,intent(in) ,optional :: mnem_list(:)
19 character(len=256) :: ml
22 if (present (mnem_list)) then
23 do i = 1, size (mnem_list)
24 if (mnem_list(i) /= "") then
26 if (j > len (ml)/8) call abort ()
27 ml((j-1)*8+1:(j-1)*8+8) = mnem_list(i)
31 if (j > 0) print *, trim (ml(1:8))