开发者

Fortran Bus Error When Modifying Parameter

Whenever I assign a n开发者_Go百科ew value to a parameter, I get a bus error. I don't see how I'm pointing to non-existant memory. I should have access to this address, as it is declared in the parameter list, unless Fortran does not allow parameters to be modified without some special declaration. The rest of my code works without error. I've isolated it to simply this assignment.

I'm running gfortran (not sure which version, off-hand) from the terminal in OS X.

SUBROUTINE p_list (c_number, c_matrix)
    INTEGER     c_number
    INTEGER     c_matrix(8000,20)
!   ... 
    c_number = 1000
!   ...
END SUBROUTINE p_list


How are you calling this? I don't know modern FORTRANs, but I know that with earlier versions of FORTRAN, you could crash a program like that by passing in a constant (e.g., by calling p_list(0, my_matrix)). That's because FORTRAN implicitly passed everything by reference, including constants (!)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