Odin
Odin copied to clipboard
Compiler gets stuck when doing array programming
Context
Here's the simple test2.odin program that trips the compiler:
package test2
main :: proc() {
road := new([1024][1024]f32)
road^ *= 0.999
}
Here's what happens when you try to compile it:
$ time odin run test2.odin -vet -show-timings
Total Time - 26119.141 ms - 100.00%
initialization - 0.250 ms - 0.00%
parse files - 9.141 ms - 0.03%
type check - 16.809 ms - 0.06%
LLVM API Code Gen - 26051.844 ms - 99.74%
ld-link - 41.093 ms - 0.15%
odin run test2.odin -vet -show-timings 44.86s user 0.63s system 99% cpu 45.765 total
$ time odin run test2.odin -vet -show-timings -opt:3
(didn't finish even after waiting 10 minutes)
$ time odin run test2.odin -vet -show-more-timings
Total Time - 27374.868 ms - 100.00%
initialization - 0.128 ms - 0.00%
parse files - 6.856 ms - 0.02%
type check - 0.000 ms - 0.00%
init checker info - 0.000 ms - 0.00%
checker info: general - 0.000 ms - 0.00%
checker info: mpmc queues - 1.304 ms - 0.00%
checker info: mutexes - 0.007 ms - 0.00%
init proc queues - 1.532 ms - 0.00%
map full filepaths to scope - 0.033 ms - 0.00%
create file scopes - 0.026 ms - 0.00%
collect entities - 0.536 ms - 0.00%
export entities - pre - 0.058 ms - 0.00%
check_import_entities - sort packages - 0.002 ms - 0.00%
check_import_entities - collect file decls - 0.049 ms - 0.00%
check_import_entities - check delayed entities - 0.055 ms - 0.00%
export entities - post - 0.001 ms - 0.00%
add entities from packages - 0.013 ms - 0.00%
check all global entities - 1.948 ms - 0.00%
init preload - 0.006 ms - 0.00%
add global untyped expression to queue - 0.031 ms - 0.00%
check procedure bodies - 7.581 ms - 0.02%
add entities from procedure bodies - 0.026 ms - 0.00%
check scope usage - 0.007 ms - 0.00%
add untyped expression values - 0.183 ms - 0.00%
add basic type information - 0.022 ms - 0.00%
check for type cycles and inline cycles - 0.097 ms - 0.00%
check deferred procedures - 0.000 ms - 0.00%
calculate global init order - 0.000 ms - 0.00%
calculate_global_init_order: generate entity dependency graph - 0.056 ms - 0.00%
generate_entity_dependency_graph: Calculate edges for graph M - Part 1 - 0.263 ms - 0.00%
generate_entity_dependency_graph: Calculate edges for graph M - Part 2 - 0.065 ms - 0.00%
generate_entity_dependency_graph: Dependency Count Checker - 0.000 ms - 0.00%
calculate_global_init_order: priority queue create - 0.000 ms - 0.00%
calculate_global_init_order: queue sort - 0.034 ms - 0.00%
check test procedures - 0 ms - 0%
check bodies have all been checked - 0.000 ms - 0.00%
add type info for type definitions - 0.016 ms - 0.00%
generate minimum dependency set - 0.073 ms - 0.00%
check entry point - 0.000 ms - 0.00%
check unique package names - 0.000 ms - 0.00%
sanity checks - 0 ms - 0%
sort init procedures - 0 ms - 0%
check intrinsics.__entry_point usage - 0.000 ms - 0.00%
type check finish - 0.000 ms - 0.00%
LLVM API Code Gen - 0.057 ms - 0.00%
LLVM Initializtion - 0.058 ms - 0.00%
LLVM Create Target Machine - 0.022 ms - 0.00%
LLVM Global Variables - 0.056 ms - 0.00%
LLVM Runtime Type Information Creation - 0.091 ms - 0.00%
LLVM Runtime Startup Creation (Global Variables) - 0.035 ms - 0.00%
LLVM Global Procedures and Types - 0.146 ms - 0.00%
LLVM Procedure Generation - 1.160 ms - 0.00%
LLVM Function Pass - 1.802 ms - 0.00%
LLVM Module Pass - 0.774 ms - 0.00%
LLVM Add Foreign Library Paths - 0.000 ms - 0.00%
LLVM Object Generation - 0.001 ms - 0.00%
LLVM Generate Object: test2.o - 27295.198 ms - 99.70%
ld-link - 54.328 ms - 0.19%
remove keep temp files - 0.106 ms - 0.00%
odin run test2.odin -vet -show-more-timings 46.53s user 1.01s system 99% cpu 47.903 total
Output from odin report
:
Odin: dev-2022-03:f907516
OS: macOS 12.0.3 Monterey
CPU: ARM64
RAM: 16384 MiB
The OS is macOS Monterey 12.2.1 (wrongly detected by odin)
Expected Behavior
The compiler should compile. It would also be nice if it compiled more than 1 line of code per 10 seconds :D
Current Behavior
The compiler does not compile when -opt:3
is supplied.
This probably needs to be disallowed.
Hello!
I am marking this issue as stale as it has not received any engagement from the community or maintainers 120 days. That does not imply that the issue has no merit! If you feel strongly about this issue
- open a PR referencing and resolving the issue;
- leave a comment on it and discuss ideas how you could contribute towards resolving it;
- leave a comment and describe in detail why this issue is critical for your use case;
- open a new issue with updated details and a plan on resolving the issue.
The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone..