let handle_signed_overflow ~with_alarms syntactic_context typ e interpreted_e =
  match unrollType typ with
    TInt(kind, _)
      when Value_parameters.SignedOverflow.get()
        && isSigned kind ->
          let size = bitsSizeOf typ in
          let mn, mx =
            let b = Int.power_two (size-1) in
            Int.neg b, Int.pred b
          in
          let all_values =
            Cvalue_type.V.inject_ival (Ival.inject_range (Some mn) (Some mx))
          in
          if V.is_included interpreted_e all_values
          then interpreted_e
          else begin
              CilE.set_syntactic_context syntactic_context;
              CilE.warn_signed_overflow with_alarms e
                (Int.to_int64 mn) (Int.to_int64 mx);
              let r = V.narrow all_values interpreted_e in
              Value_parameters.debug
                "signed overflow: %a reduced to %a@."
                V.pretty interpreted_e
                V.pretty r;
              r
            end
  | _ -> interpreted_e