linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: paulmck@kernel.org
Cc: linux-toolchains@vger.kernel.org, peterz@infradead.org,
	hpa@zytor.com,  rostedt@goodmis.org, gregkh@linuxfoundation.org,
	keescook@chromium.org
Subject: Re: A few proposals, this time from the C++ standards committee
Date: Wed, 5 Jun 2024 11:24:58 -0700	[thread overview]
Message-ID: <CAHk-=wicGX9dfkR4ec1+urbbHGdKiKTpAckn5+OmyzGkPpVAJA@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wh921g_+TJ33JRxRGFM2uruMdqG-SONfFOD9UOsLQJ_uw@mail.gmail.com>

On Wed, 5 Jun 2024 at 11:08, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> I would suggest that people look at improving 'restrict' and making it
> more useful, and just admit that the type-based thing was a mistake.

Note that I did see the other proposal on 'restrict', but I think that
one was a pretty small improvement.

I think people should work on making it work better in general. Real
compilers already effectively do that thin in much more interesting
ways, as part of finding the origin of a pointer.

For example, both clang and gcc have a notion of "alloc-like" functions:

   __attribute__((__malloc__))

which is a function attribute that basically says "the returned
pointer is a 'restricted' pointer". Except it is much better than the
'restrict' keyword, in that it actually works on real loads.

So I think the real answer to type-based aliasing is to throw the
garbage out, and instead help extend on existing notions of
"provenance of where the pointer came from".

Because compilers already do a *lot* of that kind of alias analysis,
and I think the proper approach is to strive to help compilers do
better on something reliable, instead of working around the fact that
some rodent-like creature got dropped on its head a few too many
times, and came up with the notion of type-based aliasing.

                     Linus

  reply	other threads:[~2024-06-05 18:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-17  9:14 A few proposals, this time from the C++ standards committee Paul E. McKenney
2024-03-17 18:50 ` Linus Torvalds
2024-03-17 20:56   ` Paul E. McKenney
2024-03-17 20:50 ` Linus Torvalds
2024-03-17 21:04   ` Paul E. McKenney
2024-03-17 21:44   ` Linus Torvalds
2024-03-17 22:02     ` Paul E. McKenney
2024-03-17 22:34       ` Linus Torvalds
2024-03-17 23:46         ` Jonathan Martin
2024-03-18  0:42         ` Paul E. McKenney
2024-03-18  1:49           ` Linus Torvalds
2024-03-18  2:44             ` Paul E. McKenney
2024-03-18  2:57               ` Randy Dunlap
2024-03-18  4:42                 ` Paul E. McKenney
2024-03-18  4:45                   ` Randy Dunlap
2024-03-18 16:32   ` Linus Torvalds
2024-03-18 16:48     ` H. Peter Anvin
2024-03-19  7:41 ` Marco Elver
2024-03-19  8:07   ` Jakub Jelinek
2024-06-05 13:52 ` Paul E. McKenney
2024-06-05 18:08   ` Linus Torvalds
2024-06-05 18:24     ` Linus Torvalds [this message]
2024-06-05 19:16       ` Paul E. McKenney
2024-06-05 19:12     ` 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='CAHk-=wicGX9dfkR4ec1+urbbHGdKiKTpAckn5+OmyzGkPpVAJA@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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: 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).