annotate gcc/testsuite/gfortran.dg/bounds_check_15.f90 @ 132:d34655255c78

update gcc-8.2
author mir3636
date Thu, 25 Oct 2018 10:21:07 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 ! { dg-options "-fbounds-check" }
kono
parents:
diff changeset
3 ! Test the fix for PR42783, in which a bogus array bounds violation
kono
parents:
diff changeset
4 ! with missing optional array argument.
kono
parents:
diff changeset
5 !
kono
parents:
diff changeset
6 ! Contributed by Harald Anlauf <anlauf@gmx.de>
kono
parents:
diff changeset
7 !
kono
parents:
diff changeset
8 program gfcbug99
kono
parents:
diff changeset
9 implicit none
kono
parents:
diff changeset
10 character(len=8), parameter :: mnem_list(2) = "A"
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 call foo (mnem_list) ! This call succeeds
kono
parents:
diff changeset
13 call foo () ! This call fails
kono
parents:
diff changeset
14 contains
kono
parents:
diff changeset
15 subroutine foo (mnem_list)
kono
parents:
diff changeset
16 character(len=8) ,intent(in) ,optional :: mnem_list(:)
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 integer :: i,j
kono
parents:
diff changeset
19 character(len=256) :: ml
kono
parents:
diff changeset
20 ml = ''
kono
parents:
diff changeset
21 j = 0
kono
parents:
diff changeset
22 if (present (mnem_list)) then
kono
parents:
diff changeset
23 do i = 1, size (mnem_list)
kono
parents:
diff changeset
24 if (mnem_list(i) /= "") then
kono
parents:
diff changeset
25 j = j + 1
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
26 if (j > len (ml)/8) STOP 1
111
kono
parents:
diff changeset
27 ml((j-1)*8+1:(j-1)*8+8) = mnem_list(i)
kono
parents:
diff changeset
28 end if
kono
parents:
diff changeset
29 end do
kono
parents:
diff changeset
30 end if
kono
parents:
diff changeset
31 if (j > 0) print *, trim (ml(1:8))
kono
parents:
diff changeset
32 end subroutine foo
kono
parents:
diff changeset
33 end program gfcbug99