public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/55522] -funsafe-math-optimizations is unexpectedly harmful, especially w/ -shared Date: Mon, 12 Sep 2022 07:01:33 +0000 [thread overview] Message-ID: <bug-55522-4-QaNAAgsEk3@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-55522-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fweimer at redhat dot com --- Comment #20 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Brendan Dolan-Gavitt from comment #19) > I read through the crtfastmath.c implementations for the other affected > targets and confirmed that they do all set flush-to-zero in this thread: > > https://threadreaderapp.com/thread/1567612053363347461.html > > I agree that there should be a way for a shared library to link > crtfastmath.o if it wants that behavior. But is there a reason > -l:crtfastmath.o isn't sufficient in that case? Why does it need to be > enabled automatically when -Ofast/-ffast-math/-funsafe-math optimizations > are turned on? The reasons for most of the "globbing" into -ffast-math/-Ofast are the rules for SPEC CPU 2006 base flags which IIRC limited the number of flags allowed (that's no longer a requirement for SPEC CPU 2017). And of course that users will not know of the flags but are likely not interested in denormals when using -ffast-math. > The other note I would add is that in multi-threaded applications, > crtfastmath.o is already not behaving as intended: FTZ/DAZ will only be set > in the CPU state of the thread that loaded the shared library; it's hard to > imagine a case where a user wants individual threads to have different > FTZ/DAZ (unless they explicitly manage that by hand). Example: [...] Yeah. Not sure how often dynamic objects are opened from within threads though. That said, a possibility to enforce "consistency" at least would be to save/restore the FP state around dlopen() so that shared objects loaded not at program startup would not affect FP state at all? The same could be done for shared objects loaded at program startup of course. The other way around would eventually be to make the CTOR __tls, that should eventually force all threads to change their FP state(?).
next prev parent reply other threads:[~2022-09-12 7:01 UTC|newest] Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-11-29 0:52 [Bug c++/55522] New: " luto at mit dot edu 2012-11-29 1:49 ` [Bug c++/55522] " luto at mit dot edu 2012-11-29 8:57 ` [Bug target/55522] " rguenth at gcc dot gnu.org 2012-11-30 1:41 ` luto at mit dot edu 2015-04-28 18:23 ` orion at cora dot nwra.com 2021-10-06 1:15 ` ilya.konstantinov at gmail dot com 2022-09-06 22:40 ` foom at fuhm dot net 2022-09-06 22:55 ` pinskia at gcc dot gnu.org 2022-09-06 22:57 ` sam at gentoo dot org 2022-09-07 10:06 ` egallager at gcc dot gnu.org 2022-09-08 17:09 ` luto at kernel dot org 2022-09-09 10:32 ` rguenth at gcc dot gnu.org 2022-09-09 10:50 ` rguenth at gcc dot gnu.org 2022-09-11 15:46 ` brendandg at nyu dot edu 2022-09-12 7:01 ` rguenth at gcc dot gnu.org [this message] 2022-09-12 9:47 ` fw at gcc dot gnu.org 2022-09-14 17:03 ` brendandg at nyu dot edu 2022-10-07 9:27 ` aph at gcc dot gnu.org 2022-10-07 17:00 ` hjl.tools at gmail dot com 2022-10-10 9:17 ` fw at gcc dot gnu.org 2022-10-10 16:45 ` hjl.tools at gmail dot com 2022-10-10 16:46 ` hjl.tools at gmail dot com 2022-10-10 19:33 ` brendandg at nyu dot edu 2022-12-19 10:36 ` cvs-commit at gcc dot gnu.org 2022-12-26 1:12 ` cvs-commit at gcc dot gnu.org 2023-01-12 13:46 ` rguenth at gcc dot gnu.org 2023-01-13 3:35 ` sam at gentoo dot org 2023-01-13 7:47 ` rguenth at gcc dot gnu.org 2023-01-13 11:14 ` cvs-commit at gcc dot gnu.org 2023-01-13 11:14 ` cvs-commit at gcc dot gnu.org 2023-01-16 13:31 ` cvs-commit at gcc dot gnu.org 2023-01-18 2:46 ` cvs-commit at gcc dot gnu.org 2023-01-23 12:34 ` cvs-commit at gcc dot gnu.org 2023-01-27 3:26 ` cvs-commit at gcc dot gnu.org 2023-01-27 14:47 ` cvs-commit at gcc dot gnu.org 2023-01-27 14:47 ` cvs-commit at gcc dot gnu.org 2023-01-27 14:47 ` cvs-commit at gcc dot gnu.org 2023-01-27 14:47 ` cvs-commit at gcc dot gnu.org 2023-01-27 14:47 ` rguenth at gcc dot gnu.org 2023-04-30 3:58 ` arthur200126 at gmail dot com 2023-10-16 15:36 ` o.hlinka at gmail dot com 2023-10-17 7:08 ` rguenth at gcc dot gnu.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-55522-4-QaNAAgsEk3@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).