www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/13/07:34:46

Date: Mon, 13 Dec 1999 10:25:21 +0200 (WET)
From: Andris Pavenis <pavenis AT lanet DOT lv>
To: Robert Ruehlmann <rr9 AT angband DOT org>
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: <Pine.A41.4.05.9912131018380.67242-100000@ieva01.lanet.lv>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019