From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeffrey A Law To: Toon Moene Cc: craig@jcb-sc.com, shancock@home.com, egcs-bugs@cygnus.com Subject: Re: optimization bug in g77 Date: Sun, 28 Feb 1999 23:30:00 -0000 Message-id: <13398.918948431@hurl.cygnus.com> References: <36B8C2A7.7304B9B@moene.indiv.nluug.nl> X-SW-Source: 1999-02n/msg00415.html List-Id: I just tried this one with the current sources and I get the same results with -O0, -O1, -O2, -O2 -funroll-loops on my i686 linux box. It may be the case that this was being mis-compiled due to the two strength reduction bugs Joern fixed yesterday. In message < 36B8C2A7.7304B9B@moene.indiv.nluug.nl >you write: > craig@jcb-sc.com wrote: > > > Could you be more specific about just what the bug is? We aren't > > normally able to try to debug other peoples' programs, assuming that > > the bug will turn out to be in the compiler. (We do it on occasion, > > though.) > > I've downsized the code a bit :-) > > program wrbug > common/buf3d/id3d(10,1) > do j=1,10 > id3d(j,1) = j > enddo > call wr3d > end > subroutine wr3d > integer ip(10) > integer irec(5,1) > common/buf3d/id3d(10,1) > common/temp2/i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 > equivalence (i1,ip) > n = 1 > c do 100 n=1,1 > do 10 j=1,10 > ip(j)=id3d(j,n) > 10 continue > irec(1,n)=or(i1,lshift(i2,16)) > irec(2,n)=or(i3,lshift(i4,16)) > irec(3,n)=or(i5,lshift(i6,16)) > irec(4,n)=or(i7,lshift(i8,16)) > irec(5,n)=or(i9,lshift(i10,16)) > c 100 continue > print*,irec > return > end > > This code works when compiled with option -O using: > > [toon@moene g77-bugs]$ g77 -v > g77 version egcs-2.91.59 19981124 (egcs-1.1.1 pre-release #3) (from > FSF-g77 version 0.5.24-19980804) > Driving: g77 -v -c -xf77-version /dev/null -xnone > Reading specs from > /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.59/specs > gcc version egcs-2.91.59 19981124 (egcs-1.1.1 pre-release #3) > > If you remove the two comment `c`s and thereby enable the outer loop, > the final print statement will print 5 zero's, which definitely is not > TRTTD. > > However, > > [toon@moene g77-bugs]$ /usr/snp/bin/g77 -v > g77 version egcs-2.93.04 19990203 (gcc2 ss-980929 experimental) (from > FSF-g77 version 0.5.24-19980804) > Driving: /usr/snp/bin/g77 -v -c -xf77-version /dev/null -xnone > Reading specs from > /usr/snp/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.93.04/specs > gcc version egcs-2.93.04 19990203 (gcc2 ss-980929 experimental) > > gives the correct answers. > > HTH, > > -- > Toon Moene (toon@moene.indiv.nluug.nl) > Saturnushof 14, 3738 XG Maartensdijk, The Netherlands > Phone: +31 346 214290; Fax: +31 346 214286 g77 Support: fortran@gnu.org; egcs: egcs-bugs@cygnus.com