From b185e56bedaa6870b0a97c4354fb56ab9c2e3174 Mon Sep 17 00:00:00 2001 From: Vic Nightfall Date: Sat, 27 Apr 2024 17:28:00 +0200 Subject: [PATCH] Convert ref to ptr first --- src/compiler.pr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler.pr b/src/compiler.pr index 3754e29..a8fe2d3 100644 --- a/src/compiler.pr +++ b/src/compiler.pr @@ -4294,8 +4294,8 @@ def walk_AlignOf(node: &parser::Node, state: &State) -> Value { } def convert_ref_to_int(node: &parser::Node, value: Value, loc: &Value, state: &State) -> Value { - let gep_ret = state.extract_value(pointer(value.tpe.tpe), value, [1], loc) - return state.ptr_to_int(gep_ret, loc) + let ptr = convert_ref_to_ptr(pointer(value.tpe.tpe if value.tpe.tpe else builtins::int8_), value, loc, state) + return state.ptr_to_int(ptr, loc) } def compare(node: &parser::Node, left: Value, right: Value, state: &State) -> Value {