LoginSignup
0

More than 5 years have passed since last update.

MacでFortranエラー: サブルーチンの実行が,遡って結果を変える

Last updated at Posted at 2018-07-04

プログラム概要

main program
  use subroutines
  implicit none 
  integer, parameter :: n = ** 
  real*8 :: x(0:n)
  real*8 :: p_input_1, p_input_2, ...
  integer :: i

  do i = 1, **
    ! xに関する,計算
    write(*,*) i, ! 途中経過 (xの平均等) を表示
  end do

  call analyse(n,x,prm,***)

  stop
end program


module subroutines
  implicit none
contains
  subroutine analyse(n,x,prm,***)
    implicit none
    integer, intent(in) :: n
    real*8,  intent(in) :: x(0:n)
    real*8,  intent(out) :: prm

    ! xに関する処理いろいろ

    return
  end subroutine analyse
end module subroutines

システム

  • OS: maxOS High Sierra ver 10.13.5
  • コンパイラ: gfortran (gcc ver 6.3.0)

問題点

あるサブルーチン (上記"analyse") を呼ぶか呼ばないかで, 計算の途中経過 (当然, 最終的な結果も)が変わってしまう.

解決策

見えず

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0