aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-08-19 17:38:18 +0100
committergingerBill <bill@gingerbill.org>2021-08-19 17:38:18 +0100
commit38841dd46e6bb5879200c0a8e2f879c8cfa005d6 (patch)
treed742d0f758224110243741ae1d99f4d7e51ab3da /src/llvm_backend.cpp
parente722af7f6126d821ec2847769b234ed18f61518c (diff)
Fix race condition from `add_entity_use` due to Entity.identifier
Diffstat (limited to 'src/llvm_backend.cpp')
-rw-r--r--src/llvm_backend.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index 05b10ffd7..d50a512c7 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -1204,8 +1204,9 @@ void lb_generate_code(lbGenerator *gen) {
LLVMBool is_optimized = build_context.optimization_level > 0;
AstFile *init_file = m->info->init_package->files[0];
- if (m->info->entry_point && m->info->entry_point->identifier && m->info->entry_point->identifier->file) {
- init_file = m->info->entry_point->identifier->file;
+ Ast *ident = m->info->entry_point->identifier.load();
+ if (m->info->entry_point && ident && ident->file) {
+ init_file = ident->file;
}
LLVMBool split_debug_inlining = false;