commit c0b8c03e15abdee1cfcce1ac392b3e04e17e94c8
parent 22fb3cf780accc1e313e10035072198403f8f655
Author: Eyal Sawady <ecs@d2evs.net>
Date: Sat, 24 Apr 2021 13:01:11 -0400
gen_cast_to_tagged: loosen assertion
The previous assertion could get triggered by `1: (int! | u8)`
Signed-off-by: Eyal Sawady <ecs@d2evs.net>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gen.c b/src/gen.c
@@ -1222,7 +1222,10 @@ gen_cast_to_tagged(struct gen_context *ctx,
gen_temp(ctx, &ptr, &qbe_long, "to_tagged.from.%d");
pushc(ctx->current, "to_tagged; valid subtype");
- assert(subtype->id == from->id); // Lowered by check
+ struct type ssub = *subtype, sfrom = *from;
+ ssub.flags = 0;
+ sfrom.flags = 0;
+ assert(type_hash(&ssub) == type_hash(&sfrom)); // Lowered by check
struct qbe_value *storage;
if (expr->cast.value->result->size == 0) {