Namelist input problem
John S. Tse
MLK at vm.nrc.ca
Wed Mar 6 02:12:01 AEST 1991
There may be a bug with the MIPS f77 compiler on handling namelist
input. When the following program was compiled with -O1 optimization
it gave the correct result. However, when compiled under -O2, the
variable x(i) becomes ZERO !! More interestingly, if one inserted
a write statement after the READ, it gave the correct results even
under -O2 . Apparently, the value in variable a was not loaded into x(i)
in the DO loop when compiled under -O2.
Any idea ??
program test
namelist /idata/ j,a
dimension x(100)
do 100 i = 1, 5
read(5,nml=idata)
x(j) = a
100 continue
write(6,10) (x(i),i=1,5)
10 format(e12.5)
stop
end
$idata j=5, a = 5.0 $end
$idata j=3, a = 3.0 $end
$idata j=2, a = 2.0 $end
$idata j=4, a = 4.0 $end
$idata j=1, a = 1.0 $end
John S. Tse
Steacie Institute for Molecular Science
National Research Council of Canada
MLK @ NRCVM01.BITNET
More information about the Comp.sys.sgi
mailing list