Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Compiler panic: Invalid type conversion ^A to #relative(u16) ^A

Open FourteenBrush opened this issue 10 months ago • 1 comments

Context

I get a compiler panic on the following code:

package something

main :: proc() {
    Ptr :: struct($T: typeid) {
        ptr: #relative(u16) ^T,
    }

    A :: struct {}
    a := A {}
    ptr := Ptr(A) { ptr = &a }
}

Note that this happens with every backing size of the relative pointer. Compiler output:

something.main
lb_emit_conv: src -> dst
Not Identical ^A != #relative(u16) ^A
Not Identical ^A != #relative(u16) ^A
Not Identical 7e0d0b9f4050 != 7e0d4ca0ddd0
Not Identical 7e0d0b9f4050 != 7e0d4ca0ddd0
src/llvm_backend_expr.cpp(2291): Panic: Invalid type conversion: '^A' to '#relative(u16) ^A' for procedure 'something.main'

Operating System & Odin Version

Odin: dev-2024-03:63d6b4752 OS: Pop!_OS 22.04 LTS, Linux 6.8.0-76060800daily20240311-generic CPU: AMD Ryzen 7 5800H with Radeon Graphics
RAM: 13827 MiB Backend: LLVM 14.0.0

Expected Behavior

This should compile fine?

Steps to Reproduce

Simply run above file with odin run something.odin -file

FourteenBrush avatar Mar 26 '24 21:03 FourteenBrush

I assume this is probably not getting fixed due to core:relative being a thing?

FourteenBrush avatar Apr 29 '24 10:04 FourteenBrush