Skip to content

Instantly share code, notes, and snippets.

@DSCF-1224
Created September 3, 2020 21:38
Show Gist options
  • Save DSCF-1224/da001730acbd95a8e97e6ba4e7c6ff4e to your computer and use it in GitHub Desktop.
Save DSCF-1224/da001730acbd95a8e97e6ba4e7c6ff4e to your computer and use it in GitHub Desktop.
負値のインデックスをもつ形状引継配列を引き渡した時の挙動の確認
!gfortran, gcc version 7.4.0
!reference: https://qiita.com/implicit_none/items/08f894bc851c29b40b58#%E4%BB%AE%E5%BC%95%E6%95%B0
program test_20200904_01
use, intrinsic :: iso_fortran_env
implicit none
integer(int32) :: test_array(-10:-1)
call show_array_info(test_array)
contains
subroutine show_array_info(array)
integer(int32), intent(inout) :: array(:)
character(len=*), parameter :: format = '(A6,"=",I3)'
print format, 'size', size(array) ! returned: 10
print format, 'shape', shape(array) ! returned: 10
print format, 'lbound', lbound(array) ! returned: 1
print format, 'ubound', ubound(array) ! returned: 10
end subroutine show_array_info
end program test_20200904_01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment