Skip to content

Commit

Permalink
odin-lang#4873 issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
rezwanahmedsami committed Feb 24, 2025
1 parent d234538 commit 98ed49d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/llvm_backend_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3110,6 +3110,17 @@ gb_internal lbValue lb_emit_comp_against_nil(lbProcedure *p, TokenKind op_kind,
}
}
break;
case Type_Array: {
// For arrays where the element type is nil-comparable (like string),
// perform a memory comparison of the entire array.
auto args = array_make<lbValue>(permanent_allocator(), 2);
lbValue lhs = lb_address_from_load_or_generate_local(p, x);
args[0] = lb_emit_conv(p, lhs, t_rawptr);
args[1] = lb_const_int(p->module, t_int, type_size_of(x.type));
lbValue mem_cmp = lb_emit_runtime_call(p, "memory_compare_zero", args);
return lb_emit_comp(p, op_kind, mem_cmp, lb_const_int(p->module, t_int, 0));
} break;


case Type_DynamicArray:
{
Expand Down

0 comments on commit 98ed49d

Please sign in to comment.