Skip to content

Commit 0a0814c

Browse files
author
Connor Harris
committed
FUCK MAC
1 parent a3bf45b commit 0a0814c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/llvm/expr/expr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,8 +1358,8 @@ LLVMValueRef codegen_expr_cast(CodeGenContext *ctx, AstNode *node) {
13581358
// Integer to Pointer
13591359
if (source_kind == LLVMIntegerTypeKind &&
13601360
target_kind == LLVMPointerTypeKind) {
1361-
if (!target_type) {
1362-
fprintf(stderr, "Error: target_type is NULL in inttoptr cast\n");
1361+
if (!target_type || !LLVMTypeIsSized(target_type)) {
1362+
fprintf(stderr, "Error: invalid pointer type in inttoptr cast\n");
13631363
return NULL;
13641364
}
13651365
return LLVMBuildIntToPtr(ctx->builder, value, target_type, "inttoptr");
@@ -1368,8 +1368,8 @@ LLVMValueRef codegen_expr_cast(CodeGenContext *ctx, AstNode *node) {
13681368
// Pointer to Integer
13691369
if (source_kind == LLVMPointerTypeKind &&
13701370
target_kind == LLVMIntegerTypeKind) {
1371-
if (!target_type) {
1372-
fprintf(stderr, "Error: target_type is NULL in ptrtoint cast\n");
1371+
if (!target_type || !LLVMTypeIsSized(target_type)) {
1372+
fprintf(stderr, "Error: invalid integer type in ptrtoint cast\n");
13731373
return NULL;
13741374
}
13751375
return LLVMBuildPtrToInt(ctx->builder, value, target_type, "ptrtoint");

0 commit comments

Comments
 (0)