From: Nix <nix@esperi.org.uk>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
David Miller <davem@davemloft.net>,
xiyou.wangcong@gmail.com, goodmenkernel@gmail.com,
linux-kernel@vger.kernel.org
Subject: Re: Is there any word about this bug in gcc ?
Date: Tue, 20 Nov 2007 21:10:49 +0000 [thread overview]
Message-ID: <877ikc1v3a.fsf@hades.wkstn.nix> (raw)
In-Reply-To: <4742831F.9040408@zytor.com> (H. Peter Anvin's message of "20 Nov 2007 06:50:10 -0000")
On 20 Nov 2007, H. Peter Anvin outgrape:
> This one is definitely messy. There is absolutely no way to know what
> gcc has miscompiled.
Actually, since this only affects abs() calls containing multiplications
or divisions by negative constants, you can at least make a pretty good
guess as to its prevalence with nothing more than grep (first grep -w
for abs, then grepping for "- *[0-9]" and filtering the rest by
eye). (This won't catch cases of macros using abs() which are then
called with negative constants, but it *will* catch those macros, and
one can check the calls to such things by hand. I've done that as well.)
I've grepped all the source on my system (1148 expanded upstream source
tarballs or git/cvs/svn trees including the Linux kernel, most of GNOME,
and all of KDE and X.org) and found that hits are extremely rare: not as
rare as calls to seekdir() and telldir() :) but rare. (Quite a lot of
things multiply by negative constants *inside* a call to abs(), but this
should be unaffected.)
Certain hits:
./nethack/3.4.3/src/cmd.c: else if(x < -2*abs(y))
./nethack/3.4.3/src/cmd.c: else if(y < -2*abs(x))
Possible hits (I'm not sure what the folder would do with this: the
extra level of brackets in the way might affect things but I don't think
so):
./libtheora/libtheora/lib/enc/pp.c: TmpMod = 32 + QValue - 2*(abs(Src[j+Pitch]-Src[j]));
./libtheora/libtheora/lib/enc/pp.c: TmpMod = 32 + QValue - 2*(abs(Src[j+1]-Src[j]));
./xmms/modules/projectM-0.94.20/main.c: wave_x_temp=-2*0.4142*(abs(abs(wave_mystery)-.5)-.5);
./xmms/modules/projectM-0.94.20/main.c: wave_x_temp=-2*0.4142*(abs(abs(wave_mystery)-.5)-.5);
None of these affected programs strike me as being exactly system-
critical. I think the impact of this bug is probably survivable. :)
I'd build a GCC with the patch and verify that these programs are
compiled differently with it, but they look unimportant enough that I'm
not really sure I care enough to do it...
--
`Some people don't think performance issues are "real bugs", and I think
such people shouldn't be allowed to program.' --- Linus Torvalds
next prev parent reply other threads:[~2007-11-20 21:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-20 2:13 zhengyi
2007-11-20 4:16 ` WANG Cong
2007-11-20 5:10 ` H. Peter Anvin
2007-11-20 5:39 ` WANG Cong
2007-11-20 6:03 ` Li Zefan
2007-11-20 6:10 ` WANG Cong
2007-11-20 6:04 ` H. Peter Anvin
2007-11-20 6:17 ` David Miller
2007-11-20 6:41 ` Herbert Xu
2007-11-20 6:47 ` H. Peter Anvin
2007-11-20 6:52 ` Herbert Xu
2007-11-20 12:52 ` Alessandro Suardi
2007-11-20 18:42 ` Sami Farin
2007-11-20 21:10 ` Nix [this message]
2007-11-21 13:16 ` Alexander E. Patrakov
2007-11-21 16:19 ` Alexander E. Patrakov
2007-11-21 17:22 ` Lennart Sorensen
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=877ikc1v3a.fsf@hades.wkstn.nix \
--to=nix@esperi.org.uk \
--cc=davem@davemloft.net \
--cc=goodmenkernel@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xiyou.wangcong@gmail.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®