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

Check overflows when generating witnesses #1546

Merged
merged 2 commits into from
Jul 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cdomains/apron/sharedFunctions.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ struct
let expr = ref (fst @@ coeff_to_const false (Linexpr1.get_cst linexpr1)) in
let append_summand (c:Coeff.union_5) v =
match V.to_cil_varinfo v with
| Some vinfo ->
| Some vinfo when IntDomain.Size.is_cast_injective ~from_type:vinfo.vtype ~to_type:(TInt(ILongLong,[])) ->
(* TODO: What to do with variables that have a type that cannot be stored into ILongLong to avoid overflows? *)
michael-schwarz marked this conversation as resolved.
Show resolved Hide resolved
let var = Cilfacade.mkCast ~e:(Lval(Var vinfo,NoOffset)) ~newt:longlong in
let coeff, flip = coeff_to_const true c in
Expand All @@ -284,6 +284,7 @@ struct
else
expr := BinOp(PlusA,!expr,prod,longlong)
| None -> M.warn ~category:Analyzer "Invariant Apron: cannot convert to cil var: %s" (Var.to_string v); raise Unsupported_Linexpr1
| _ -> M.warn ~category:Analyzer "Invariant Apron: cannot convert to cil var in overflow preserving manner: %s" (Var.to_string v); raise Unsupported_Linexpr1
in
Linexpr1.iter append_summand linexpr1;
!expr
Expand Down
Loading