From: yates@a.chem.upenn.edu (John H. Yates)
Newsgroups: comp.sys.sgi
Subject: 4.0.4 Fortran optimizer problem
Date: 30 Jul 92 16:00:10 GMT
Organization: University of Pennsylvania
Originator: yates@a.chem.upenn.edu

One of my users has found what appears to be a problem with the
optimizer in the f77 compiler at IRIX 4.0.4, f77 3.4.1 . It
gives wrong results at -O2 and -O3. It works on IRIX 3.3 and
f77 3.3 . It used a binary file input, so I hexified it so
the test could be all in ASCII. Below is a shell archive
containing the program, the hex input it reads, and a script
called doit which shows the different answers for -O2 and -O3
at IRIX 4.0.4 . I don't see anything obviously wrong with
the Fortran.

What should I advise the user? 

Thanks, John
yates@a.chem.upenn.edu

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	bugger.f
#	doit
#	lcs_hex
# This archive created: Thu Jul 30 11:48:34 1992
export PATH; PATH=/bin:$PATH
echo shar: extracting "'bugger.f'" '(1340 characters)'
if test -f 'bugger.f'
then
	echo shar: will not over-write existing file "'bugger.f'"
else
sed 's/^	X//' << \SHAR_EOF > 'bugger.f'
	X      program acid
	X      implicit real*8 ( a-h, o-z )
	X      integer*4 ihex_x(300)
	X      integer*4 ihex_d(66)
	X      common /x/ xx(50), yy(50), zz(50)
	X      common /d/ dd2(33)
	X      dimension xcp(17), ycp(17), zcp(17),
	X     1 xhp(33), yhp(33), zhp(33),
	X     1 rhpx(33), rhpy(33), rhpz(33),r2(33),
	X     1 ncind(33)
	X      equivalence(ihex_x(1),xx(1))
	X      equivalence(ihex_d(1),dd2(1))
	Xc
	X      open(2, file = 'lcs_hex', form = 'formatted')
	X      read(2,901) ihex_x,ihex_d
	X 901  format(4Z10)
	Xc      write(6,900)ihex_x,ihex_d
	X 900  format(4Z10)
	X
	X         do m = 1, 16
	X            ncind(2*m-1) = m+1
	X            ncind(2*m) = m+1
	X         enddo
	X            ncind(33) = 17
	X         do 1 j = 1 , 17
	X            xcp(j) = xx(j)
	X            ycp(j) = yy(j)
	X            zcp(j) = zz(j)
	X    1    continue
	X         do 2 j = 1 , 33
	X            xhp(j) = xx(17 + j)
	X            yhp(j) = yy(17 + j)
	X            zhp(j) = zz(17 + j)
	X    2    continue
	X            do 220 j = 1 , 33
	X               rhpx(j) = xhp(j) - xcp(ncind(j))
	X               rhpy(j) = yhp(j) - ycp(ncind(j))
	X               rhpz(j) = zhp(j) - zcp(ncind(j))
	X               r2(j) = rhpx(j)*rhpx(j) + rhpy(j)*rhpy(j)
	X     1                 + rhpz(j)*rhpz(j) - dd2(j)
	X  220       continue
	X
	X            do 221 j = 1 , 33
	X  221       continue
	Xc
	X      write (6,*) j, sngl(r2(1)), sngl(r2(2))
	X      end
SHAR_EOF
if test 1340 -ne "`wc -c < 'bugger.f'`"
then
	echo shar: error transmitting "'bugger.f'" '(should have been 1340 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'doit'" '(212 characters)'
if test -f 'doit'
then
	echo shar: will not over-write existing file "'doit'"
else
sed 's/^	X//' << \SHAR_EOF > 'doit'
	X#! /bin/csh -vf
	X# compile and run bugger.f with different O options
	Xf77 -O0 -o bugger bugger.f
	Xbugger
	X#
	Xf77 -O1 -o bugger bugger.f
	Xbugger
	X#
	Xf77 -O2 -o bugger bugger.f
	Xbugger
	X#
	Xf77 -O3 -o bugger bugger.f
	Xbugger
	X#
SHAR_EOF
if test 212 -ne "`wc -c < 'doit'`"
then
	echo shar: error transmitting "'doit'" '(should have been 212 characters)'
fi
chmod +x 'doit'
fi # end of overwriting check
echo shar: extracting "'lcs_hex'" '(3752 characters)'
if test -f 'lcs_hex'
then
	echo shar: will not over-write existing file "'lcs_hex'"
