Skip to content

Make all longjmp and pthread_exit related behavior TBD #31

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

Merged
merged 9 commits into from
Jun 15, 2020

Conversation

BatmanAoD
Copy link
Member

Per #30, the initial "C unwind" RFC will not specify when longjmp and pthread_exit is well-defined.


Conversely, if, due to a bug, `longjmp` were called unconditionally, then this
code would have undefined behavior on all platforms when `c` is false, because
`foo` would not be a POF.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect that the compiler would warn in this scenario, also

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm misunderstanding, but how would the compiler provide a warning for this? The extern function is in C, so the compiler can't determine under what conditions it will longjmp. Or do you mean it would warn in any scenario where a frame is not guaranteed to be a POF at the time it calls a "cancelable" function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean it would warn in any scenario where a frame is not guaranteed to be a POF at the time it calls a "cancelable" function?

This is what I meant. I think it's going to be quite rare that you have a function that sometimes cancels but you happen to know that on this particular call it will not and therefore you want to take advantage of that by having a pending destructor. In such a case, adding an #[allow] annotation seems reasonable to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a comment to that effect

@BatmanAoD BatmanAoD merged commit 9e1e794 into rust-lang:master Jun 15, 2020
@BatmanAoD BatmanAoD deleted the longjmp-tbd branch June 15, 2020 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants