public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: bfkelly@nsa.gov To: gcc-gnats@gcc.gnu.org Subject: optimization/8585: Linux-x86 optimization bug when using floor and log Date: Thu, 21 Nov 2002 01:36:00 -0000 [thread overview] Message-ID: <20021114212255.25191.qmail@sources.redhat.com> (raw) >Number: 8585 >Category: optimization >Synopsis: Linux-x86 optimization bug when using floor and log >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Nov 14 13:26:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Blair Kelly >Release: gcc-3.2, gcc-20021111 >Organization: >Environment: Reading specs from /.ccs/home/bfkelly/gcc-3.2/Linux-x86/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs Configured with: ../gcc-3.2/configure --enable-languages=c --prefix=/.ccs/home/bfkelly/gcc-3.2/Linux-x86 Thread model: posix gcc version 3.2 >Description: /* Demonstrates gcc-3.2 optimization bug * on Linux-x86 * * works correctly (says floor is 28) * gcc -O0 -o foo foo.c -lm * * works incorrectly (says floor is 27) * gcc -O1 -o foo foo.c -lm * * works incorrectly (says floor is 27) * gcc -O2 -o foo foo.c -lm * */ #include <stdio.h> #include <math.h> main() { double x, y, z; x = 28.0; printf("x= %f (%x %x)\n", x, *(&x), *((&x)+1)); y = floor(x); printf("floor(x)= %f (%x %x)\n", y, *(&y), *((&y)+1)); z = 268435456.0; /* 2^28 */ x = log(z) / log(2.0); printf("x= %f (%x %x)\n", x, *(&x), *((&x)+1)); y = floor(log(z) / log(2.0)); printf("floor(x)= %f (%x %x)\n", y, *(&y), *((&y)+1)); } >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted:
reply other threads:[~2002-11-14 21:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20021114212255.25191.qmail@sources.redhat.com \ --to=bfkelly@nsa.gov \ --cc=gcc-gnats@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).