From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-arch@vger.kernel.org, Jade Alglave <j.alglave@ucl.ac.uk>,
p796231 <Peter.Sewell@cl.cam.ac.uk>,
gcc@gcc.gnu.org, llvm-dev@lists.llvm.org,
Luc Maranget <luc.maranget@inria.fr>,
mingo@kernel.org, akpm@linux-foundation.org, dhowells@redhat.com,
linux-kernel@vger.kernel.org, parallel@lists.isocpp.org,
will.deacon@arm.com, peterz@infradead.org,
Ramana.Radhakrishnan@arm.com
Subject: Re: [isocpp-parallel] Proposal for new memory_order_consume definition
Date: Sat, 27 Feb 2016 15:10:33 -0800 [thread overview]
Message-ID: <20160227231033.GW3522@linux.vnet.ibm.com> (raw)
In-Reply-To: <CA+55aFyHmykKc=YybJMo9ZUO352MY5noJVB4-K1Lkjmw4UHXfA@mail.gmail.com>
On Sat, Feb 27, 2016 at 11:16:51AM -0800, Linus Torvalds wrote:
> On Feb 27, 2016 09:06, "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> wrote:
> >
> >
> > But we do already have something very similar with signed integer
> > overflow. If the compiler can see a way to generate faster code that
> > does not handle the overflow case, then the semantics suddenly change
> > from twos-complement arithmetic to something very strange. The standard
> > does not specify all the ways that the implementation might deduce that
> > faster code can be generated by ignoring the overflow case, it instead
> > simply says that signed integer overflow invoked undefined behavior.
> >
> > And if that is a problem, you use unsigned integers instead of signed
> > integers.
>
> Actually, in the case of there Linux kernel we just tell the compiler to
> not be an ass. We use
>
> -fno-strict-overflow
That is the one!
> or something. I forget the exact compiler flag needed for "the standard is
> as broken piece of shit and made things undefined for very bad reasons".
>
> See also there idiotic standard C alias rules. Same deal.
For which we use -fno-strict-aliasing.
> So no, standards aren't that important. When the standards screw up, the
> right answer is not to turn the other cheek.
Agreed, hence my current (perhaps quixotic and insane) attempt to get
the standard to do something useful for dependency ordering. But if
that doesn't work, yes, a fallback position is to get the relevant
compilers to provide flags to avoid problematic behavior, similar to
-fno-strict-overflow.
Thanx, Paul
> And undefined behavior is pretty much *always* a sign of "the standard is
> wrong".
>
> Linus
next prev parent reply other threads:[~2016-02-27 23:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 1:10 Proposal for new memory_order_consume definition Paul E. McKenney
2016-02-20 2:15 ` [isocpp-parallel] " Tony V E
2016-02-20 19:53 ` Paul E. McKenney
[not found] ` <CAPUmR1bw=N4NkjAK1zn_X0+84KEaEAM6HZCHZJy_txqC9hMgSg@mail.gmail.com>
2016-02-26 23:56 ` Lawrence Crowl
2016-02-27 17:06 ` Paul E. McKenney
[not found] ` <CA+55aFyHmykKc=YybJMo9ZUO352MY5noJVB4-K1Lkjmw4UHXfA@mail.gmail.com>
2016-02-27 23:10 ` Paul E. McKenney [this message]
2016-02-28 8:27 ` Markus Trippelsdorf
2016-02-28 16:13 ` Linus Torvalds
2016-02-28 16:50 ` [llvm-dev] " cbergstrom
2016-02-29 17:37 ` Michael Matz
2016-02-29 17:57 ` Linus Torvalds
2016-02-29 19:38 ` Lawrence Crowl
2016-02-29 21:12 ` [llvm-dev] " James Y Knight
2016-02-29 20:45 ` Toon Moene
2016-02-29 18:17 ` Michael Matz
2016-03-01 1:28 ` Paul E. McKenney
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=20160227231033.GW3522@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=Peter.Sewell@cl.cam.ac.uk \
--cc=Ramana.Radhakrishnan@arm.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=j.alglave@ucl.ac.uk \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm-dev@lists.llvm.org \
--cc=luc.maranget@inria.fr \
--cc=mingo@kernel.org \
--cc=parallel@lists.isocpp.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.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 NNTP newsgroup(s).