let get_uminus_assertion ~simplify_constants:simplify_constants ~warning:warning expr =
let t = Cil.typeOf expr in
let size = bitsSizeOf t
in if (size > 64) then (
rte_warn "bitsSize of %a > 64: not treated" d_exp expr ;
[]
)
else
let minType = get_signed_min size in
let assertion () =
let term = translate_C_expr_to_term expr
in Logic_const.prel (Rneq, term, Cil.lconstant minType)
in
if simplify_constants then (
match get_expr_val expr with
| Some a64 ->
if Int64.compare a64 minType = 0 then (
let assertion = assertion ()
in
if warning then
rte_warn "unary minus assert broken: %a" d_predicate_named assertion
;
[ (assertion, Some (make_check_false ())) ]
)
else []
| None -> [ (assertion (), None) ]
) else [ (assertion (), None) ]