* bug in redhat gcc 2.96
@ 2001-05-09 3:05 Jim Wright
2001-05-09 3:24 ` Matt Wilson
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Jim Wright @ 2001-05-09 3:05 UTC (permalink / raw)
To: redhat-devel-list, linux-kernel, Jeremy Hogan, Mike Vaillancourt
Cc: Jim Wright, Philip Pokorny
We believe we have found a bug in gcc. We have been trying to track
down why the .../drivers/scsi/sym53c8xx.c driver oopses with a divide
by zero when initializing at line 5265, which reads:
period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz;
We believe the bug is that gcc is generating incorrect code for this:
if (f1 < 55000) f1 = 40000;
else f1 = 80000;
Here is the test code to demonstrate this:
% cat bug.c
int main (int argc, char *argv[])
{
unsigned f1;
f1 = (unsigned)argc;
if (f1 < 5) {
f1 = 4;
} else {
f1 = 8;
}
exit (f1);
}
And here are commands to exhibit the problem.
% for i in 0 1 2 3 4 5 6 ; do ln bug.c bug$i.c ; done
% for i in 0 1 2 3 4 5 6 ; do gcc -save-temps -O$i -o bug$i bug$i.c ; done
% for i in 0 1 2 3 4 5 6 ; do ./bug$i 1 2 ; echo $? ; done
% for i in 0 1 2 3 4 5 6 ; do ./bug$i 1 2 3 4 5 6 7 ; echo $? ; done
The level 0 optimization assembly code appears correct. For level 1 and
above, the compiler emits a long-subtract-with-borrow statement which
leaves EAX either 0 filled or 1 filled, based on the carry flag.
As this is with Red Hat's version of gcc, I'm not sending
this to the gcc folks. RPMs of gcc with this problem
include gcc-2.96-69 and gcc-2.96-81. This has been logged
as http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=39764.
Any suggestions for a way to cope with this? We have a
customer who's system fails due to this.
--
Jim Wright Software Engineer Penguin Computing
jwright@penguincomputing.com v:415-358-2609 f:415-358-2646
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug in redhat gcc 2.96
2001-05-09 3:05 bug in redhat gcc 2.96 Jim Wright
@ 2001-05-09 3:24 ` Matt Wilson
2001-05-09 8:56 ` Alan Cox
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Matt Wilson @ 2001-05-09 3:24 UTC (permalink / raw)
To: redhat-devel-list
Cc: linux-kernel, Jeremy Hogan, Mike Vaillancourt, Jim Wright,
Philip Pokorny
This was fixed in 2.96-82, see:
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=37054
It was a bug in the if conversion optimization.
We're at 2.96-84 in rawhide now.
ftp://ftp.redhat.com/pub/redhat/linux/rawhide/
Cheers,
Matt
msw@redhat.com
On Tue, May 08, 2001 at 08:05:06PM -0700, Jim Wright wrote:
> We believe we have found a bug in gcc. We have been trying to track
> down why the .../drivers/scsi/sym53c8xx.c driver oopses with a divide
> by zero when initializing at line 5265, which reads:
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug in redhat gcc 2.96
2001-05-09 3:05 bug in redhat gcc 2.96 Jim Wright
2001-05-09 3:24 ` Matt Wilson
@ 2001-05-09 8:56 ` Alan Cox
2001-05-09 9:09 ` Tobias Ringstrom
` (2 more replies)
2001-05-09 10:27 ` David Woodhouse
2001-05-09 15:01 ` Jeremy Hogan
3 siblings, 3 replies; 11+ messages in thread
From: Alan Cox @ 2001-05-09 8:56 UTC (permalink / raw)
To: jwright
Cc: redhat-devel-list, linux-kernel, Jeremy Hogan, Mike Vaillancourt,
Philip Pokorny
> As this is with Red Hat's version of gcc, I'm not sending
> this to the gcc folks. RPMs of gcc with this problem
(If you have the time check 3.0 CVS doesnt show the same problem, the RH tree
diverges from it so may well be unique in having the bug but many bugs are
shared)
> include gcc-2.96-69 and gcc-2.96-81. This has been logged
> as http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=39764.
Thanks.
> Any suggestions for a way to cope with this? We have a
> customer who's system fails due to this.
You can build 2.4 quite sanely with egcs-1.1.2 (aka kgcc)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug in redhat gcc 2.96
2001-05-09 8:56 ` Alan Cox
@ 2001-05-09 9:09 ` Tobias Ringstrom
2001-05-09 10:31 ` Stefan Hoffmeister
2001-05-09 9:14 ` Jakub Jelinek
2001-05-09 16:42 ` Matt Wilson
2 siblings, 1 reply; 11+ messages in thread
From: Tobias Ringstrom @ 2001-05-09 9:09 UTC (permalink / raw)
To: Alan Cox
Cc: jwright, redhat-devel-list, linux-kernel, Jeremy Hogan,
Mike Vaillancourt, Philip Pokorny
On Wed, 9 May 2001, Alan Cox wrote:
> > Any suggestions for a way to cope with this? We have a
> > customer who's system fails due to this.
>
> You can build 2.4 quite sanely with egcs-1.1.2 (aka kgcc)
Since there is no kgcc in RH71, will you be releasing an updated gcc
rpm, or is the best solution to download and compile egcs-1.1.2 from
source?
IMHO, it is best not to revert to an old egcs version, but instead
continue to find bugs in the upcoming 3.0 release. I'm assuming that
your fixes for your gcc-2.96 are propagated to the pre-3.0 branch.
/Tobias
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug in redhat gcc 2.96
2001-05-09 8:56 ` Alan Cox
2001-05-09 9:09 ` Tobias Ringstrom
@ 2001-05-09 9:14 ` Jakub Jelinek
2001-05-09 16:42 ` Matt Wilson
2 siblings, 0 replies; 11+ messages in thread
From: Jakub Jelinek @ 2001-05-09 9:14 UTC (permalink / raw)
To: Alan Cox
Cc: jwright, redhat-devel-list, linux-kernel, Jeremy Hogan,
Mike Vaillancourt, Philip Pokorny
On Wed, May 09, 2001 at 09:56:24AM +0100, Alan Cox wrote:
> > As this is with Red Hat's version of gcc, I'm not sending
> > this to the gcc folks. RPMs of gcc with this problem
>
> (If you have the time check 3.0 CVS doesnt show the same problem, the RH tree
> diverges from it so may well be unique in having the bug but many bugs are
> shared)
The bug was present in 3.0 and 3.1 as well, but has been fixed the day it
was reported. Use gcc-2.96-82 or above, or gcc-3_0-branch newer than 2001-04-25
(or CVS head newer than that).
Jakub
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug in redhat gcc 2.96
2001-05-09 3:05 bug in redhat gcc 2.96 Jim Wright
2001-05-09 3:24 ` Matt Wilson
2001-05-09 8:56 ` Alan Cox
@ 2001-05-09 10:27 ` David Woodhouse
2001-05-09 15:01 ` Jeremy Hogan
3 siblings, 0 replies; 11+ messages in thread
From: David Woodhouse @ 2001-05-09 10:27 UTC (permalink / raw)
To: Matt Wilson
Cc: redhat-devel-list, linux-kernel, Jeremy Hogan, Mike Vaillancourt,
Jim Wright, Philip Pokorny
msw@redhat.com said:
> This was fixed in 2.96-82, see:
> http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=37054
> It was a bug in the if conversion optimization.
So if I run up2date, will I get the fixed version?
--
dwmw2
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug in redhat gcc 2.96
2001-05-09 9:09 ` Tobias Ringstrom
@ 2001-05-09 10:31 ` Stefan Hoffmeister
2001-05-09 15:09 ` Dan Kegel
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Hoffmeister @ 2001-05-09 10:31 UTC (permalink / raw)
To: Tobias Ringstrom
Cc: Alan Cox, jwright, redhat-devel-list, linux-kernel, Jeremy Hogan,
Mike Vaillancourt, Philip Pokorny
: On Wed, 9 May 2001 11:09:14 +0200 (CEST), Tobias Ringstrom wrote:
>On Wed, 9 May 2001, Alan Cox wrote:
>> > Any suggestions for a way to cope with this? We have a
>> > customer who's system fails due to this.
>>
>> You can build 2.4 quite sanely with egcs-1.1.2 (aka kgcc)
>
>Since there is no kgcc in RH71,
There is an compat-egcs RPM (on CD2?) that contains kgcc. Took me a while
to find that.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug in redhat gcc 2.96
2001-05-09 3:05 bug in redhat gcc 2.96 Jim Wright
` (2 preceding siblings ...)
2001-05-09 10:27 ` David Woodhouse
@ 2001-05-09 15:01 ` Jeremy Hogan
3 siblings, 0 replies; 11+ messages in thread
From: Jeremy Hogan @ 2001-05-09 15:01 UTC (permalink / raw)
To: Jim Wright
Cc: redhat-devel-list, linux-kernel, Mike Vaillancourt,
Philip Pokorny
This bug is fixed in gcc-2.96-82 and higher, as per
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=37054. I've posted
gcc-2.96-84.src.rpm at your enterprise ftp folder.
--jeremy
Jim Wright wrote:
>
> We believe we have found a bug in gcc. We have been trying to track
> down why the .../drivers/scsi/sym53c8xx.c driver oopses with a divide
> by zero when initializing at line 5265, which reads:
>
> period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz;
>
> We believe the bug is that gcc is generating incorrect code for this:
>
> if (f1 < 55000) f1 = 40000;
> else f1 = 80000;
>
> Here is the test code to demonstrate this:
>
> % cat bug.c
> int main (int argc, char *argv[])
> {
> unsigned f1;
>
> f1 = (unsigned)argc;
>
> if (f1 < 5) {
> f1 = 4;
> } else {
> f1 = 8;
> }
> exit (f1);
> }
>
> And here are commands to exhibit the problem.
>
> % for i in 0 1 2 3 4 5 6 ; do ln bug.c bug$i.c ; done
> % for i in 0 1 2 3 4 5 6 ; do gcc -save-temps -O$i -o bug$i bug$i.c ; done
> % for i in 0 1 2 3 4 5 6 ; do ./bug$i 1 2 ; echo $? ; done
> % for i in 0 1 2 3 4 5 6 ; do ./bug$i 1 2 3 4 5 6 7 ; echo $? ; done
>
> The level 0 optimization assembly code appears correct. For level 1 and
> above, the compiler emits a long-subtract-with-borrow statement which
> leaves EAX either 0 filled or 1 filled, based on the carry flag.
>
> As this is with Red Hat's version of gcc, I'm not sending
> this to the gcc folks. RPMs of gcc with this problem
> include gcc-2.96-69 and gcc-2.96-81. This has been logged
> as http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=39764.
> Any suggestions for a way to cope with this? We have a
> customer who's system fails due to this.
>
> --
> Jim Wright Software Engineer Penguin Computing
> jwright@penguincomputing.com v:415-358-2609 f:415-358-2646
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug in redhat gcc 2.96
2001-05-09 10:31 ` Stefan Hoffmeister
@ 2001-05-09 15:09 ` Dan Kegel
2001-05-09 15:09 ` Bernhard Rosenkraenzer
0 siblings, 1 reply; 11+ messages in thread
From: Dan Kegel @ 2001-05-09 15:09 UTC (permalink / raw)
To: redhat-devel-list; +Cc: linux-kernel
Stefan Hoffmeister wrote:
> >Since there is no kgcc in RH71,
>
> There is an compat-egcs RPM (on CD2?) that contains kgcc. Took me a while
> to find that.
OH. I kept looking for a package called 'kgcc'. Silly me.
Guess it's time for a "How to compile a kernel on Red Hat 7.1" FAQ.
- Dan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug in redhat gcc 2.96
2001-05-09 15:09 ` Dan Kegel
@ 2001-05-09 15:09 ` Bernhard Rosenkraenzer
0 siblings, 0 replies; 11+ messages in thread
From: Bernhard Rosenkraenzer @ 2001-05-09 15:09 UTC (permalink / raw)
To: redhat-devel-list; +Cc: linux-kernel
On Wed, 9 May 2001, Dan Kegel wrote:
> OH. I kept looking for a package called 'kgcc'. Silly me.
>
> Guess it's time for a "How to compile a kernel on Red Hat 7.1" FAQ.
The answer is that you can safely use gcc 2.96. No need to install kgcc or
any other old compiler.
LLaP
bero
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug in redhat gcc 2.96
2001-05-09 8:56 ` Alan Cox
2001-05-09 9:09 ` Tobias Ringstrom
2001-05-09 9:14 ` Jakub Jelinek
@ 2001-05-09 16:42 ` Matt Wilson
2 siblings, 0 replies; 11+ messages in thread
From: Matt Wilson @ 2001-05-09 16:42 UTC (permalink / raw)
To: Alan Cox
Cc: jwright, redhat-devel-list, linux-kernel, Jeremy Hogan,
Mike Vaillancourt, Philip Pokorny
This is because Jakub fixed it in GCC 3.0 CVS at the same time that he
fixed it in 2.96-82, which was on the same day it was reported. It
was broken in GCC CVS until that moment.
Cheers,
Matt
On Wed, May 09, 2001 at 09:56:24AM +0100, Alan Cox wrote:
> > As this is with Red Hat's version of gcc, I'm not sending
> > this to the gcc folks. RPMs of gcc with this problem
>
> (If you have the time check 3.0 CVS doesnt show the same problem, the RH tree
> diverges from it so may well be unique in having the bug but many bugs are
> shared)
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2001-05-09 16:44 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-09 3:05 bug in redhat gcc 2.96 Jim Wright
2001-05-09 3:24 ` Matt Wilson
2001-05-09 8:56 ` Alan Cox
2001-05-09 9:09 ` Tobias Ringstrom
2001-05-09 10:31 ` Stefan Hoffmeister
2001-05-09 15:09 ` Dan Kegel
2001-05-09 15:09 ` Bernhard Rosenkraenzer
2001-05-09 9:14 ` Jakub Jelinek
2001-05-09 16:42 ` Matt Wilson
2001-05-09 10:27 ` David Woodhouse
2001-05-09 15:01 ` Jeremy Hogan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox