aboutsummaryrefslogtreecommitdiff
path: root/qbe.c
diff options
context:
space:
mode:
authorAndrew Chambers <andrewchambers@fastmail.com>2019-02-27 14:15:30 +1300
committerMichael Forney <mforney@mforney.org>2019-02-26 18:30:35 -0800
commit083bd95ef10c480fd234ec25933da27b2fa3fda9 (patch)
tree2dc593664d1eb5815f3c3350c635241e5ae68502 /qbe.c
parent50aeef05f9f8fdb2e56ddc201b1ae7a8d56e3233 (diff)
Don't add zero offsets when zeroing.
Diffstat (limited to 'qbe.c')
-rw-r--r--qbe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qbe.c b/qbe.c
index 68a7d0c..8446886 100644
--- a/qbe.c
+++ b/qbe.c
@@ -865,7 +865,7 @@ zero(struct function *func, struct value *addr, int align, uint64_t offset, uint
while (offset < end) {
if ((align - (offset & align - 1)) & a) {
- tmp = funcinst(func, IADD, &iptr, (struct value *[]){addr, mkintconst(&iptr, offset)});
+ tmp = offset ? funcinst(func, IADD, &iptr, (struct value *[]){addr, mkintconst(&iptr, offset)}) : addr;
funcinst(func, store[a], NULL, (struct value *[]){&z, tmp});
offset += a;
}