LoginSignup
0
0

More than 5 years have passed since last update.

MacでFortranエラー: malloc [エラーまとめ]

Last updated at Posted at 2018-06-13

プログラム概要

main program
  implicit none # 6/13追記
  integer, parameter :: n = ** 
  real*8 :: x(0:n), y(0:n,1:5)
  real*8 :: p_input_1, p_input_2, ...
  integer :: i

  do i = 1, 5
    ! 入力パラメータを変えながら繰り返し計算
    call subroutine_1(n,p_input_1,p_input_2,...,x)
    y(0:n,i) = x(0:n)
  end do

  stop
end program

subroutine subroutine_1(n,p_input_1,p_input_2,...,x)
  implicit none
  integer, intent(in) :: n
  real*8,  intent(in) :: p_input_1, p_input_2, ...
  real*8,  intent(out) :: x(0:n)
  real*8 :: p_1(0:n,0:n), p_2, p_3, ...

  ! 処理色々

  return
end subroutine subroutine_1

システム

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

実行結果

配列数(n) 実行結果 備考
400 できた
300 できた
200 できた 10回中10回成功
150 できた
101 できた 10回中10回成功
100 できなかった 20回中7回成功

乱数は一切使っていないにも関わらず!

"n=100"の場合の実行結果

回数
成功 7
Seg. Fault 11
malloc 2

ちなみに,エラーを吐く場合も, i=1の時にエラーがでることもi=3の時にエラーが出ることもあり

どうしたらいいんでしょうね,ほんと

6/14追記

関連しそうなページを発見
https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/271391

ははーん,解決策が見えん

0
0
3

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
0