Skip to content

Commit

Permalink
Fix external/picosat undefined behaviour.
Browse files Browse the repository at this point in the history
Slightly simplified after discussion with @arrowd.
  • Loading branch information
Keve committed Dec 2, 2024
1 parent 0fff8d9 commit d261906
Show file tree
Hide file tree
Showing 2 changed files with 6 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
#
3 changes: 2 additions & 1 deletion external/picosat/picosat.c
Original file line number Diff line number Diff line change
Expand Up @@ -3429,7 +3429,8 @@ 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 && 0 == ps->max_var)
|| (ps->trail && ps->thead == ps->trail + ps->max_var); /* all assigned */
}

static void
Expand Down

0 comments on commit d261906

Please sign in to comment.