OSDN Git Service

2010-04-08 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / bounds_check_strlen_6.f90
1 ! { dg-do run }
2 ! { dg-options "-fbounds-check" }
3
4 ! PR fortran/37746
5 ! Ensure that too long or matching string lengths don't trigger the runtime
6 ! error for matching string lengths, if the dummy argument is neither
7 ! POINTER nor ALLOCATABLE or assumed-shape.
8 ! Also check that absent OPTIONAL arguments don't trigger the check.
9
10 MODULE m
11 CONTAINS
12
13   SUBROUTINE test (str, opt)
14     IMPLICIT NONE
15     CHARACTER(len=5) :: str
16     CHARACTER(len=5), OPTIONAL :: opt
17   END SUBROUTINE test
18
19 END MODULE m
20
21 PROGRAM main
22   USE m
23   IMPLICIT NONE
24   CALL test ('abcde')  ! String length matches.
25   CALL test ('abcdef') ! String too long, is ok.
26 END PROGRAM main
27
28 ! { dg-final { cleanup-modules "m" } }