Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Incorrect codegen (assignment gets zeroed) 2

Open awwdev opened this issue 1 year ago • 0 comments

Context

Odin e24315eed892aeb6c53da78c415455a80ccdf5e5 Linux

Bug

Bug :: struct  {
    val: int,
    arr: []int,
}

v: int = 123
bug := Bug {
    val = v, //expected: 123 but get 0
    arr = {42}, //this line seems to cause the bug
}
fmt.println(bug)

Prints: Bug{val = 0, arr = [42]}

Remarks

I think the assignment above worked as expected with the dev-2023-02 release and afterwards broke. Another case of zero assignment: https://github.com/odin-lang/Odin/issues/2352.

awwdev avatar Apr 17 '23 07:04 awwdev