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

Assertion '__builtin_expect(__n < this->size(), true)' failed #643

Closed
jwaldmann opened this issue Mar 6, 2021 · 7 comments
Closed

Assertion '__builtin_expect(__n < this->size(), true)' failed #643

jwaldmann opened this issue Mar 6, 2021 · 7 comments

Comments

@jwaldmann
Copy link

Hi. I have this (unsat by construction) CNF (408 vars 2176 clauses) where cryptominisat5 dumps core with message

/usr/include/c++/10/bits/stl_vector.h:1045: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
Aborted (core dumped)

This happens for cryptominisat5 (5.8.0) as packaged with Fedora GNU/Linux (33) on x86_64 , and also when I compile master from this repo.

I added input and log to https://github.com/jwaldmann/cryptominisat/tree/master/tests/cnf-files (crash.*)

@msoos msoos closed this as completed in 97663f9 Mar 6, 2021
@msoos
Copy link
Owner

msoos commented Mar 6, 2021

Hi!

First of all, thanks so much for your work! You are 100% right, and it's a real bug, still in the newest system! Wow. So just for background, it seems that Fedora enforces -D_GLIBCXX_ASSERTIONS which turns on assertions in some C++11 constructs. And it caught a bug that not even clang Address Sanitizer could catch!

Amazing stuff. I will also alert the authors of CCANR where the bug resides. Thanks again for this, great catch! It should now be fixed. Please take master and check :) Thanks again,

Mate

@capiman
Copy link
Contributor

capiman commented Mar 6, 2021

Is it correct that the fix checks if index is not too high and if it is too high just does nothing?
Are you sure, that this fixes the real bug behind (why the index is too high) which as consequence triggers the assert?
Looking over the fix just got me thinking. I could be completely wrong. I don't know the code at all.

@msoos
Copy link
Owner

msoos commented Mar 6, 2021

Yeah, you are right, I am not 100% sure, but it seems fine. I have written a mail to the author of CCAnr, Shaowei Cai, so he can confirm :) Let's hope I was right -- otherwise, I'm quite hopeful I'll be told what the correct fix should be :)

Good point, but I have my fingers crossed and I have a plan for verification! Cheers,

Mate

@capiman
Copy link
Contributor

capiman commented Mar 6, 2021

Ok, thanks for your quick answer and clarification.

@jwaldmann
Copy link
Author

This error is still present with crytominisat5 that comes with (brand new) Fedora-37. I guess that's because they still package version 5.8.0 (https://src.fedoraproject.org/rpms/cryptominisat/blob/rawhide/f/cryptominisat.spec)

@msoos msoos reopened this Oct 22, 2022
@msoos
Copy link
Owner

msoos commented Oct 22, 2022

OK, so this is just an old release that has this bug. Please use a static binary that is available on the top right, under "Releases", here: https://github.com/msoos/cryptominisat/releases

Thanks! Cheers,

Mate

@msoos msoos closed this as completed Oct 22, 2022
@jwaldmann
Copy link
Author

Yes, sure. I can build from source just fine. It's more of a bug in Fedora (them not using your current code). Perhaps some-one around here knows how to ping their maintainer.

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

No branches or pull requests

3 participants