else
sed 's/^	X//' << \SHAR_EOF > 'lcs_hex'
	X  BF308B0E   BEED8C8  3FDA7A51  57F76229
	X  BFD7C486  4AA3C274  3FCAD8D2  6B8AC39C
	X  BFE091A1  3780FC5E  3FCD1A9E  49350AF9
	X  BFD45360  32F583CA  3FE23B2C  C68ED064
	X  BF7667BC  FCE3AA06  3FE4756F  9CCDF706
	X  BFB747D5   98C7E78  3FE86CD9   C31628C
	X  3FAAB15B  A15C9D6C  3FEB83C0  655B9182
	X  BFBBEA01   26F20E3  3FE74EB6  95B16C83
	X  BFC3EA64  15F2A7B0  3FCDDA09  9E992DF6
	X  3FF68F11  76BA99E0  BFC92E03  9FDEFF41
	X  BFF63CC2  F74E0489  3FD10488  B555C5C8
	X  3FF2E64B  1A9055F6  BFE043C0  2BA4AA88
	X  BFF7EA2D  2A46091A  3FC803F1  FB48768D
	X  3FF309D9  35B7EDCE  BFD00074  73973D6D
	X  BFF4B43A  E9299B9A  3FE27AEE  3E802CB0
	X  3FF85EB9  D4D1550F  3FB9A628  F1547DC6
	X  BFF0B29C  D6644815  3FDE91AA  CE756546
	X  3FF9978E  3E62E05C  BFC436C1  4DC20E48
	X  BFF0E42F  D5C0E595  3FEC4329   2A8DE7E
	X  3FFB1B20  2F0F82D0  BF8F7CA8  7E4185EC
	X  BFEB9DCB  FC971755  3FF2C335  753C2B0A
	X  3FFB3E72  47948C2A  BFD6B5DE  BB75F7C9
	X  BFEF5198  970454F8  3FF1C31D  F32FD8B5
	X  3FF86458  256610CD  BFF0963E  E4935ED7
	X  3FD3FA3F   D0F0680  BFD99DA7  223D6344
	X  BFB0FFE7  2C6EB00C  3FE4692E  C44CA600
	X  3FFE83D0  919AC9DC  4002B738  66FBF4D5
	X  400B2B87  A1D01656  400BD58D   6405FC4
	X  40120672  1268920F  4011C9A4  191425A7
	X  4015E8C5  B882BA50  4015EE37  71EF6877
	X  401A7BEB   AF84612  401BC080  A164F770
	X  401FF9AF  6134BE9D  40205CE1  AFC83D15
	X  4021CBBD  25EED025  40220D09  EDA0ED1B
	X  40230A9E  90AA37B1  BFB1D061  6B7C28AD
	X  3FEA5D59  6DC24ADB  4005300F  9F56EC58
	X  3FFAEE4D  3F6E9B9C  3FF75CFB  1B2D9790
	X  4005A37C  37E919D4  40115B04  3A7397B7
	X  40094F7D  D66FCBCF  40040CBB  E9DDD954
	X  400DC8DC  45D3E704  4015B894  E38397D0
	X  401110A9  881C4164  400C2815  FB9DB781
	X  4012E6D3  E6A2FE98  4019AFC2  79DAF398
	X  40153087  AF425FE7  401244B8  4EBA2F55
	X  4016BFF3  83724F1B  401DD61C   10B7DD2
	X  4019532E  9E0D616A  40185B0E  C6C7543A
	X  401D6485  27C3A511  4021BD64  C0F18DB1
	X  401E74A6  695BB187  401D227C  3DB8F1E5
	X  40217ED3  1BCF6046  4023AC82  E085698C
	X  4020BBE1  559280DA  4020204E   DF10781
	X  40234FCE  2C8B7635  4021E432  1CDE48AF
	X  4022E43E   32DAAF0  402508B9  9E3B2649
	X  4003E8C1  19302AD3  401074DE  3B9133B4
	X  40119B4B   A2756AD  40170B88  7889FFAA
	X  401A3D60  1A603E6C  401F997B  BC89CDEE
	X  4021C964  D9EA214C  40244BC3  581273A0
	X  402642A8  18919A55  402906B0  81DABD3E
	X  402A6217  BD722E71  402CD443  7533CD17
	X  402E8A3C  D60247E2  40308AE8  2ABE3165
	X  40317A6F  AE0AA0E5  4032BCF0  2C4A4363
	X  4033DF2F   E3C3A9E  40134385  A5E9E347
	X  40108E67  88314D38  400D8430  9C939A6E
	X  4011D9E5  A750B991  40195E6B  FFBBA781
	X  40168233  DC225879  40183401  69D5ABD3
	X  401AD5F8  21BCA81B  4020A54D  DB6028A5
	X  401EB4A5  E353C9ED  4020F19C  40689B67
	X  402260E8  A28CA166  40252591  27FAB59C
	X  4023C686  EBF4231D  4025795D   8895BB6
	X  4026819E  97FB56A9  4029FF2F  C9194460
	X  4028EE6B  6D157AD4  40291981  2F9F2F8A
	X  402AE035  ECE2C872  402DFA56  34FF9FBC
	X  402C255D  98AA718C  402D8E03  3A147AA8
	X  402EFB9C  101B7751  4030FA8D  2392E4DB
	X  403062EF  9B2ACF99  403119F6  19DBADF2
	X  40319AD4  A7B95C21  4032FE47  33EC8838
	X  40329CBB  1F723226  4033DF0D  14EBB4A6
	X  4034C0B6   5585199  4033B027  84F07692
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859  3FF14E3B  CD35A859
	X  3FF14E3B  CD35A859
SHAR_EOF
if test 3752 -ne "`wc -c < 'lcs_hex'`"
then
	echo shar: error transmitting "'lcs_hex'" '(should have been 3752 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
Newsgroups: comp.sys.sgi