2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / bounds_check_strlen_6.f90
blobc46bfe2db2318bcf0f307e6b419248fe5aae0185
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