@@ -928,7 +928,7 @@ struct
928928 (* | Lval (Mem e, ofs) -> get ~man st (eval_lv ~man (Mem e, ofs)) *)
929929 | (Mem e , ofs ) ->
930930 (* if M.tracing then M.tracel "cast" "Deref: lval: %a" d_plainlval lv;*)
931- let rec contains_vla (t :typ ) = match t with
931+ let rec contains_vla (t :typ ) = match Cil. unrollType t with
932932 | TPtr (t , _ ) -> contains_vla t
933933 | TArray (t , None, args ) -> true
934934 | TArray (t , Some exp , args ) when isConstant exp -> contains_vla t
@@ -1452,7 +1452,8 @@ struct
14521452 match eval_rv_address ~man man.local e with
14531453 | Address a ->
14541454 let slen = Seq. map String. length (List. to_seq (AD. to_string a)) in
1455- let lenOf = function
1455+ let lenOf t =
1456+ match Cil. unrollType t with
14561457 | TArray (_ , l , _ ) -> (try Some (lenOfArray l) with LenOfArray -> None )
14571458 | _ -> None
14581459 in
@@ -1563,7 +1564,7 @@ struct
15631564 let lval = Addr.Mval. to_cil mval in
15641565 (try `Lifted (Bytes. to_string (Hashtbl. find char_array lval))
15651566 with Not_found -> Queries.Result. top q)
1566- | _ -> (* what about ISChar and IUChar? *)
1567+ | _ -> (* TODO: what about ISChar and IUChar? what about TEnum ? *)
15671568 (* ignore @@ printf "Type %a\n" d_plaintype t; *)
15681569 Queries.Result. top q
15691570 end
@@ -2030,10 +2031,8 @@ struct
20302031 match exp with
20312032 | None -> nst
20322033 | Some exp ->
2033- let t_override = match Cilfacade. fundec_return_type fundec with
2034- | TVoid _ -> M. warn ~category: M.Category. Program " Returning a value from a void function" ; assert false
2035- | ret -> ret
2036- in
2034+ let t_override = Cilfacade. fundec_return_type fundec in
2035+ assert (not (Cil. isVoidType t_override)); (* Returning a value from a void function, CIL removes the Return expression for us anyway. *)
20372036 let rv = eval_rv ~man man.local exp in
20382037 let st' = set ~man ~t_override nst (return_var () ) t_override rv in
20392038 match ThreadId. get_current ask with
@@ -2284,7 +2283,7 @@ struct
22842283 ) a
22852284 | _ -> false
22862285
2287- let get_size_of_ptr_target man ptr =
2286+ let get_size_of_ptr_target man ptr = (* TODO: deduplicate with memOutOfBounds *)
22882287 let intdom_of_int x =
22892288 ID. of_int (Cilfacade. ptrdiff_ikind () ) (Z. of_int x)
22902289 in
@@ -2301,7 +2300,7 @@ struct
23012300 let pts_elems_to_sizes (addr : Queries.AD.elt ) =
23022301 begin match addr with
23032302 | Addr (v , _ ) ->
2304- begin match v.vtype with
2303+ begin match Cil. unrollType v.vtype with
23052304 | TArray (item_typ , _ , _ ) ->
23062305 let item_typ_size_in_bytes = size_of_type_in_bytes item_typ in
23072306 begin match man.ask (Queries. EvalLength ptr) with
0 commit comments