#[Solved] LLVM panic invalid type conversion

1 messages · Page 1 of 1 (latest)

safe creek
#

I get this error:

err.t1
lb_emit_conv: src -> dst
Not Identical [3]f32 != [^]union {[3]f32}
Not Identical [3]f32 != [^]union {[3]f32}
Not Identical 7f09088bdc40 != 7f0900596ea0
Not Identical 7f09088bdc40 != 7f0900596ea0
src/llvm_backend_expr.cpp(2324): Panic: Invalid type conversion: '[3]f32' to '[^]union {[3]f32}' for procedure 'err.t1'
[1]    398735 illegal hardware instruction (core dumped)  ~/git/Odin/odin test err.odin -debug -file

For the following program:

package err

import "core:testing"

import rl "vendor:raylib"

@test
t1 :: proc(t: ^testing.T) {
    Unit :: struct {
        target: union{ rl.Vector3 },
    }
    units := make_soa(#soa[dynamic]Unit, 5)

    ptrs := make([dynamic]#soa^ #soa[]Unit, 5)

    all := units[:]
    for _, i in all {
        ptrs[i] = &all[i]
    }

    for p, i in ptrs {
        // This seems to be the problem
        p.target = rl.Vector3{auto_cast i, auto_cast i, auto_cast i}
    }

    for u, i in units {
        testing.expect_value(t, u.target, rl.Vector3{auto_cast i, auto_cast i, auto_cast i})
    }
}

By accident i found that p.target = ... is the problem but how would i even proceed with such an error or better yet is what im trying to do possible in a better way?