let check_comparable ~with_alarms ev1 ev2 =
try
if not (Location_Bytes.is_included ev1 Location_Bytes.top_int)
|| not (Location_Bytes.is_included ev2 Location_Bytes.top_int)
then begin
let null_1, rest_1 = Location_Bytes.split Base.null ev1 in
let null_2, rest_2 = Location_Bytes.split Base.null ev2 in
if (not (Ival.is_included null_1 Ival.zero)) &&
(not (Location_Bytes.equal rest_2 Location_Bytes.bottom ))
then raise Not_found;
if (not (Ival.is_included null_2 Ival.zero)) &&
(not (Location_Bytes.equal rest_1 Location_Bytes.bottom ))
then raise Not_found;
let loc1 = make_loc (loc_bytes_to_loc_bits rest_1) Int_Base.one in
if (not (Locations.is_valid loc1)) ||
let loc2 = make_loc (loc_bytes_to_loc_bits rest_2) Int_Base.one in
(not (Locations.is_valid loc2))
then begin
let base_1, _offs_1 = Location_Bytes.find_lonely_key rest_1 in
let base_2, _offs_2 = Location_Bytes.find_lonely_key rest_2 in
if Base.compare base_1 base_2 <> 0 then raise Not_found;
end
end;
ev1, ev2
with Not_found ->
CilE.warn_pointer_comparison with_alarms;
ev1, ev2