From: "Alexander E. Patrakov" <patrakov@gmail.com>
To: Nix <nix@esperi.org.uk>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
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: Wed, 21 Nov 2007 18:16:25 +0500 [thread overview]
Message-ID: <47442FA9.6020600@gmail.com> (raw)
In-Reply-To: <877ikc1v3a.fsf@hades.wkstn.nix>
Nix wrote:
> 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.)
I implemented a different approach: patched gcc with the official fix plus a
call to emit a warning (see below), and recompiled the whole LFS LiveCD (see the
list of packages at
http://wiki.linuxfromscratch.org/livecd/browser/trunk/packages). Only libtheora
emitted a warning.
> 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))
Sure, this is a hit, but nethack is not on my LiveCD.
> 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]));
This did emit a warning, I have already reported it:
https://trac.xiph.org/ticket/1260
> ./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);
Not a hit, probably due to conversions between int and double.
--- trunk/gcc/fold-const.c 2007/11/17 13:46:53 130257
+++ trunk/gcc/fold-const.c 2007/11/17 14:22:42 130258
@@ -6095,6 +6095,9 @@
}
break;
}
+ /* If the constant is negative, we cannot simplify this. */
+ if (tree_int_cst_sgn (c) == -1)
+ { warning(0, "Unpatched gcc miscompiles this"); break; }
/* FALLTHROUGH */
case NEGATE_EXPR:
if ((t1 = extract_muldiv (op0, c, code, wide_type, strict_overflow_p))
--
Alexander E. Patrakov
next prev parent reply other threads:[~2007-11-21 13:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-20 2:13 Is there any word about this bug in gcc ? 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
2007-11-21 13:16 ` Alexander E. Patrakov [this message]
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=47442FA9.6020600@gmail.com \
--to=patrakov@gmail.com \
--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=nix@esperi.org.uk \
--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