let shift_right ~with_alarms ~size e1 e2 =
    let default () = 
          begin
            try
              let size = Extlib.opt_map Int.of_int size in
              arithmetic_function ~with_alarms ">>"
                (Ival.shift_right ~size) e1 e2
            with Not_found ->
              join (topify_arith_origin e1) (topify_arith_origin e2)
          end
    in
    match size with
      | None -> default ()
      | Some size ->
          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
              Kernel.warning ~once:true ~current:true
                "invalid shift of %a-bit value by %a. This path is assumed to be dead."
                Int.pretty size_int
                pretty e2;
            bottom
          end else begin
            if (with_alarms.others <> Aignore)
              && not (is_included e2 valid_range)
            then warn_shift with_alarms size;
            default ()
          end