1! { dg-do run } 2! { dg-options "-fbounds-check" } 3! { dg-shouldfail "Character length mismatch" } 4 5! PR fortran/37746 6! Test bounds-checking for string length of dummy arguments. 7 8MODULE m 9 10CONTAINS 11 12 SUBROUTINE test (str, n) 13 IMPLICIT NONE 14 INTEGER :: n 15 CHARACTER(len=n) :: str 16 END SUBROUTINE test 17 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 23 24END MODULE m 25 26PROGRAM main 27 USE m 28 IMPLICIT NONE 29 CALL test2 ('abc') ! String is too short. 30END PROGRAM main 31 32! { dg-output "shorter than the declared one for dummy argument 'str' \\(3/5\\)" } 33