This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/7661: gcc-3.0 optimization bug on debian GNULinux on x86 with very simple program
- From: Thomas Deselaers <thomas at deselaers dot de>
- To: gcc-gnats at gcc dot gnu dot org, debian-gcc at lists dot debian dot org
- Date: Tue, 20 Aug 2002 19:11:26 +0200
- Subject: c/7661: gcc-3.0 optimization bug on debian GNULinux on x86 with very simple program
>Number: 7661
>Category: c
>Synopsis: gcc-3.0 optimization bug on debian GNU/Linux on x86 with very simple program
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Tue Aug 20 10:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Thomas Deselaers
>Release: 3.0.4 (Debian testing/unstable)
>Organization:
>Environment:
System: Linux racker 2.4.19 #3 Tue Aug 6 23:01:23 CEST 2002 i686 unknown unknown GNU/Linux
Architecture: i686
Dell Inspiron 8200, Pentium 4 mobile 1600
OS: Linux 2.4.19 unpatched
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,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
>Description:
OK, while playing around(together with Stefan Jacobs, he wanted to be
mentioned) I found out, that this small programm:
-------file:maxint.cc------------
main() {
int i=0;
int oldi=0;;
while(++i>oldi) oldi=i;
return oldi;
}
---------------------------------
does work absolutely fine, when compiled without any optimization,
but does not terminate at all, when using any optimization-options:
with "gcc -o maxint maxint.cc" the maxint-program works fine, but
with "gcc -o maxint maxint.cc -O$X" with $X being nothing, or one of
the numbers from 1 to 9, the maxint program does not terminate.
>How-To-Repeat:
copy the code-excerpt to a file and compile it
>Fix:
Workaround: not use -O$X
>Release-Note:
>Audit-Trail:
>Unformatted: