Skip to content
Snippets Groups Projects
Commit d91eb3c8 authored by David Bühler's avatar David Bühler
Browse files

[Eva] Minor simplification to catch exceptions when reading loop unroll limits.

parent 3adfcc67
No related branches found
No related tags found
No related merge requests found
...@@ -93,22 +93,13 @@ struct ...@@ -93,22 +93,13 @@ struct
let t = let t =
Cil.visitCilTerm (new Logic_utils.simplify_const_lval global_init) t Cil.visitCilTerm (new Logic_utils.simplify_const_lval global_init) t
in in
match Logic_utils.constFoldTermToInt t with try
| Some n -> match Logic_utils.constFoldTermToInt t with
begin | Some n -> Partition.IntLimit (Integer.to_int_exn n)
match Integer.to_int_opt n with | None -> Partition.ExpLimit (term_to_exp t)
| Some n' -> Partition.IntLimit n' with Z.Overflow | Db.Properties.Interp.No_conversion ->
| None -> warn "invalid loop unrolling parameter; ignoring";
warn "invalid loop unrolling parameter (%a); ignoring" default
(Integer.pretty ~hexa:false) n;
default
end
| None ->
try Partition.ExpLimit (term_to_exp t)
with Db.Properties.Interp.No_conversion ->
warn "loop unrolling parameters must be valid expressions; \
ignoring";
default
end end
| _ -> | _ ->
warn "invalid unroll annotation; ignoring"; warn "invalid unroll annotation; ignoring";
......
...@@ -10,6 +10,6 @@ ...@@ -10,6 +10,6 @@
[eva:initial-state] Values of globals at initialization [eva:initial-state] Values of globals at initialization
nondet ∈ [--..--] nondet ∈ [--..--]
[kernel:annot-error] tests/syntax/very_large_integers.c:92: Warning: [kernel:annot-error] tests/syntax/very_large_integers.c:92: Warning:
invalid loop unrolling parameter (-9999999999999999999); ignoring invalid loop unrolling parameter; ignoring
[kernel] User Error: warning annot-error treated as fatal error. [kernel] User Error: warning annot-error treated as fatal error.
[kernel] Frama-C aborted: invalid user input. [kernel] Frama-C aborted: invalid user input.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment