@@ -522,8 +522,7 @@ struct
522522 (* cast to voidPtr are ignored TODO what happens if our value does not fit? *)
523523 | TPtr (t ,_ ) ->
524524 Address (match v with
525- | Int x when ID. equal_to Z. zero x = `Eq -> AD. null_ptr
526- | Int x -> AD. top_ptr
525+ | Int x -> AD. of_int x
527526 (* we ignore casts to void* (above)! TODO report UB! *)
528527 | Address x -> cast_addr t x
529528 (* | Address x -> x*)
@@ -613,10 +612,7 @@ struct
613612 | (Int x , Int y ) -> (try Int (ID. join x y) with IntDomain. IncompatibleIKinds m -> Messages. warn ~category: Analyzer ~tags: [Category Imprecise ] " %s" m; Top )
614613 | (Float x , Float y ) -> Float (FD. join x y)
615614 | (Int x, Address y)
616- | (Address y , Int x ) -> Address (match ID. equal_to Z. zero x with (* TODO: AD.of_int? *)
617- | `Eq -> AD. join AD. null_ptr y
618- | `Neq -> AD. (join y not_null)
619- | `Top -> AD. join y AD. top_ptr)
615+ | (Address y , Int x ) -> Address (AD. join y (AD. of_int x))
620616 | (Address x , Address y ) -> Address (AD. join x y)
621617 | (Struct x , Struct y ) -> Struct (Structs. join x y)
622618 | (Union x , Union y ) -> Union (Unions. join x y)
@@ -646,10 +642,7 @@ struct
646642 | (Float x , Float y ) -> Float (FD. widen x y)
647643 (* TODO: symmetric widen, wtf? *)
648644 | (Int x, Address y)
649- | (Address y , Int x ) -> Address (match ID. equal_to Z. zero x with (* TODO: AD.of_int? *)
650- | `Eq -> AD. widen AD. null_ptr (AD. join AD. null_ptr y)
651- | `Neq -> AD. (widen y (join y not_null))
652- | `Top -> AD. widen y (AD. join y AD. top_ptr))
645+ | (Address y , Int x ) -> Address (AD. widen y (AD. join y (AD. of_int x)))
653646 | (Address x , Address y ) -> Address (AD. widen x y)
654647 | (Struct x , Struct y ) -> Struct (Structs. widen x y)
655648 | (Union x , Union y ) -> Union (Unions. widen x y)
0 commit comments