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

If memory isn't zero-initialized the solver might get stuck #5

Open
stbrumme opened this issue Jun 26, 2020 · 1 comment
Open

If memory isn't zero-initialized the solver might get stuck #5

stbrumme opened this issue Jun 26, 2020 · 1 comment

Comments

@stbrumme
Copy link

Hi Marijn,
depending on the compiler optimization level, memory isn't always initialized to zero.
If the values of m_false[0] and m_prev[0] happen to be non-zero, the following lines might create an infinite loop
as soon as the decision variable becomes zero (depends on S->prev[0], too):

microsat/microsat.c

Lines 173 to 174 in 04f9625

while (S->false[decision] || S->false[-decision]) { // As long as the temporay decision is assigned
decision = S->prev[decision]; } // Replace it with the next variable in the decision list

Proposed fix:
set m_false[0] = 0; in initCDCL()

@rokicki
Copy link

rokicki commented Aug 5, 2021

I have observed this too. Please use calloc() instead of malloc(). I propose fixing this by using

  S->DB = (int *) calloc (sizeof (int), S->mem_max); // Allocate the initial database

instead of the malloc line.

@weaversa weaversa mentioned this issue Oct 7, 2021
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

2 participants