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

Enhance _STL_VERIFY for std::barrier #3757

Merged
merged 3 commits into from
Jun 15, 2023
Merged

Enhance _STL_VERIFY for std::barrier #3757

merged 3 commits into from
Jun 15, 2023

Conversation

achabense
Copy link
Contributor

Fixes #3748.

@achabense achabense requested a review from a team as a code owner June 9, 2023 17:41
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jun 9, 2023
@StephanTLavavej StephanTLavavej self-assigned this Jun 9, 2023
stl/inc/barrier Outdated Show resolved Hide resolved
stl/inc/barrier Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej removed their assignment Jun 10, 2023
@@ -93,9 +93,8 @@ public:
}

_NODISCARD_BARRIER_TOKEN arrival_token arrive(ptrdiff_t _Update = 1) noexcept /* strengthened */ {
// Shifting before precondition check, so that exceeding max() will trigger precondition check too
_STL_VERIFY(_Update > 0 && _Update <= (max) (), "Precondition: update > 0 (N4950 [thread.barrier.class]/12)");
Copy link
Contributor Author

@achabense achabense Jun 13, 2023

Choose a reason for hiding this comment

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

Sorry for this late review -- I didn't realize it was "Pending"-ed.

_Update <= max() is necessary, as it avoids large positive value becoming negative after shift. However, this will cause a mismatch between the check and error message. This check is more relevant to the constraint "update <= expected count", but I don't think we should put it off. I have no idea how to make an improvement. Any ideas?

Copy link
Member

Choose a reason for hiding this comment

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

I'm okay with a slightly confusing message here.

@StephanTLavavej StephanTLavavej self-assigned this Jun 14, 2023
@StephanTLavavej
Copy link
Member

I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 25a58af into microsoft:main Jun 15, 2023
@StephanTLavavej
Copy link
Member

Thanks for enhancing the Great Galactic Barrier that keeps the Alpha Quadrant safe! 🛡️ 🛸 😹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<barrier>: Some _STL_VERIFYs are not working well
3 participants