Skip to content

Commit

Permalink
Codegen unimplemented for unsupported constant slices
Browse files Browse the repository at this point in the history
See model-checking#1339 for more details.
  • Loading branch information
celinval committed Jul 6, 2022
1 parent 4a4539b commit 71b1188
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions kani-compiler/src/codegen_cprover_gotoc/codegen/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ impl<'tcx> GotocCtx<'tcx> {
ty::Slice(slice_ty) => {
if let Uint(UintTy::U8) = slice_ty.kind() {
// The case where we have a slice of u8 is easy enough: make an array of u8
// TODO: Handle cases with larger int types by making an array of bytes,
// then using byte-extract on it.
let slice =
data.inspect_with_uninit_and_ptr_outside_interpreter(start..end);
let vec_of_bytes: Vec<Expr> = slice
Expand All @@ -124,6 +122,16 @@ impl<'tcx> GotocCtx<'tcx> {
len_expr,
&self.symbol_table,
);
} else {
// TODO: Handle cases with other types such as tuples and larger integers.
let loc = span.map_or(Location::none(), |s| self.codegen_span(s));
let typ = self.codegen_ty(lit_ty);
return self.codegen_unimplemented(
"Constant slice value with 2+ bytes",
typ,
loc,
"https://github.com/model-checking/kani/issues/1339",
);
}
}
_ => {}
Expand Down

0 comments on commit 71b1188

Please sign in to comment.