Skip to content

LLVM backend panic with duplicate type names in anonymous procedure #6058

@IllusionMan1212

Description

@IllusionMan1212

Context

  • Operating System & Odin Version:
        Odin:    dev-2025-12:7be6d862e
        OS:      Ubuntu 24.04.1 LTS, Linux 6.8.0-51-generic
        CPU:     11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
        RAM:     11758 MiB
        Backend: LLVM 19.1.1

Expected Behavior

The compiler should either build the program without panicking since the types are under separate scopes, or show an error.

Current Behavior

Compiler panics when building the program

Failure Information (for bugs)

Steps to Reproduce

package main

takes_callback :: proc(cb: proc ()) {
    cb()
}

main :: proc() {
    takes_callback(proc () {
        {
            MyStruct :: struct {
                field_1: string,
                field_2: int,
            }

            structs := make([dynamic]MyStruct)

            append(&structs, MyStruct{})
        }

        {

            MyStruct :: struct {
                field_1: string,
                field_2: int,
                field_3: int,
            }

            structs := make([dynamic]MyStruct, 0)
            append(&structs, MyStruct{})
        }
    })
}

Failure Logs

_proclit$anon-1
lb_emit_conv: src -> dst
Not Identical MyStruct != MyStruct
Not Identical struct {field_1: string, field_2: int, field_3: int} != struct {field_1: string, field_2: int}
Not Identical 7227842dd0e0 != 7227842cc700
Not Identical 7227842dd190 != 7227842c1510
src/llvm_backend_expr.cpp(2886): Panic: Invalid type conversion: 'MyStruct' to 'MyStruct' for procedure '_proclit$anon-1'
Illegal instruction (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions