mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jim Wright <jwright@penguincomputing.com>
To: <redhat-devel-list@redhat.com>, <linux-kernel@vger.kernel.org>,
	Jeremy Hogan <jhogan@redhat.com>,
	Mike Vaillancourt <mikev@redhat.com>
Cc: Jim Wright <jwright@penguincomputing.com>,
	Philip Pokorny <ppokorny@penguincomputing.com>
Subject: bug in redhat gcc 2.96
Date: Tue, 8 May 2001 20:05:06 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.33.0105081927320.1798-100000@foo.penguincomputing.com> (raw)

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


             reply	other threads:[~2001-05-09  3:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-09  3:05 Jim Wright [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33.0105081927320.1798-100000@foo.penguincomputing.com \
    --to=jwright@penguincomputing.com \
    --cc=jhogan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikev@redhat.com \
    --cc=ppokorny@penguincomputing.com \
    --cc=redhat-devel-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®