-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
ECMA-335 addendum should mention that null managed pointers are legal #69690
Labels
area-VM-coreclr
documentation
Documentation bug or enhancement, does not impact product or test code
Milestone
Comments
Additional note: we might want to point out that managed pointers just past the end of managed objects are legal. ECMA today only says managed pointers just past the end of managed arrays are legal. As fixed buffers take off, we might have more occurrences of people treating non-array objects as array-like. |
davidwrighton
added a commit
to davidwrighton/runtime
that referenced
this issue
Jul 7, 2022
- Declare that it is valid to have a null managed pointer, but declare it invalid to actually read from such a pointer - In practice this has always been legal, as it has been legal to managed pointer locals for years, and they are included in the list of values that are zeroinitialized on method start - Also clarify the rules to permit a managed pointer to the location directly following a managed object. - This is a new capability in the spec that will likely be useful for accessing fixed size data buffers held in objects of the GC heap. However, the GC has been able to tolerate this behavior for many years, so there is no code change necessary. Fixes dotnet#69690
jkotas
added a commit
that referenced
this issue
Aug 2, 2022
* Describe the validity of null managed pointers - Declare that it is valid to have a null managed pointer, but declare it invalid to actually read from such a pointer - In practice this has always been legal, as it has been legal to managed pointer locals for years, and they are included in the list of values that are zeroinitialized on method start - Also clarify the rules to permit a managed pointer to the location directly following a managed object. - This is a new capability in the spec that will likely be useful for accessing fixed size data buffers held in objects of the GC heap. However, the GC has been able to tolerate this behavior for many years, so there is no code change necessary. Fixes #69690 Co-authored-by: Jan Kotas <[email protected]> Co-authored-by: Aaron Robinson <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area-VM-coreclr
documentation
Documentation bug or enhancement, does not impact product or test code
Ref: https://github.com/dotnet/runtime/blob/main/docs/design/specs/Ecma-335-Augments.md
We expose APIs like
Unsafe.IsNullRef
andUnsafe.NullRef
, which imply that nullptr managed pointers are supported across our runtimes. However, ECMA-335, Sec. II.14.4.2 and III.1.1.5.2 both explicitly state that nullptr managed pointers are disallowed. ECMA should be updated.The text was updated successfully, but these errors were encountered: