let shift_right ~with_alarms ~size ~signed:_ e1 e2 =
let size_int = Int.of_int size in
let valid_range =
inject_ival (Ival.inject_range (Some Int.zero) (Some (Int.pred size_int)))
in
if not (intersects e2 valid_range) then begin
(warn_shift with_alarms size;
if (with_alarms.others <> Aignore) then
warn_once
"invalid shift of %a-bit value by %a. This path is assumed to be dead."
Int.pretty size_int
pretty e2);
bottom
end else
match e2 with
| Top _ -> warn_shift with_alarms size;
join (topify_arith_origin e1) (topify_arith_origin e2)
| Map m ->
begin
if (with_alarms.others <> Aignore)
&& not (is_included e2 valid_range)
then CilE.warn_shift with_alarms size;
try
let e2 = inject_ival (M.find Base.null m) in
arithmetic_function ~with_alarms ">>"
(Ival.shift_right ~size:size_int) e1 e2
with Not_found ->
join (topify_arith_origin e1) (topify_arith_origin e2)
end