mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Enforce constant pointer cast on global procedure variable initialization x := proc() {}
This commit is contained in:
@@ -780,6 +780,9 @@ lbProcedure *lb_create_startup_runtime(lbModule *main_module, lbProcedure *start
|
|||||||
var->init = init;
|
var->init = init;
|
||||||
} else if (lb_is_const_or_global(init)) {
|
} else if (lb_is_const_or_global(init)) {
|
||||||
if (!var->is_initialized) {
|
if (!var->is_initialized) {
|
||||||
|
if (is_type_proc(init.type)) {
|
||||||
|
init.value = LLVMConstPointerCast(init.value, lb_type(p->module, init.type));
|
||||||
|
}
|
||||||
LLVMSetInitializer(var->var.value, init.value);
|
LLVMSetInitializer(var->var.value, init.value);
|
||||||
var->is_initialized = true;
|
var->is_initialized = true;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user