Skip to content

Commit

Permalink
make sure we handle all transmute invocations, including diverging ones
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 25, 2019
1 parent b91bf7a commit 6797d52
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/librustc_mir/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
ret: Option<(PlaceTy<'tcx, M::PointerTag>, mir::BasicBlock)>,
) -> InterpResult<'tcx, bool> {
let substs = instance.substs;
let intrinsic_name = &*self.tcx.item_name(instance.def_id()).as_str();

// We currently do not handle any diverging intrinsics.
// We currently do not handle any intrinsics that are *allowed* to diverge,
// but `transmute` could lack a return place in case of UB.
let (dest, ret) = match ret {
Some(p) => p,
None => return Ok(false)
None => match intrinsic_name {
"transmute" => throw_ub!(Unreachable),
_ => return Ok(false),
}
};
let intrinsic_name = &*self.tcx.item_name(instance.def_id()).as_str();

match intrinsic_name {
"caller_location" => {
Expand Down

0 comments on commit 6797d52

Please sign in to comment.