public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: pinskia@gmail.com
Cc: "Maciej W. Rozycki" <macro@codesourcery.com>,
	"libc-ports@sourceware.org" <libc-ports@sourceware.org>,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
	Doug Gilmore <Doug.Gilmore@imgtec.com>
Subject: Re: [RFC][PATCH] MIPS: IEEE 754-2008 NaN encoding support
Date: Fri, 23 Aug 2013 04:12:00 -0000	[thread overview]
Message-ID: <20130823041222.GR20515@brightrain.aerifal.cx> (raw)
In-Reply-To: <6DDE6A09-5E4D-4FCF-B126-7021735F431F@gmail.com>

On Thu, Aug 22, 2013 at 09:07:34PM -0700, pinskia@gmail.com wrote:
> On Aug 22, 2013, at 8:38 PM, Rich Felker <dalias@aerifal.cx> wrote:
> 
> > On Thu, Aug 22, 2013 at 08:10:49PM -0700, pinskia@gmail.com wrote:
> >>>> To give you a small example this:
> >>>> 
> >>>> double foo = __builtin_nan ("");
> >>>> 
> >>>> will compile to a different data pattern with opposite (qNaN vs sNaN) 
> >>>> semantics depending on the NaN encoding mode selected in the compiler.  
> >>>> Modules built with different NaN encodings are therefore not compatible,
> >>> 
> >>> They are compatible except in the area of subtle exception-raising
> >>> semantics that GCC *DOES NOT GET CORRECT ANYWAY*. GCC is full of
> >>> incorrect optimizations that cause the exception flags to be wrong.
> >>> Until that's fixed, I don't see why this issue is so important to
> >>> merit flagging object files build with different modes as having an
> >>> incompatible ABI. The semantics are slightly different, but the type
> >>> sizes and the way they're passed are all the same, and programs that
> >>> don't use the GCC extension __builtin_nan() or the NAN macro from
> >>> math.h, or writing raw float values to/from disk, are completely
> >>> unaffected.
> >> 
> >> Can you give an example and maybe a link to a GCC bug where this is
> >> recorded before spreading this kind of information. I really don't
> >> like blank statements without facts to back up them.
> > 
> > int foo() { double x = 0; x /= 0.0; return 1; }
> > 
> > While this is a stupid, trivial example, the issue has come up A LOT
> > for us in musl's implementation of the math library (based on fdlibm)
> > with nontrivial code.
> 
> Wait you mean dead code? I think the standard/IEEE allows to remove
> it.

They don't. Anyway, here's a less trivial example:

double f(int y){ double x=0; x/=0; if(y) return 1; return x; }

> At -O0, GCC won't remove it though.

That's not helpful; -O0 is not usable for most purposes. The output is
gigantic and slow. And if I'm not mistaken, there are some cases where
even -O0 will mess it up...

Rich

  reply	other threads:[~2013-08-23  4:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-22 23:53 Maciej W. Rozycki
2013-08-23  0:58 ` Rich Felker
2013-08-23  1:41   ` Maciej W. Rozycki
2013-08-23  1:57     ` Rich Felker
2013-08-23  3:11       ` pinskia
2013-08-23  3:38         ` Rich Felker
2013-08-23  4:08           ` pinskia
2013-08-23  4:12             ` Rich Felker [this message]
2013-08-23  4:10     ` Rich Felker
2013-08-23  3:46 ` Rich Felker
2013-08-23 10:53   ` Maciej W. Rozycki
2013-08-23 15:26 ` Joseph S. Myers
2013-09-05 22:47   ` [RFC][PATCH v2] " Maciej W. Rozycki
2013-09-06 16:24     ` Joseph S. Myers
2013-09-10  9:36       ` Maciej W. Rozycki
2013-09-10 23:24         ` Joseph S. Myers
2013-09-16 15:14           ` [PATCH v3] " Maciej W. Rozycki
2013-09-16 15:26             ` Joseph S. Myers
2013-09-18 20:48               ` Maciej W. Rozycki

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=20130823041222.GR20515@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=Doug.Gilmore@imgtec.com \
    --cc=libc-alpha@sourceware.org \
    --cc=libc-ports@sourceware.org \
    --cc=macro@codesourcery.com \
    --cc=pinskia@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).