public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/7661: gcc-3.0 optimization bug on debian GNULinux on x86 with very simple program
@ 2002-08-20 14:06 Martin Sebor
0 siblings, 0 replies; 4+ messages in thread
From: Martin Sebor @ 2002-08-20 14:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/7661; it has been noted by GNATS.
From: Martin Sebor <sebor@roguewave.com>
To: gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: c/7661: gcc-3.0 optimization bug on debian GNULinux on x86 with very simple program
Date: Tue, 20 Aug 2002 14:18:55 -0600
Thomas Deselaers wrote:
...
>>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:
FYI: this looks like the same thing as PR #4371, i.e., signed integer
overflow:
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4371&database=gcc
Regards
Martin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c/7661: gcc-3.0 optimization bug on debian GNULinux on x86 with very simple program
@ 2002-08-20 18:06 Carlos O'Donell
0 siblings, 0 replies; 4+ messages in thread
From: Carlos O'Donell @ 2002-08-20 18:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/7661; it has been noted by GNATS.
From: Carlos O'Donell <carlos@baldric.uwo.ca>
To: Andrew Pinski <pinskia@physics.uc.edu>
Cc: Thomas Deselaers <thomas@deselaers.de>, 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 <main>:
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 <main+0xc>
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c/7661: gcc-3.0 optimization bug on debian GNULinux on x86 with very simple program
@ 2002-08-20 11:46 Andrew Pinski
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Pinski @ 2002-08-20 11:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/7661; it has been noted by GNATS.
From: Andrew Pinski <pinskia@physics.uc.edu>
To: Thomas Deselaers <thomas@deselaers.de>
Cc: 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 13:26:42 -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
trace
i oldi
0 0
1 0 check here
1 1
2 1 check
2 2
.
.
.
On Tuesday, August 20, 2002, at 01:11 , Thomas Deselaers wrote:
> main() {
> int i=0;
> int oldi=0;;
> while(++i>oldi) oldi=i;
> return oldi;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* c/7661: gcc-3.0 optimization bug on debian GNULinux on x86 with very simple program
@ 2002-08-20 10:16 Thomas Deselaers
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Deselaers @ 2002-08-20 10:16 UTC (permalink / raw)
To: gcc-gnats, debian-gcc
>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:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-08-20 23:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-20 14:06 c/7661: gcc-3.0 optimization bug on debian GNULinux on x86 with very simple program Martin Sebor
-- strict thread matches above, loose matches on Subject: below --
2002-08-20 18:06 Carlos O'Donell
2002-08-20 11:46 Andrew Pinski
2002-08-20 10:16 Thomas Deselaers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).