<algorithm>: debug checks for predicates are observable
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
Describe the bug
Debug version std::min_element assumes that the range is not modified while working on it.
It triggers the following check:
https://github.com/microsoft/STL/blob/5be7d49c243979231dff35919d3a3d813d75d714/stl/inc/xutility#L1589-L1598
This assertion is triggered when std::min_element is used on array of std::atomic values that are incremented independently by concurrent threads.
DevCom-222276 reporter asks:
Are there any limitations in the standard about std::min_elements() that I should know?
Additional context
- Skipped libcxx tests:
https://github.com/microsoft/STL/blob/06827feb4cdc4d2328dfbfab9fd5302de6058dd9/tests/libcxx/expected_results.txt#L586-L589
Also tracked by DevCom-222276 and Microsoft-internal VSO-592348 / AB#592348.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the debug check in stl/inc/xutility around lines 1589-1598 and the skipped libcxx entries in tests/libcxx/expected_results.txt around lines 586-589. Reproduce the std::min_element scenario using concurrently incremented std::atomic values, then establish the expected handling of the observable predicate checks and update the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100