public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "matz at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/41963] [4.5 Regression] 177.mesa in SPEC CPU 2K is miscompiled Date: Fri, 06 Nov 2009 13:07:00 -0000 [thread overview] Message-ID: <20091106130743.32437.qmail@sourceware.org> (raw) In-Reply-To: <bug-41963-682@http.gcc.gnu.org/bugzilla/> ------- Comment #4 from matz at gcc dot gnu dot org 2009-11-06 13:07 ------- It's a simple miscompilation of the cse_reciprocals pass that is exposed by my change: % cat pr41963.c #include <math.h> static __attribute__((noinline)) void f (float *dst, float *src) { int i, j; for (i = 0; i < 2; i++) { float len; dst[0] = src[0]; dst[1] = src[1]; len = sqrtf (dst[0] * dst[0] + dst[1] * dst[1]); if (len > 0.5f) { len = 1.0f / len; dst[0] *= len; dst[1] *= len; } } } int main() { float dst[2], src[2]; src[0] = 2.0f; src[1] = 5.0f; f (dst, src); printf ("%f %f -> %f\n", dst[0], dst[1], dst[0] * dst[0] + dst[1] * dst[1]); return 0; } The reciprocal pass overwrites the statement len = sqrtf(temp) (and a later use of len in 1/len) with len = rsqrtf(temp) (and removed the 1/len computation) But it does this without caring for _any_ other use of len, e.g. in the compare or the second loop iteration. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41963
next prev parent reply other threads:[~2009-11-06 13:07 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-11-06 5:13 [Bug middle-end/41963] New: " hjl dot tools at gmail dot com 2009-11-06 7:40 ` [Bug middle-end/41963] " ubizjak at gmail dot com 2009-11-06 10:10 ` rguenth at gcc dot gnu dot org 2009-11-06 12:03 ` matz at gcc dot gnu dot org 2009-11-06 13:07 ` matz at gcc dot gnu dot org [this message] 2009-11-06 15:05 ` matz at gcc dot gnu dot org 2009-11-06 15:15 ` matz at gcc dot gnu dot org 2009-11-06 21:54 ` ubizjak at gmail dot com 2009-11-06 21:54 ` ubizjak at gmail dot com 2009-11-08 18:10 ` uros at gcc dot gnu dot org 2009-11-09 13:07 ` rguenth at gcc dot gnu dot org 2009-11-09 19:45 ` pinskia at gcc dot gnu dot org
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=20091106130743.32437.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).