commit cd4dfcf87c170daeafcc1df59d6cd834d4895726
parent 24110631779e71493b5219f7e0fdecc9cd3c7b3e
Author: Drew DeVault <sir@cmpwn.com>
Date: Sat, 3 Jul 2021 11:55:41 -0400
gen: add more indirect assertions
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/gen.c b/src/gen.c
@@ -144,6 +144,8 @@ gen_copy_memcpy(struct gen_context *ctx,
const struct gen_temp *dest,
const struct gen_temp *src)
{
+ assert(dest->indirect);
+ assert(src->indirect);
struct qbe_value rtfunc = {0}, size = {0};
rtfunc.kind = QV_GLOBAL;
rtfunc.name = strdup("rt.memcpy");
@@ -167,6 +169,7 @@ gen_copy_array(struct gen_context *ctx,
const struct gen_temp *dest,
const struct gen_temp *src)
{
+ assert(dest->indirect);
const struct type *atype = type_dealias(dest->type);
assert(atype->storage == STORAGE_ARRAY);
assert(atype->array.length != SIZE_UNDEFINED);
@@ -183,6 +186,7 @@ gen_copy_struct(struct gen_context *ctx,
const struct gen_temp *dest,
const struct gen_temp *src)
{
+ assert(dest->indirect);
const struct type *stype = type_dealias(dest->type);
assert(stype->storage == STORAGE_STRUCT);
if (stype->size > 32) {