Date: Mon, 13 Dec 1999 10:25:21 +0200 (WET) From: Andris Pavenis To: Robert Ruehlmann cc: djgpp AT delorie DOT com, gcc-bugs AT gcc DOT gnu DOT org Subject: Re: Compiler optimization bug in gcc-2.95.2 and 2.96 19991210 In-Reply-To: <830aq2$68s$1@news-int.gatech.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 12 Dec 1999, Robert Ruehlmann wrote: > I think I've found a bug in the DJGPP compiler (gcc 2.95.2). When optimized > with -O2 the following small sample program goes into an infinite loop. > Debugging with gdb shows strange behaviour like modifications of the 'size' > variable. > > <-- cut here --> > static void bug(int size, int tries) > { > int i; > int num = 0; > > while (num < size) > { > for (i = 1; i < tries; i++) num++; > } > } > > int main() > { > bug(5, 10); > return 0; > } > <-- cut here --> > This seems to be real bug in gcc beginning from version 2.95. I only tested that for target i586-pc-linux-gnu with egcs-1.1.2 no infinite loops. All is Ok gcc-2.95.2 infinite loop with -O2 and -O3 gcc-2.96 19991210 development version the same results as with gcc-2.95.2 Andris