Odin
Odin copied to clipboard
Compiler crash on slice with too large of an element
Context
Odin: dev-2024-10:d0eae4a9a OS: Windows 11 Professional (version: 24H2), build 26100.1882 CPU: 12th Gen Intel(R) Core(TM) i5-12600 RAM: 32540 MiB Backend: LLVM 18.1.8
The compiler correctly reports the size of "an array of a huge type" being an issue. The compiler crashes when encountering "a slice of a huge type".
Error code: -1073741819
Reproduction
package main
main :: proc() {
Huge :: [256][256]u32
// For this case the compiler warns
// Warning: Declaration of 'foo' may cause a stack overflow
// due to its type '[2][256][256]u32' having a size of 524288 bytes
foo := [2]Huge{ Huge{}, Huge{} }
// For this case the compiler just crashes
bar := []Huge{ Huge{} }
}