From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3402 invoked by alias); 20 Aug 2002 23:46:03 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 3383 invoked by uid 71); 20 Aug 2002 23:46:02 -0000 Date: Tue, 20 Aug 2002 18:06:00 -0000 Message-ID: <20020820234602.3382.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Carlos O'Donell Subject: Re: c/7661: gcc-3.0 optimization bug on debian GNULinux on x86 with very simple program Reply-To: Carlos O'Donell X-SW-Source: 2002-08/txt/msg00430.txt.bz2 List-Id: The following reply was made to PR c/7661; it has been noted by GNATS. From: Carlos O'Donell To: Andrew Pinski Cc: Thomas Deselaers , gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org Subject: Re: c/7661: gcc-3.0 optimization bug on debian GNULinux on x86 with very simple program Date: Tue, 20 Aug 2002 19:39:36 -0400 > I think this program should not terminate at all because i will > always be one greater than oldi. > I think gcc3.0 has a problem with no optimization then but since > there is later version that works gcc 3.1.1, upgrade. > > Thanks, > Andrew Pinski > Agreed. Infact it doesn't terminate on all the systems I've tried (3). But for the sake of presenting a test case :) --- Test System: Dell XPS-T 450Mhz PIII (Debian testing/unstable) --- Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.4/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux Thread model: posix gcc version 3.0.4 --- carlos@systemhalted:~$ cat test.c main() { int i=0; int oldi=0;; while(++i>oldi) oldi=i; return oldi; } carlos@systemhalted:~$ gcc-3.0 -O0 -o test test.c carlos@systemhalted:~$ ./test (Attach gdb, look at stuff, it's not stopping) ^C carlos@systemhalted:~$ gcc-3.0 -o test test.c carlos@systemhalted:~$ ./test (Attach gdb, look at stuff, it's not stopping) ^C --- Maybe you've been bad to your gcc ;) In the optimized case (-O9) I see: 080483f8
: 80483f8: 55 push %ebp 80483f9: 89 e5 mov %esp,%ebp 80483fb: 83 ec 08 sub $0x8,%esp 80483fe: 83 e4 f0 and $0xfffffff0,%esp 8048401: 8d 76 00 lea 0x0(%esi),%esi 8048404: eb fe jmp 8048404 8048406: 90 nop 8048407: 90 nop Which never terminates... and gcc knew it. If there were some examples of gcc-3.0 mucking up optimizations... this isn't it. c.