From: Rich Felker <email@example.com>
To: "Mike Z.Vand" <firstname.lastname@example.org>
Cc: "email@example.com" <firstname.lastname@example.org>
Subject: Re: [musl] Reverting a GCC bug workaround commit from 8 years ago
Date: Tue, 12 Jul 2022 21:22:55 -0400 [thread overview]
Message-ID: <20220713012255.GZ7074@brightrain.aerifal.cx> (raw)
On Tue, Jul 12, 2022 at 11:55:07PM +0000, Mike Z.Vand wrote:
> I was following down a rabbit hole, investigating a weird
> WebAssembly code generation from wasi-libc, when I saw these strange
> volatile attributes for some pointers in stdio source code. As it
> happens, it was a GCC bug workaround that was introduced around 8
> years ago (commit a6adb2bcd8145353943377d6119c1d7a4242bae1 work
> around constant folding bug 61144 in gcc 4.9.0 and 4.9.1).
> As comment explained this commit could be "reconsidered and possibly
> reverted at some point in the future when the broken gcc versions
> are no longer relevant".
> I very much hope it is the time we can revert this and give the
> compiler more wiggle room to do its thing and have less volatile
> keywords here and there for healthier looking code overall.
I don't think there's any valuable "wiggle room" to be had here. The
loads of these would-be constant objects are not in hot paths, and
there should be exactly one load regardless of whether it's volatile
or not. So this is more a matter of "cleanup" than any practical
benefit to be had.
Whether this can be changed probably depends on whether there were any
GCC version series whose lifetimes ended with the bug still present as
well as analysis of whether there were (or still are) any future
related bugs in this area. I don't recall the details but I seem to
remember this being an ongoing area of wrong optimization. I know at
least that there have been related issues with wrongly using derived
knowledge that a weak definition of a function was pure to conclude
that the function (possibly with a different definition) is pure. So
my leaning would be not to do away with any harmless barriers we have
in place against wrong optimization of weak definitions.
prev parent reply other threads:[~2022-07-13 1:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <email@example.com>
2022-07-12 23:55 ` Mike Z.Vand
2022-07-13 1:22 ` Rich Felker [this message]
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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.
Code repositories for project(s) associated with this public inbox
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 NNTP newsgroup(s).