Skip to content

Commit

Permalink
Fix external/picosat undefined behaviour.
Browse files Browse the repository at this point in the history
  • Loading branch information
Keve committed Dec 2, 2024
1 parent 0fff8d9 commit 31ba2e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
11 changes: 4 additions & 7 deletions UndefinedBehaviour.suppress.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#
# These are errors that need to be taken care of, but in the sprit of
# "Put Your Own Oxygen Mask on First", we provide here a suppression list for
# _external_ sources.
# Suppress errors that are recognized but fix is considered beyond the scope of this project.
# (e.g. in external source).
#

# external/picosat/picosat.c:3432:33: runtime error: applying non-zero offset 8 to null pointer
# +SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior external/picosat/picosat.c:3432:33
pointer-overflow:picosat.c
# For syntax see: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#issue-suppression
#
5 changes: 4 additions & 1 deletion external/picosat/picosat.c
Original file line number Diff line number Diff line change
Expand Up @@ -3429,7 +3429,10 @@ satisfied (PS * ps)
return 0;
assert (!ps->conflict);
assert (bcp_queue_is_empty (ps));
return ps->thead == ps->trail + ps->max_var; /* all assigned */
// return ps->thead == ps->trail + ps->max_var;

return (ps->thead == ps->trail && 0 == ps->max_var)
|| (ps->thead && ps->trail && ps->thead == ps->trail + ps->max_var); /* all assigned */
}

static void
Expand Down

0 comments on commit 31ba2e7

Please sign in to comment.