odin-lang/Odin

Compiler assertion failure about invalid SIMD transmute when using struct literal in `append`.

dlandahl opened this issue · 3 comments

Context

On Manjaro linux, compiler version 0.13.0 (also happens on nightly 20-08-02)

Expected Behavior

Expecting either a compilation error or compilation success, depending on whether this should be allowed

Current Behavior

Compiler crash

Steps to Reproduce

odin build the following:

package test

Thing :: struct {
    a, b, c: f32,
}

main :: proc() {

    things: [dynamic]Thing;
    defer delete(things);

    a : f32 = 1;
    b : f32 = 2;
    c : f32 = 3;

    append(&things, Thing { a, b, c });
}

Failure Logs

src/ir.cpp(6074): Assertion Failure: sz == dz Invalid transmute conversion: 'Thing' to 'struct {: #simd[2]f32, : f32}'
Illegal instruction (core dumped)

That's odd. I'm surprised we haven't noticed this one. Maybe it was caused recently 🤔

This appears to be the same or very similar issue as #698 , but we determined that it happens with certain struct layouts consistently and have a minimal repro

Using git bisect I was able to determine when this bug was first introduced: 8672ff1

Same thing happens to me on MacOS , but I can't reproduce it on the commit before that one.