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 failed #125

Open
calintat opened this issue Jul 23, 2024 · 2 comments · May be fixed by #138
Open

Assertion failed #125

calintat opened this issue Jul 23, 2024 · 2 comments · May be fixed by #138

Comments

@calintat
Copy link

I started using clarabel in a project and managed to make the following assertion fail:

debug_assert!(*p.iter().max().unwrap_or(&0) < x.len());

Unfortunately I don't have a test case to reproduce it, as I am generating the LP problems dynamically and they are massive.

@lovasoa
Copy link

lovasoa commented Nov 1, 2024

Indeed, the line looks incorrect to me.

debug_assert!(*p.iter().max().unwrap_or(&0) < x.len());

If p and x are both empty, the unsafe block is a harmless no-op, but the assert reduces to 0 < 0 which is false.
The assert could be corrected as:

debug_assert!(p.is_empty() || *p.iter().max().unwrap() < x.len());

What do you think @goulart-paul ?

goulart-paul added a commit that referenced this issue Nov 26, 2024
@goulart-paul
Copy link
Member

Yes, I agree. Fixed in #138.

Apologies for the delay. I was overtaken by term time teaching and only coming back to fix things here now.

@goulart-paul goulart-paul linked a pull request Nov 26, 2024 that will close this issue
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 a pull request may close this issue.

3 participants