Odin
Odin copied to clipboard
Compiler panic when dealing with overloaded procedures
Context
- Operating System & Odin Version:
Odin: dev-2023-03-nightly:2d71ab6f
OS: Windows 10 Home Basic (version: 22H2), build 19045.2604
CPU: AMD Ryzen 7 3700X 8-Core Processor
RAM: 32694 MiB
Expected Behavior
The following snippet when compiled with odin run t.odin -file
should success and output Bar{signature = 0}
package t
import "core:fmt"
import "core:log"
import "core:intrinsics"
fooA :: proc($T: typeid) -> (ret:T)
where !intrinsics.type_has_field(T, "_base") {
log.infof("fooA: %v", ret)
return ret
}
fooB :: proc($T: typeid) -> (ret:T)
where intrinsics.type_has_field(T, "_base") {
return {}
}
foo :: proc{fooA, fooB}
Bar :: struct {signature : int,}
main :: proc() {
fmt.printf("%v", foo(Bar))
}
Current Behavior
There is a high chance (>50%) for the compilation to fail
Failure Information (for bugs)
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Failure Logs
J:\repos\test>odin run t.odin -file
D:\a\Odin\Odin\src\llvm_backend_general.cpp(2771): Panic:
Error in: C:/programs/odin-windows-amd64-dev-2023-03/windows_artifacts/core/strings/builder.odin:70:1:, missing value '_builder_stream_vtable'
Another similar panic:
package t
import "core:fmt"
import "core:intrinsics"
fooA :: proc(s: ^int, $T: typeid)
where !intrinsics.type_has_field(T, "_base") {
fmt.printf("fooA: %v", s)
}
fooB :: proc(s: ^int, $T: typeid)
where intrinsics.type_has_field(T, "_base") { }
foo :: proc{fooA, fooB}
main :: proc() { foo({}, int) }
This one also has a >50% chance of triggering a compiler panic when compiled with the -debug
flag:
J:\repos\test>odin run t.odin -file -debug
D:\a\Odin\Odin\src\llvm_backend_type.cpp(12): Panic: NOT FOUND lb_type_info_index ^int @ index 184
But the point of panic is not the same as the previous one.
Shouldn't have even made it to the backend, because the first param isn't an ^int
.
Shouldn't have even made it to the backend, because the first param isn't an
^int
.
that might be unrelated? Tried to change the first parameter to nil
, the issue persisted.