Skip to content

Redundant overflow check in IntDomTuple.create2_ovc #1794

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sim642
Copy link
Member

@sim642 sim642 commented Jul 30, 2025

As found by @Robotechnic, we perform an overflow check for each integer literal in the program in IntDomTuple.of_int and friends.
When this check is removed (commented out here), nothing seems to break:

  • All tests pass.
  • No unsoundness is revealed on sv-benchmarks (with 60s timeout).

This brings into question whether this check has any purpose at all. I haven't dug into its git history, but it's something we should consider at some point.

@sim642 sim642 added this to the SV-COMP 2026 milestone Jul 30, 2025
@sim642 sim642 added the cleanup Refactoring, clean-up label Jul 30, 2025
@sim642
Copy link
Member Author

sim642 commented Jul 30, 2025

This happens inside of_const in the constant evaluation in base:

| Const (CInt (num,ikind,str)) ->
(match str with Some x -> if M.tracing then M.tracel "casto" "CInt (%s, %a, %s)" (Z.to_string num) d_ikind ikind x | None -> ());
Int (ID.cast_to ikind (IntDomain.of_const (num,ikind,str)))

Notably, it's immediately followed by a cast to the created ik, so we actually do two overflow checks per integer literal.
Even if it is necessary for something I'm not yet aware of, there's definitely no reason to do it twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Refactoring, clean-up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant