Skip to content

Commit

Permalink
Fix lb_add_global_generated_with_name
Browse files Browse the repository at this point in the history
  • Loading branch information
gingerBill committed Feb 25, 2025
1 parent fd6d7d4 commit 46c0910
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/llvm_backend_general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2790,8 +2790,9 @@ gb_internal lbAddr lb_add_global_generated_with_name(lbModule *m, Type *type, lb
GB_ASSERT(type != nullptr);
type = default_type(type);

isize max_len = 7+8+1;
u8 *str = cast(u8 *)gb_alloc_array(permanent_allocator(), u8, max_len);
u8 *str = cast(u8 *)gb_alloc_array(temporary_allocator(), u8, name.len);
memcpy(str, name.text, name.len);
str[name.len] = 0;

Scope *scope = nullptr;
Entity *e = alloc_entity_variable(scope, make_token_ident(name), type);
Expand Down

0 comments on commit 46c0910

Please sign in to comment.