-
Notifications
You must be signed in to change notification settings - Fork 75
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
Bitfield Domain #1623
base: master
Are you sure you want to change the base?
Bitfield Domain #1623
Conversation
…d some revision. Possible side-effects and runtime in O(n^2) while O(n) should be possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semgrep OSS found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
…act bitfield by eliminating constants that would result in a shift to zero beforehand
* implemented modulo * current changes * implementation of add, sub, mul based on paper * implemented neg * bug fixes for arith operators --------- Co-authored-by: Adrian Krauß <[email protected]>
Overflow and wrapping
…into bitfield-shifts
This reverts commit ff8c4c7.
…hift a b since in that case shift a b = zero always.
…the value is signed
Add first unit tests
Bitfield shifts
let bf = ref (bot ()) in | ||
while Z.leq !current max_ik do | ||
bf := BArith.join !bf (BArith.of_int (Ints_t.of_bigint !current)); | ||
current := Z.add !current Z.one |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.z-add-one Warning
((z3, o3),{underflow=false; overflow=false}) | ||
|
||
let neg ?no_ov ik x = | ||
M.trace "bitfield" "neg"; |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.trace-not-in-tracing Warning
let refine_with_excl_list ik t (excl : (int_t list * (int64 * int64)) option) : t = t | ||
|
||
let invariant_ikind e ik = | ||
M.trace "bitfield" "invariant_ikind"; |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.trace-not-in-tracing Warning
| _ -> norm ik bf |> fst | ||
|
||
let refine_with_interval ik bf (int: (int_t * int_t) option) : t = | ||
M.trace "bitfield" "refine_with_interval"; |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.trace-not-in-tracing Warning
norm ik bf |> fst | ||
|
||
let refine_with_excl_list ik bf (excl : (int_t list * (int64 * int64)) option) : t = | ||
M.trace "bitfield" "refine_with_excl_list"; |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.trace-not-in-tracing Warning
let lognot ik i1 = BArith.lognot i1 | ||
|
||
let shift_right ik a b = | ||
M.trace "bitfield" "shift_right"; |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.trace-not-in-tracing Warning
norm ik @@ (BArith.shift_right ik a b |> Option.value ~default: (bot ())) | ||
|
||
let shift_left ik a b = | ||
M.trace "bitfield" "shift_left"; |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.trace-not-in-tracing Warning
else (top_of ik,{underflow=false; overflow=false}) | ||
|
||
let rem ik x y = | ||
M.trace "bitfield" "rem"; |
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: semgrep.trace-not-in-tracing Warning
…ic-operations 10 extend norm to arithmetic operations
Added Quickcheck
This pull request introduces a new bitfield domain, into the IntDomain.
Currently being worked on...