program main implicit none character(3) c c = 'abc' call sub(c, 4) print *, c end program subroutine sub(a, n) implicit none integer n character a(n) ! 文字長が一致していない! a(1:1) = 'X' end subroutine