Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meeting Proposal: Do we allow zero-sized memory accesses? #12

Closed
RalfJung opened this issue Jul 30, 2023 · 4 comments
Closed

Meeting Proposal: Do we allow zero-sized memory accesses? #12

RalfJung opened this issue Jul 30, 2023 · 4 comments
Labels
post-meeting-actions The meeting has been held, but some action items remain to be done or moved to be tracked elsewhere

Comments

@RalfJung
Copy link
Member

Summary

In #10 we decided to allow offset(0) on all pointers. What about zero-sized load/store/copy, do we allow those as well for arbitrary pointers?

Reading

https://hackmd.io/@CV5q1SRASEuY8WfOgd_3iQ/S1vaTT7oh

Comment policy

These issues are meant to be used as an "announcements channel" regarding the proposal, and not as a
place to discuss the technical details. Feel free to subscribe to updates. We'll post comments when
reviewing the proposal in meetings or making a scheduling decision. In the meantime, if you have
questions or ideas, ping the proposers on Zulip (or elsewhere).

@RalfJung RalfJung added the meeting-proposal Proposal for a discussion topic at a team meeting label Jul 30, 2023
@RalfJung RalfJung changed the title Do we allow zero-sized memory accesses? Meeting Proposal: Do we allow zero-sized memory accesses? Jul 30, 2023
@RalfJung
Copy link
Member Author

RalfJung commented Sep 5, 2023

We didn't really reach a conclusion.

We discussed the "zero-sized accesses as optimization helpers" problem quite a bit. Generally the concerns were:

  • the original motivation by Connor here is arguably a hack to work around a lack of stable ABI for slice references; we shouldn't adjust our semantics to accommodate for hacks when the alternative is to stabilize an ABI for slices
  • we might want to support in-place shrinking of allocations, which already breaks the example

More explicit ways to get the optimization hint to the compiler were discussed; however, the point was made that we should still be concerned with optimizing code people naively write without giving explicit hints.

For null, most people didn't see a reason to disallow zero-sized null accesses, except for maybe out of an abundance of caution to avoid accidentally allowing code we might regret allowing later.

We didn't get around to discussing the alternative model for achieving provenance monotonicity.

@RalfJung RalfJung added post-meeting-actions The meeting has been held, but some action items remain to be done or moved to be tracked elsewhere and removed meeting-proposal Proposal for a discussion topic at a team meeting labels Sep 24, 2023
@RalfJung
Copy link
Member Author

I guess the post-meeting action is for me to write up a more concrete proposal and start FCP on it. I'm still leaning towards "all pointers can do zero-sized accesses (except maybe on null)", if only to avoid a distinction between pointers that can and pointers that cannot do such accesses.

There was a bunch of follow-up discussion after the meeting on Zulip that should also be summarized.

@RalfJung
Copy link
Member Author

I guess the post-meeting action is for me to write up a more concrete proposal and start FCP on it.

Done that: rust-lang/unsafe-code-guidelines#472

@RalfJung
Copy link
Member Author

RalfJung commented Nov 4, 2023

I've kicked of the FCP process in that issue, I don't think there is a reason to still keep this one open.

@RalfJung RalfJung closed this as completed Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
post-meeting-actions The meeting has been held, but some action items remain to be done or moved to be tracked elsewhere
Projects
None yet
Development

No branches or pull requests

1 participant