about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/base.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/base.rs b/src/base.rs
index 362ba7e1c2c..5a28656add2 100644
--- a/src/base.rs
+++ b/src/base.rs
@@ -660,7 +660,9 @@ fn codegen_stmt<'tcx>(
                         .val
                         .try_to_bits(fx.tcx.data_layout.pointer_size)
                         .unwrap();
-                    if fx.clif_type(operand.layout().ty) == Some(types::I8) {
+                    if operand.layout().size.bytes() == 0 {
+                        // Do nothing for ZST's
+                    } else if fx.clif_type(operand.layout().ty) == Some(types::I8) {
                         let times = fx.bcx.ins().iconst(fx.pointer_type, times as i64);
                         // FIXME use emit_small_memset where possible
                         let addr = lval.to_ptr().get_addr(fx);