moroso / compiler

The compiler for the Moroso project.
4 stars 3 forks source link

Initialization of u16 arrays broken #60

Open msullivan opened 4 years ago

msullivan commented 4 years ago

If we do something like

static list_known_crc: u16[5]  = [ 0xd4b0, 0x3340, 0x6a79, 0xe714, 0xe3c1 ];

with the IR compiler we actually compute the whole thing as a 32-bit array and then try to copy it over. In addition to having the wrong values, this can overwrite other things.

I think it is a type inference issue? Marking one of them as u16 is sufficient to fix it.