linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: linux-toolchains@vger.kernel.org
Cc: peterz@infradead.org, hpa@zytor.com, rostedt@goodmis.org,
	gregkh@linuxfoundation.org, keescook@chromium.org,
	torvalds@linux-foundation.org
Subject: Re: A few proposals, this time from the C++ standards committee
Date: Wed, 5 Jun 2024 06:52:44 -0700	[thread overview]
Message-ID: <ed4f5dcb-04f5-485b-83cd-d47e6264d1f9@paulmck-laptop> (raw)
In-Reply-To: <83f5e119-6e32-415a-a1c8-8e6b0bd11a75@paulmck-laptop>

Hello!

And another set of potentially relevant papers, this time back to the C
standards committee.  I have commented on the ones that I expect would
be of interest, but please feel free to take a look at the others.

Thoughts?

							Thanx, Paul

------------------------------------------------------------------------

Full list:  https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3248.pdf
	The main purpose of the meeting is resolving formal issues,
	so this list is aspirational.

N3210 A String Type for C, Martin Uecker
	https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3210.pdf

	The proposed strings have explicit size of type size_t and a
	variable-length array of characters.  Maybe not of interest
	for the kernel, but of historical interest, given some of the
	late-1970s and early 1980s opposition to NUL-terminated strings.
	Of course, dedicating 64 bits to the string length would have
	been a no-go back then.  ;-)

N3211 Memory-Safety in C, Martin Uecker
	https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3211.pdf

	An interesting (and self-described) experiment to obtain
	compile-time checkable memory safety within the bounds and spirit
	of the C language.  There is a static mode that restricts the code
	to that which can be checked for memory safety at compile time,
	and a dynamic mode that includes run-time checks (and which is
	less restrictive.  The mode is selected with a pragma.

	There is not yet a prototype implementation, so early days.

N3212 Polymorphic Types, Martin Uecker
	https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3212.pdf

	Proposes function overloading.  This proposal avoids some
	typeof() issues by proposing a new _Typeof().  This proposal
	claims to permit changing a function to overloaded without
	changing the ABI for that function.

	If this works out, it might be used to replace some macros.
	The proposal calls out libffi as a target for this purpose.

	Also early days for this proposal.

N3214 Generic selection expression with a type operand, Aaron Ballman
	https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3214.pdf

	This proposes standardizing a Clang extension that extends
	the _Generic() keyword to take a type name as well as an
	assignment-expression.	This is a step towards allowing more
	natural generics in C.

	This appears to be a reasonably mature proposal, given the
	existing work in Clang.  The GCC folks might have opinions,
	of course.

N3223 The C Standard charter, Seacord et al.
	https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3223.pdf

	This document describes that the C standards committee is working
	towards and what they take into account in their work.

N3254 Accessing byte arrays, v4, Seacord et al.
	https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3254.pdf

	This document proposes standardizing GCC's approach for casting
	between structures and arrays of bytes, addresssing one annoying
	case of undefined behavior.  Atomics are an issue on deep embedded
	platforms, and one way forward is to make support for casting
	to and from atomics optional.

	This appears to be a reasonably mature proposal, given the
	existing work in GCC.  The Clang folks might have opinions,
	of course.

n3234 The semantics of the restrict qualifier, Jens Gustedt
	https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3234.htm

	This document attempts to formalize and rationalize the semantics
	of the C-language "restrict" keyword.  I have not yet read it
	carefully enough to have an informeed opinion on it, other than
	on the bravery of the author.  ;-)

	My perhaps overly cynical guess is that the Linux kernel will
	want to stick with its current command-line approach to this
	issue, but who knows?

n3243 A Memory model with Synchronization based type aliasing V1,
	Eskil Steenberg Hald
	https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3243.pdf

	This document's purpose is to allow the compiler more freedom
	to optimize in the face of pointer casts by introducing some
	additional undefined behavior.	It also introduces the notion
	of an aliasing barrier, which might well avoid much of the damage.
	In addition, the author does explicitly note the need to avoid
	breaking existing code, even if that code does have UB.  One
	surprising (to me) quote:

		"Our current thinking is that, perhaps the best way
		forward is to define an alternative memory model for C,
		based on these ideas, current implementations, existing
		code, and borrowing some from the Linux kernel memory
		model, and using external standards such as posix for
		concurrency."

	Perhaps it is time to refine the LKMM formalizations surrounding
	dependencies, especially given another surprising quote for an
	issue with the current C memory model: "Numerous issues with
	the concurrency model, like dependent reads."  The surprise is
	that the issue is stated to be with the language's concurrency
	model instead of with the dependencies themselves.

	This is early days for this proposal, and thus a good time to
	review and provide feedback.

N3244 Slay Some Earthly Demons I, Martin Uecker
	https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3244.pdf

	This proposal takes on a number of cases of undefined behavior,
	recommending compiler diagnostics in some cases and removing or
	weakening the undefinedness in others.

  parent reply	other threads:[~2024-06-05 13:52 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 [this message]
2024-06-05 18:08   ` Linus Torvalds
2024-06-05 18:24     ` Linus Torvalds
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=ed4f5dcb-04f5-485b-83cd-d47e6264d1f9@paulmck-laptop \
    --to=paulmck@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.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).