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

Fix test errors with _GLIBCXX_DEBUG defined #5693

Merged
merged 1 commit into from Dec 6, 2021

Conversation

msimberg
Copy link
Contributor

@msimberg msimberg commented Dec 3, 2021

Fixes part of #5544.

The is_heap change is due to greater_equal not satisfying https://en.cppreference.com/w/cpp/named_req/Compare. With _GLIBCXX_DEBUG libstdc++ actually gives a surprisingly helpful error message:

 57: In function:
 57:     _RAIter std::is_heap_until(_RAIter, _RAIter, _Compare) [with _RAIter =
 57:     __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<int*,
 57:     std::__cxx1998::vector<int, std::allocator<int> > >,
 57:     std::__debug::vector<int>, std::random_access_iterator_tag>; _Compare =
 57:     std::greater_equal<int>]
 57:
 57: Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).
 57:
 57: Objects involved in the operation:
 57:     instance "functor" @ 0x0x2b53cad26267 {
 57:       type = std::greater_equal<int>;
 57:     }
 57:     iterator::value_type "ordered type" {
 57:       type = int;
 57:     }

The change to is_contiguous_iterator is because vector iterators are different with _GLIBCXX_DEBUG (the pointers are wrapped).

The last change to incplace_merge tests is due to confused use of variables. With _GLIBCXX_DEBUG libstdc++ reported use of moved-from iterators.

There are still a few tests that fail with _GLIBCXX_DEBUG, so I'm not enabling it in CI. If anyone feels like looking into them they're at least uninitialized_copyn and uninitialized_move. They both segfault.

hkaiser
hkaiser previously approved these changes Dec 4, 2021
Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@msimberg
Copy link
Contributor Author

msimberg commented Dec 6, 2021

Force-push only fixed formatting.

bors merge

bors bot pushed a commit that referenced this pull request Dec 6, 2021
5693: Fix test errors with `_GLIBCXX_DEBUG` defined r=msimberg a=msimberg

Fixes part of #5544.

The `is_heap` change is due to `greater_equal` not satisfying https://en.cppreference.com/w/cpp/named_req/Compare. With `_GLIBCXX_DEBUG` libstdc++ actually gives a surprisingly helpful error message:

```
 57: In function:
 57:     _RAIter std::is_heap_until(_RAIter, _RAIter, _Compare) [with _RAIter =
 57:     __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<int*,
 57:     std::__cxx1998::vector<int, std::allocator<int> > >,
 57:     std::__debug::vector<int>, std::random_access_iterator_tag>; _Compare =
 57:     std::greater_equal<int>]
 57:
 57: Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).
 57:
 57: Objects involved in the operation:
 57:     instance "functor" @ 0x0x2b53cad26267 {
 57:       type = std::greater_equal<int>;
 57:     }
 57:     iterator::value_type "ordered type" {
 57:       type = int;
 57:     }
```

The change to `is_contiguous_iterator` is because vector iterators are different with `_GLIBCXX_DEBUG` (the pointers are wrapped). 

The last change to `incplace_merge` tests is due to confused use of variables. With `_GLIBCXX_DEBUG` libstdc++ reported use of moved-from iterators.

There are still a few tests that fail with `_GLIBCXX_DEBUG`, so I'm not enabling it in CI. If anyone feels like looking into them they're at least `uninitialized_copyn` and `uninitialized_move`. They both segfault.

Co-authored-by: Mikael Simberg <mikael.simberg@iki.if>
@msimberg msimberg merged commit ee23875 into STEllAR-GROUP:master Dec 6, 2021
@msimberg msimberg deleted the glibcxx-debug branch December 6, 2021 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants