|
这是大程序中的一个小code,学长说在老版本的gfortran中编译不会报错,但现在编译会报错,报错信息为
Error: Variable 'n', used in aspecification expression, is referenced at (1) before the ENTRY statement in which it is a parameter
错误集中在后面的code中(完整code见附件,以下错误的地方我用 c %%%%%%% 中间,有两处):
[Fortran] 纯文本查看 复制代码 002 | c random number generator proposed bymarsaglia and zaman |
003 | c in reportfsu - scri -87 -50 |
004 | c modified by f. james , 1988 and 1989 , to generate a vector |
005 | c of pseudorandom numbers ua oflength n. |
007 | c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
008 | c calling sequences for rnde : + + |
009 | c call rnde ( ua , n ) returns a vector ua of n + + |
010 | c 32 - bit randomfloating point numbers between + + |
012 | c call rnd 3 i ( i 1 ) initializes the generator from one + + |
014 | c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
017 | real * 8 ua ( n ) , sina ( 102 ) |
025 | c default initialization. userhas called rnde without rnd 3 i. |
031 | c % % % % % % % % % % % % % % % % % % % % % % % |
034 | c % % % % % % % % % % % % % % % % % % % % % % % % % % % |
043 | c % % % % % % % % % % % % % % % % % % % % % % % % % |
047 | c % % % % % % % % % % % % % % % % % % % % % % % % % % % |
053 | c initializing routine for rnde , may be called before |
054 | c generating pseudorandom numberswith rnde. the input |
055 | c values should be in theranges : 0 <= ijklin <= 900 oooooo |
068 | subroutine rnd 3 ix ( ijkl ) |
069 | c the standard values inmarsaglia's paper , ijkl = 54217137 |
072 | real * 8 ua ( n ) , u ( 97 ) , uni , s , t , zuni |
073 | real * 8 sina ( 102 ) , sout ( 102 ) |
075 | integer ns , ijkl , i 97 , j 97 , ij , kl , i , j , k , l , ii , ivec |
076 | real * 8 twom 24 , c , cd , cm |
077 | parameter ( ns = 24 , twom 24 = 2 . * * ( -24 ) ) |
078 | save c , cd , cm , i 97 , j 97 |
082 | i = mod ( ij / 177 , 177 ) + 2 |
084 | k = mod ( kl / 169 , 178 ) + 1 |
090 | m = mod ( mod ( i * j , 179 ) * k , 179 ) |
095 | if ( mod ( l * m , 64 ) .ge. 32 ) s = s + t |
102 | cm = 16777213 . * twom 24 |
111 | if ( uni .lt. 0 . ) uni = uni +1 . |
114 | if ( i 97 .eq. 0 ) i 97 = 97 |
116 | if ( j 97 .eq. 0 ) j 97 = 97 |
120 | if ( uni .lt. 0 . ) uni = uni +1 . |
122 | c replace exact zeros byuniform distr. * 2 * * -24 |
125 | c an exact zero here isvery unlikely , but let's be safe. |
126 | if ( zuni .eq. 0 . ) zuni = twom 24 * twom 24 |
131 | c * * * * * * * * * * * * * * * * * * to get currentstatus |
143 | c * * * * * * * * * * * * * * * * to restore the old status |
|
|