libgfortran/ChangeLog:
[official-gcc.git] / gcc / testsuite / gfortran.dg / bounds_check_strlen_2.f90
blob241db66239cd990b6602dfcfe01848830f2fbb07
1 ! { dg-do run }
2 ! { dg-options "-fbounds-check" }
3 ! { dg-shouldfail "Character length mismatch" }
5 ! PR fortran/37746
6 ! Test bounds-checking for string length of dummy arguments.
8 MODULE m
10 CONTAINS
12 SUBROUTINE test (str, n)
13 IMPLICIT NONE
14 CHARACTER(len=n) :: str
15 INTEGER :: n
16 END SUBROUTINE test
18 SUBROUTINE test2 (str)
19 IMPLICIT NONE
20 CHARACTER(len=*) :: str
21 CALL test (str, 5) ! Expected length of str is 5.
22 END SUBROUTINE test2
24 END MODULE m
26 PROGRAM main
27 USE m
28 IMPLICIT NONE
29 CALL test2 ('abc') ! String is too short.
30 END PROGRAM main
32 ! { dg-output "shorter than the declared one for dummy argument 'str' \\(3/5\\)" }