Skip to content

Assertion failure in llvm_backend_general.cpp when using multiple immediate references in global #5950

@FrancisTheCat

Description

@FrancisTheCat

Context

Operating System & Odin Version:

Odin:    dev-2025-11:adcbfb786
OS:      Arch Linux, Linux 6.17.8-arch1-1
CPU:     AMD Ryzen 5 7640U w/ Radeon 760M Graphics
RAM:     19798 MiB
Backend: LLVM 21.1.5

Failure Information (for bugs)

src/llvm_backend_general.cpp(3299): Assertion Failure: LLVMIsConstant(value.value) = load "test::Foo", ptr , align 8

Steps to Reproduce

package test

Foo :: struct {
	variant: ^Bar,
}

Bar :: struct { x: int, }

//     only happens when this is a pointer
//     |
//     v
foo := &Foo{
	variant = &Bar{},
	//        ^
	//        |
	//        and this is also a pointer
}

main :: proc() {
	_ = foo
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions