Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!sobmips!laporte From: laporte@sobmips.UUCP (p.laporte) Newsgroups: comp.sys.mips Subject: f77 bug Message-ID: <1990Feb1.170639.15889@sobmips.UUCP> Date: 1 Feb 90 17:06:39 GMT Organization: Sobeco Group - Montreal, Canada Lines: 124 We have found what we think is a bug in the fortran compiler (version 2.0) Here is a small program that demonstrate the problem. When we use the optimiser we get incorrect results when doing a simple addition. Maybee someone at mips could tell me if they were aware of this bug and if there is a patch for it. Tks ----- implicit double precision(a-h, o-z) common ia,r(12),tb data tb / 0.02d0 / r(4) = 4.0 r(5) = 1.0 r(6) = 2.0 r(7) = 3.0 write (*,10) r(4),r(5),r(6),r(7) r1 = r(5)+r(6) r2 = r(5)+r(7) r3 = r(5)+r(6)+r(7) write(*,20) r1, r2,r3 write(*,20) r(5)+r(6),r(5)+r(7),r(5)+r(6)+r(7) 10 format ( " R(4)=",F8.5 " R(5)=",F8.5 " R(6)=",F8.5 1 " R(7)=",F8.5 //) 20 format ( " R(5)+R(6)=", F8.5/ " R(5)+R(7)=",F8.5/ 1 " R(5)+R(6)+R(7)=",F8.5 // ) stop end -------------------------------------------------- without any option R(4)= 4.00000 R(5)= 2.00000 R(6)= 0.00000 R(7)= 3.00000 R(5)+R(6)= 4.00000 R(5)+R(7)= 5.00000 R(5)+R(6)+R(7)= 7.00000 R(5)+R(6)= 4.00000 R(5)+R(7)= 5.00000 R(5)+R(6)+R(7)= 7.00000 -------------------------------------------------- with -O0 option R(4)= 4.00000 R(5)= 1.00000 R(6)= 2.00000 R(7)= 3.00000 R(5)+R(6)= 3.00000 R(5)+R(7)= 4.00000 R(5)+R(6)+R(7)= 6.00000 R(5)+R(6)= 3.00000 R(5)+R(7)= 4.00000 R(5)+R(6)+R(7)= 6.00000 -------------------------------------------------- with -O1 option R(4)= 4.00000 R(5)= 2.00000 R(6)= 0.00000 R(7)= 3.00000 R(5)+R(6)= 4.00000 R(5)+R(7)= 5.00000 R(5)+R(6)+R(7)= 7.00000 R(5)+R(6)= 4.00000 R(5)+R(7)= 5.00000 R(5)+R(6)+R(7)= 7.00000 -------------------------------------------------- with -O2 option R(4)= 4.00000 R(5)= 2.00000 R(6)= 0.00000 R(7)= 3.00000 R(5)+R(6)= 4.00000 R(5)+R(7)= 5.00000 R(5)+R(6)+R(7)= 7.00000 R(5)+R(6)= 4.00000 R(5)+R(7)= 5.00000 R(5)+R(6)+R(7)= 7.00000 -------------------------------------------------- with -O3 option R(4)= 4.00000 R(5)= 2.00000 R(6)= 0.00000 R(7)= 3.00000 R(5)+R(6)= 4.00000 R(5)+R(7)= 5.00000 R(5)+R(6)+R(7)= 7.00000 R(5)+R(6)= 4.00000 R(5)+R(7)= 5.00000 R(5)+R(6)+R(7)= 7.00000 -------------------------------------------------- with -O0 and -g options R(4)= 4.00000 R(5)= 1.00000 R(6)= 2.00000 R(7)= 3.00000 R(5)+R(6)= 3.00000 R(5)+R(7)= 4.00000 R(5)+R(6)+R(7)= 6.00000 R(5)+R(6)= 3.00000 R(5)+R(7)= 4.00000 R(5)+R(6)+R(7)= 6.00000 Pierre Laporte {attcan,mcgill-vision,telly}!sobeco!laporte