Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!mips!gumby!lilian From: lilian@mips.COM (Lilian Leung) Newsgroups: comp.sys.mips Subject: Re: f77 bug Message-ID: <35353@mips.mips.COM> Date: 1 Feb 90 21:47:41 GMT References: <1990Feb1.170639.15889@sobmips.UUCP> Sender: news@mips.COM Reply-To: lilian@mips.COM (Lilian Leung) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 136 In article <1990Feb1.170639.15889@sobmips.UUCP> laporte@sobmips.UUCP (p.laporte) writes: >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 This is a verified bug under our version 2.0 FORTRAN compiler. It has been fixed in our 2.10 version. -- UUCP: {ames,decwrl,prls,pyramid}!mips!lilian (or lilian@mips.com) DDD: 408-991-7848 Lilian Leung (or 408-720-1700, Ext. 848) USPS: MIPS Computer Systems, 930 Arques, Sunnyvale, CA 94086-3650