From 398081f8960d34b1a9c28f9d2736f15a80d02c85 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 24 Jun 2024 07:28:18 +0200 Subject: Assert that neither int nor floats exceed 128 bits --- src/codegen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/codegen.c b/src/codegen.c index 80e42cc..69f0214 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -355,6 +355,7 @@ type2llvm(struct cgctx ctx, type_t t) case TYPE_FN: err("codegen: %s: Not implemented for function types", __func__); case TYPE_NUM: + assert((unsigned)t.size * 8 <= 128); if (t.isfloat) { switch (t.size) { case 2: return LLVMHalfTypeInContext(ctx.ctx); @@ -367,7 +368,6 @@ type2llvm(struct cgctx ctx, type_t t) } if (t.size == 0) return LLVMIntPtrTypeInContext(ctx.ctx, ctx.td); - assert((unsigned)t.size * 8 <= 128); return LLVMIntTypeInContext(ctx.ctx, t.size * 8); default: __builtin_unreachable(); -- cgit v1.2.3