Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / bounds_check_strlen_6.f90
blob550cca8431f46dbb6b679b73ccd08ebc715f6af2
1 ! { dg-do run }
2 ! { dg-options "-fbounds-check" }
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.
10 MODULE m
11 CONTAINS
13 SUBROUTINE test (str, opt)
14 IMPLICIT NONE
15 CHARACTER(len=5) :: str
16 CHARACTER(len=5), OPTIONAL :: opt
17 END SUBROUTINE test
19 END MODULE m
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
28 ! { dg-final { cleanup-modules "m" } }