Rollup merge of #70126 - wesleywiser:fix_miri_ice_neg_zst_enum_discr, r=RalfJung,eddyb
Fix ICE caused by truncating a negative ZST enum discriminant Fixes #70114 r? @oli-obk or @RalfJung
This commit is contained in:
commit
ecf3ef52a6
3 changed files with 60 additions and 4 deletions
|
|
@ -293,7 +293,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
if let Some(discr) =
|
||||
operand.layout.ty.discriminant_for_variant(bx.tcx(), index)
|
||||
{
|
||||
let discr_val = bx.cx().const_uint_big(ll_t_out, discr.val);
|
||||
let discr_layout = bx.cx().layout_of(discr.ty);
|
||||
let discr_t = bx.cx().immediate_backend_type(discr_layout);
|
||||
let discr_val = bx.cx().const_uint_big(discr_t, discr.val);
|
||||
let discr_val =
|
||||
bx.intcast(discr_val, ll_t_out, discr.ty.is_signed());
|
||||
|
||||
return (
|
||||
bx,
|
||||
OperandRef {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue