@@ -136,32 +136,58 @@ module Make (AD : Domain.T) = struct
136136 let (Annot (tm_, (path_vars, last_var), bt, _)) = tm in
137137 match tm_ with
138138 | `Arbitrary ->
139- let sign, bits = Option. get (BT. is_bits_bt bt) in
140- let sign_str = match sign with Unsigned -> " UNSIGNED" | Signed -> " SIGNED" in
141- ( [] ,
142- [] ,
143- mk_expr
144- (string_call
145- (" BENNET_ARBITRARY_" ^ sign_str)
146- [ mk_expr
147- (AilEconst (ConstantInteger (IConstant (Z. of_int bits, Decimal , None ))))
148- ]) )
139+ (match bt with
140+ | Loc () -> ([] , [] , mk_expr (string_call " BENNET_ARBITRARY_POINTER" [] ))
141+ | Bits (sign , bits ) ->
142+ let sign_str = match sign with Unsigned -> " UNSIGNED" | Signed -> " SIGNED" in
143+ ( [] ,
144+ [] ,
145+ mk_expr
146+ (string_call
147+ (" BENNET_ARBITRARY_" ^ sign_str)
148+ [ mk_expr
149+ (AilEconst
150+ (ConstantInteger (IConstant (Z. of_int bits, Decimal , None ))))
151+ ]) )
152+ | _ ->
153+ failwith
154+ (Printf. sprintf
155+ " Arbitrary: only pointer and bitvector types are supported, got %s"
156+ (Pp. plain (BT. pp bt))))
149157 | `Symbolic -> failwith " TODO"
150158 | `ArbitraryDomain _ ->
151- let sign, bits = Option. get (BT. is_bits_bt bt) in
152- let sign_str = match sign with Unsigned -> " UNSIGNED" | Signed -> " SIGNED" in
153- ( [] ,
154- [] ,
155- mk_expr
156- (string_call
157- (" BENNET_ARBITRARY_" ^ sign_str)
158- [ mk_expr
159- (AilEconst (ConstantInteger (IConstant (Z. of_int bits, Decimal , None ))))
160- ]) )
159+ (match bt with
160+ | Loc () -> ([] , [] , mk_expr (string_call " BENNET_ARBITRARY_POINTER" [] ))
161+ | Bits (sign , bits ) ->
162+ let sign_str = match sign with Unsigned -> " UNSIGNED" | Signed -> " SIGNED" in
163+ ( [] ,
164+ [] ,
165+ mk_expr
166+ (string_call
167+ (" BENNET_ARBITRARY_" ^ sign_str)
168+ [ mk_expr
169+ (AilEconst
170+ (ConstantInteger (IConstant (Z. of_int bits, Decimal , None ))))
171+ ]) )
172+ | _ ->
173+ failwith
174+ (Printf. sprintf
175+ " ArbitraryDomain: only pointer and bitvector types are supported, got %s"
176+ (Pp. plain (BT. pp bt))))
161177 | `ArbitrarySpecialized ((min_inc , min_ex ), (max_inc , max_ex )) ->
162- let sign, bits = Option. get (BT. is_bits_bt bt) in
163- let sign_char = match sign with Unsigned -> 'u' | Signed -> 'i' in
164- let cn_ty = Printf. sprintf " cn_bits_%c%d" sign_char bits in
178+ let cn_ty =
179+ match bt with
180+ | Loc () -> " cn_pointer"
181+ | Bits (sign , bits ) ->
182+ let sign_char = match sign with Unsigned -> 'u' | Signed -> 'i' in
183+ Printf. sprintf " cn_bits_%c%d" sign_char bits
184+ | _ ->
185+ failwith
186+ (Printf. sprintf
187+ " ArbitrarySpecialized: only pointer and bitvector types are supported, \
188+ got %s"
189+ (Pp. plain (BT. pp bt)))
190+ in
165191 (* Build argument expressions for bounds - NULL for None *)
166192 let mk_bound_arg = function
167193 | None -> mk_expr (AilEconst ConstantNull )
0 commit comments