aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-06-24 07:28:18 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-06-24 07:28:18 +0200
commit398081f8960d34b1a9c28f9d2736f15a80d02c85 (patch)
treea6547ae0a2e3d57a0bf2113be8522c366c4d3899
parente1ca4f3603010dd85c6da0d3a887c9fdcfa9c43e (diff)
Assert that neither int nor floats exceed 128 bits
-rw-r--r--src/codegen.c2
1 files changed, 1 insertions, 1 deletions
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();