Closed karl-zylinski closed 3 weeks ago
Odin: dev-2024-06:603581aa5 OS: Windows 10 Professional (version: 22H2), build 19045.4412 CPU: Intel(R) Core(TM) i7-6950X CPU @ 3.00GHz RAM: 32674 MiB Backend: LLVM 17.0.1
Taking address of loop variable shouldn't crash compiler.
Taking address of i in for i in 0..<4 {} crashes compiler.
i
for i in 0..<4 {}
Crash in
gb_internal bool is_type_map(Type *t) { t = base_type(t); return t->kind == Type_Map; }
t is null
Callstack:
package main import "core:fmt" main :: proc() { for i in 0..<4 { fmt.println(&i) } fmt.println("got here") }
Save in a file. Run with odin run .
odin run .
Note that "got here" never prints. In fact, the compiler crashes.
If you do ii := i inside the loop and take address of that, then it compiles and runs fine.
ii := i
Context
Expected Behavior
Taking address of loop variable shouldn't crash compiler.
Current Behavior
Taking address of
i
infor i in 0..<4 {}
crashes compiler.Failure Information (for bugs)
Crash in
t is null
Callstack:![image](https://github.com/odin-lang/Odin/assets/6352002/53da9f20-dcb6-46b1-86cc-60b056e51ce3)
Steps to Reproduce
Save in a file. Run with
odin run .
Note that "got here" never prints. In fact, the compiler crashes.
If you do
ii := i
inside the loop and take address of that, then it compiles and runs fine.