odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
7.02k stars 621 forks source link

(BUG) Using condensed (range index) syntax crashes the compiler (segfault) when allocating literals for a slice of over 1mb #4179

Open ghost opened 2 months ago

ghost commented 2 months ago

Also, see https://github.com/odin-lang/Odin/issues/4178 for a similar issue but runtime crash with dynamic arrays

Windows and latest build of Odin 08-2024 and also on 09-2024 More than one person confirmed, both on Windows 11 both 24H2 One with Intel and one with AMD Both with LLVM 18.1.8

This one is different than issue 4178 in that (a) it is a compiler time crash (confirmed segfault) when an allocation of > 1mb is done for a slice.

Simple Code Example (reproduced on two windows computers)

  arr := []u8{0..=1_200_000 = 1}
  fmt.println(len(arr))

Silent crash on windows but one user (chamberlain) dumped the segfault (see comment below)

Expected behavior: no compiler crash and maybe some informative warnings or errors if appropriate, and should be cross referenced with linked Bug report at top of this.

Chamberlain91 commented 2 months ago

image GDB back trace, hopefully useful.