public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dvdfrdmn at users dot sf dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/27321] New: Compare against constant infinity fails with IBM long double format Date: Wed, 26 Apr 2006 02:17:00 -0000 [thread overview] Message-ID: <bug-27321-12598@http.gcc.gnu.org/bugzilla/> (raw) Test code: long double x = __builtin_infl(); int main() { int r = x == __builtin_infl(); return r ? 0 : 1; } Commands to reproduce: gcc -mlong-double-128 tc.c ./a.out && echo ok || echo fail No problem with -mlong-double-64. Cause: GCC first transforms (x == infinity) to (x > long_double_max_val). The maximum value returned by real_maxval is encoded as infinity due to rounding in encode_ibm_extended. This does not happen with the LDBL_MAX declared in system headers because one of the bits is cleared. Potential fix: --- real.c.orig 2005-09-19 12:56:24.000000000 -0400 +++ real.c 2006-04-25 21:18:32.000000000 -0400 @@ -2205,6 +2205,8 @@ real_maxval (REAL_VALUE_TYPE *r, int sig np2 = SIGNIFICAND_BITS - fmt->p * fmt->log2_b; memset (r->sig, -1, SIGSZ * sizeof (unsigned long)); clear_significand_below (r, np2); + if (REAL_MODE_FORMAT_COMPOSITE_P (mode)) + clear_significand_bit (r, SIGNIFICAND_BITS - fmt->pnan - 1); } -- Summary: Compare against constant infinity fails with IBM long double format Product: gcc Version: 4.0.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dvdfrdmn at users dot sf dot net GCC target triplet: powerpc-apple-darwin8 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27321
next reply other threads:[~2006-04-26 2:17 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-04-26 2:17 dvdfrdmn at users dot sf dot net [this message] 2006-04-26 2:27 ` [Bug middle-end/27321] " pinskia at gcc dot gnu dot org 2006-04-30 7:33 ` 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=bug-27321-12598@http.gcc.gnu.org/bugzilla/ \ --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).