这是indexloc提供的服务,不要输入任何密码
Skip to content

Global variable, pointer to self bug #5938

@myleskrisik

Description

@myleskrisik

Context

I am basically trying to make a declare and instantiate a global struct, which has the links (pointers) for an intrusive data structure, where all the links point to itself.

Odin: dev-2025-11-nightly
OS: Fedora Linux 42 (Workstation Edition), Linux 6.17.7-200.fc42.x86_64
CPU: AMD Ryzen 5 2600 Six-Core Processor
RAM: 15902 MiB
Backend: LLVM 20.1.8

Expected Behavior

I want the data structures pointers to point to itself

Current Behavior

Crash

Failure Information (for bugs)

Steps to Reproduce

Here is a minimal reproduction of the issue:

package main

UI_Box :: struct {
	first, last: ^UI_Box,
	next, previous: ^UI_Box,
	parent: ^UI_Box,
}

ui_box_nil := UI_Box {
	first = &ui_box_nil,
	last = &ui_box_nil,
	next = &ui_box_nil,
	previous = &ui_box_nil,
	parent = &ui_box_nil,
}

main :: proc()
{
	box := &ui_box_nil
}

I am getting the following error: src/llvm_backend_const.cpp(1680): Assertion Failure: tav.mode != Addressing_Invalid

I just run odin build .

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions