public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: Xi Ruoyao <xry111@xry111.site>, Kito Cheng <kito.cheng@sifive.com>
Cc: Palmer Dabbelt <palmer@rivosinc.com>,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
	"joseph@codesourcery.com" <joseph@codesourcery.com>,
	"jeffreyalaw@gmail.com" <jeffreyalaw@gmail.com>,
	Darius Rad <darius@bluespec.com>,
	"christoph.muellner@vrull.eu" <christoph.muellner@vrull.eu>,
	DJ Delorie <dj@redhat.com>, Andrew Waterman <andrew@sifive.com>
Subject: Re: [PATCH] Remap __GLIBC_FLT_EVAL_METHOD to 0 if __FLT_EVAL_METHOD__ is -1
Date: Thu, 9 Mar 2023 16:20:02 +0000	[thread overview]
Message-ID: <PAWPR08MB89829025B4FE055220E9265183B59@PAWPR08MB8982.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <0c9b0538369a8632834a7bb9b3e9855c61fbe281.camel@xry111.site>

Hi,

>> GCC isn't set that to -1, but clang/LLVM did, see
>> https://github.com/llvm/llvm-project/issues/60781 and
>> https://reviews.llvm.org/D121122
>
> Hmm, it turns -ffast-math into "-fslow-math" :(.

Yes that alone is a good reason to fix this!

> I agree that if __FLT_EVAL_METHOD__ is not 0, 1, or 2, and the target
> does not have native support for some "special" floating point types, we
> *should* make float_t float and double_t double.
>
> But doing so may blow up rolling-release distros: if a library uses
> float_t and double_t in the API and the distro maintainers rebuilt the
> library with a new Glibc, but (s)he has not rebuilt an application using
> the library yet, the application will just crash or produce "strange"
> results.  Maybe we'll need to issue an alert about this to the distro
> maintainers.

GCC never uses -1, so distros should be fine. We could backport the GLIBC fix.

It's not clear whether float_t/double_t are allowed on interfaces. On x86 GCC uses
2 by default but LLVM uses 0, and with Ofast x86 GCC uses 0 while LLVM uses -1
(which is mapped to 2 by GLIBC). With LLVM fixed it will be 0.

So it looks like a mess, but on x86 there is precedent for incompatible values
between compilers and optimization settings.

Cheers,
Wilco

  parent reply	other threads:[~2023-03-09 16:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  2:26 Kito Cheng
2023-02-18 18:29 ` Palmer Dabbelt
2023-03-09 14:14   ` Kito Cheng
2023-03-09 14:33     ` Xi Ruoyao
2023-03-09 14:59       ` Kito Cheng
2023-03-09 15:18         ` Xi Ruoyao
2023-03-09 16:03           ` Kito Cheng
2023-03-09 16:20           ` Wilco Dijkstra [this message]
2023-03-09 19:37     ` Wilco Dijkstra

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=PAWPR08MB89829025B4FE055220E9265183B59@PAWPR08MB8982.eurprd08.prod.outlook.com \
    --to=wilco.dijkstra@arm.com \
    --cc=andrew@sifive.com \
    --cc=christoph.muellner@vrull.eu \
    --cc=darius@bluespec.com \
    --cc=dj@redhat.com \
    --cc=jeffreyalaw@gmail.com \
    --cc=joseph@codesourcery.com \
    --cc=kito.cheng@sifive.com \
    --cc=libc-alpha@sourceware.org \
    --cc=palmer@rivosinc.com \
    --cc=xry111@xry111.site \
    /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).