-
-
Notifications
You must be signed in to change notification settings - Fork 849
Description
Context
> odin report
Odin: dev-2025-11:68272c0c6
OS: Alpine Linux v3.22, Linux 6.12.55-0-lts
CPU: AMD Ryzen 5 7640U w/ Radeon 760M Graphics
RAM: 31400 MiB
Backend: LLVM 17.0.6
My project segfaults on compilation with odin build. This started happening when I started to integrate miniaudio.
This happens with the release, release-native, and debug compiler builds.
The (isolated) parts of my project that seems to trigger this behaviour, with comments:
// file: skelos.odin
Skelos :: struct {
...
audio: Audio,
...
}
new_skelos :: proc(skelos: ^Skelos, ...) -> (ok: bool) {
...
skelos.audio, ok = init_audio() // adding this line causes compiler to segfault
...
}// file: audio.odin
import ma "vendor:miniaudio"
Audio :: struct {
engine: ma.engine,
...
}
init_audio :: proc() -> (a: Audio, ok: bool) {
return {}, true
}In the process of cutting code to isolate the issue... The compiler stopped segfaulting. Timeline:
- Write
audio.odin, runodin build, get segfault - Cut down
audio.odinto just the above, get segfault - Delete
init_audio()call, no segfault - Undo steps 2 and 3, no segfault...
Not sure if there's some kind of cached state for the compiler that runs into these issues? I haven't tried reproducing using a different LLVM version either.
Expected Behavior
Compiler never segfaults
Current Behavior
Compiler sometimes segfaults
Failure Logs
Please include any relevant log snippets or files here.
Here's the backtrace when I was getting the segfault running odin build in gdb:
Thread 13 "odin" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 11821]
0x00005555556497ab in lookup_field_with_selection (type_=0x0, field_name=..., is_type=false, sel=..., allow_blank_ident=false) at src/types.cpp:3517
3517 gb_internal Selection lookup_field_with_selection(Type *type_, String field_name, bool is_type, Selection sel, bool allow_blank_ident) {
(gdb) bt
#0 0x00005555556497ab in lookup_field_with_selection (type_=0x0, field_name=..., is_type=false, sel=..., allow_blank_ident=false) at src/types.cpp:3517
#1 0x000055555564a9e0 in lookup_field_with_selection (type_=0x7fffd094ef00, field_name=..., is_type=false, sel=..., allow_blank_ident=false) at src/types.cpp:3661
#2 0x000055555564a9e0 in lookup_field_with_selection (type_=0x7fffd1488000, field_name=..., is_type=false, sel=..., allow_blank_ident=false) at src/types.cpp:3661
#3 0x0000555555649771 in lookup_field (type_=0x7fffd1488000, field_name=..., is_type=false, allow_blank_ident=false) at src/types.cpp:3462
#4 0x0000555555612bf9 in check_selector (c=0x7fffed544b40, operand=0x7fffed539208, node=0x7fffe88f7d70, type_hint=0x0) at src/check_expr.cpp:5609
#5 0x0000555555600c14 in check_expr_base_internal (c=0x7fffed544b40, o=0x7fffed539208, node=0x7fffe88f7d70, type_hint=0x0) at src/check_expr.cpp:11807
#6 0x00005555555feacd in check_expr_base (c=0x7fffed544b40, o=0x7fffed539208, node=0x7fffe88f7d70, type_hint=0x0) at src/check_expr.cpp:11956
#7 0x0000555555612a5c in check_selector (c=0x7fffed544b40, operand=0x7fffed539208, node=0x7fffe88f7e70, type_hint=0x0) at src/check_expr.cpp:5588
#8 0x0000555555600c14 in check_expr_base_internal (c=0x7fffed544b40, o=0x7fffed539208, node=0x7fffe88f7e70, type_hint=0x0) at src/check_expr.cpp:11807
#9 0x00005555555feacd in check_expr_base (c=0x7fffed544b40, o=0x7fffed539208, node=0x7fffe88f7e70, type_hint=0x0) at src/check_expr.cpp:11956
#10 0x00005555555fe9a9 in check_multi_expr (c=0x7fffed544b40, o=0x7fffed539208, e=0x7fffe88f7e70) at src/check_expr.cpp:11990
#11 0x00005555556854ad in check_builtin_procedure (c=0x7fffed544b40, operand=0x7fffed539208, call=0x7fffe88f7ef0, id=22, type_hint=0x7fffd149a190) at src/check_builtin.cpp:2520
#12 0x0000555555618832 in check_call_expr (c=0x7fffed544b40, operand=0x7fffed539208, call=0x7fffe88f7ef0, proc=0x7fffe88f7bb0, args=..., inlining=ProcInlining_none, type_hint=0x7fffd149a190) at src/check_expr.cpp:8294
#13 0x00005555556010db in check_expr_base_internal (c=0x7fffed544b40, o=0x7fffed539208, node=0x7fffe88f7ef0, type_hint=0x7fffd149a190) at src/check_expr.cpp:11834
#14 0x00005555555feacd in check_expr_base (c=0x7fffed544b40, o=0x7fffed539208, node=0x7fffe88f7ef0, type_hint=0x7fffd149a190) at src/check_expr.cpp:11956
#15 0x00005555555fbf6d in check_expr_with_type_hint (c=0x7fffed544b40, o=0x7fffed539208, e=0x7fffe88f7ef0, t=0x7fffd149a190) at src/check_expr.cpp:8501
#16 0x0000555555610993 in check_binary_expr (c=0x7fffed544b40, x=0x7fffed539208, node=0x7fffe88f8360, type_hint=0x7fffd149a190, use_lhs_as_type_hint=true) at src/check_expr.cpp:4183
#17 0x0000555555600b2c in check_expr_base_internal (c=0x7fffed544b40, o=0x7fffed539208, node=0x7fffe88f8360, type_hint=0x7fffd149a190) at src/check_expr.cpp:11799
#18 0x00005555555feacd in check_expr_base (c=0x7fffed544b40, o=0x7fffed539208, node=0x7fffe88f8360, type_hint=0x7fffd149a190) at src/check_expr.cpp:11956
#19 0x000055555560023b in check_expr_base_internal (c=0x7fffed544b40, o=0x7fffed539208, node=0x7fffe88f83e0, type_hint=0x7fffd149a190) at src/check_expr.cpp:11715
#20 0x00005555555feacd in check_expr_base (c=0x7fffed544b40, o=0x7fffed539208, node=0x7fffe88f83e0, type_hint=0x7fffd149a190) at src/check_expr.cpp:11956
#21 0x00005555555fbf6d in check_expr_with_type_hint (c=0x7fffed544b40, o=0x7fffed539208, e=0x7fffe88f83e0, t=0x7fffd149a190) at src/check_expr.cpp:8501
#22 0x00005555556109ec in check_binary_expr (c=0x7fffed544b40, x=0x7fffed541c90, node=0x7fffe88f8480, type_hint=0x0, use_lhs_as_type_hint=true) at src/check_expr.cpp:4185
#23 0x0000555555600b2c in check_expr_base_internal (c=0x7fffed544b40, o=0x7fffed541c90, node=0x7fffe88f8480, type_hint=0x0) at src/check_expr.cpp:11799
#24 0x00005555555feacd in check_expr_base (c=0x7fffed544b40, o=0x7fffed541c90, node=0x7fffe88f8480, type_hint=0x0) at src/check_expr.cpp:11956
#25 0x00005555555fe9a9 in check_multi_expr (c=0x7fffed544b40, o=0x7fffed541c90, e=0x7fffe88f8480) at src/check_expr.cpp:11990
#26 0x00005555555fe965 in check_expr (c=0x7fffed544b40, o=0x7fffed541c90, e=0x7fffe88f8480) at src/check_expr.cpp:12033
#27 0x000055555568e608 in check_builtin_procedure (c=0x7fffed544b40, operand=0x7fffed544af8, call=0x7fffe88f8500, id=20, type_hint=0x0) at src/check_builtin.cpp:3900
#28 0x0000555555618832 in check_call_expr (c=0x7fffed544b40, operand=0x7fffed544af8, call=0x7fffe88f8500, proc=0x7fffe88f7120, args=..., inlining=ProcInlining_none, type_hint=0x0) at src/check_expr.cpp:8294
#29 0x00005555556010db in check_expr_base_internal (c=0x7fffed544b40, o=0x7fffed544af8, node=0x7fffe88f8500, type_hint=0x0) at src/check_expr.cpp:11834
#30 0x00005555555feacd in check_expr_base (c=0x7fffed544b40, o=0x7fffed544af8, node=0x7fffe88f8500, type_hint=0x0) at src/check_expr.cpp:11956
#31 0x0000555555660bc1 in check_unpack_arguments (ctx=0x7fffed547388, lhs=0x7fffd1497e50, lhs_count=1, operands=0x7fffed544d20, rhs_arguments=..., flags=3, variadic_index=1) at src/check_expr.cpp:6129
#32 0x000055555566bb04 in check_init_variables (ctx=0x7fffed547388, lhs=0x7fffd1497e50, lhs_count=1, inits=..., context_name=...) at src/check_decl.cpp:136
#33 0x000055555565ca60 in check_value_decl_stmt (ctx=0x7fffed547388, node=0x7fffe88f8740, mod_flags=35) at src/check_stmt.cpp:2226
#34 0x0000555555650852 in check_stmt_internal (ctx=0x7fffed547388, node=0x7fffe88f8740, flags=35) at src/check_stmt.cpp:2997
#35 0x000055555563f1e9 in check_stmt (ctx=0x7fffed547388, node=0x7fffe88f8740, flags=35) at src/check_stmt.cpp:670
#36 0x000055555563d12d in check_stmt_list (ctx=0x7fffed547388, stmts=..., flags=35) at src/check_stmt.cpp:108
#37 0x0000555555658be1 in check_switch_stmt (ctx=0x7fffed547388, node=0x7fffe8927a40, mod_flags=39) at src/check_stmt.cpp:1299
#38 0x000055555564f80b in check_stmt_internal (ctx=0x7fffed547388, node=0x7fffe8927a40, flags=35) at src/check_stmt.cpp:2795
#39 0x000055555563f1e9 in check_stmt (ctx=0x7fffed547388, node=0x7fffe8927a40, flags=35) at src/check_stmt.cpp:670
#40 0x000055555563d12d in check_stmt_list (ctx=0x7fffed547388, stmts=..., flags=35) at src/check_stmt.cpp:108
#41 0x000055555564f27a in check_stmt_internal (ctx=0x7fffed547388, node=0x7fffe8927b50, flags=35) at src/check_stmt.cpp:2765
#42 0x000055555563f1e9 in check_stmt (ctx=0x7fffed547388, node=0x7fffe8927b50, flags=35) at src/check_stmt.cpp:670
#43 0x0000555555653eb0 in check_for_stmt (ctx=0x7fffed547388, node=0x7fffe8927c00, mod_flags=35) at src/check_stmt.cpp:2740
#44 0x000055555564f5b3 in check_stmt_internal (ctx=0x7fffed547388, node=0x7fffe8927c00, flags=32) at src/check_stmt.cpp:2783
#45 0x000055555563f1e9 in check_stmt (ctx=0x7fffed547388, node=0x7fffe8927c00, flags=32) at src/check_stmt.cpp:670
#46 0x000055555563d12d in check_stmt_list (ctx=0x7fffed547388, stmts=..., flags=32) at src/check_stmt.cpp:108
#47 0x000055555563b133 in check_proc_body (ctx_=0x7fffed5475b0, token=..., decl=0x7fffdb26ed80, type=0x7fffcf488ad0, body=0x7fffe8936f10) at src/check_decl.cpp:2181
#48 0x0000555555639f2d in check_proc_info (c=0x7fffecd5b5f0, pi=0x7fffd1463330, untyped=0x7fffdef25280) at src/checker.cpp:6275
#49 0x000055555563976a in check_proc_info_worker_proc (data=0x7fffd1463330) at src/checker.cpp:6456
#50 0x00005555556f3097 in thread_pool_thread_proc (thread=0x7fffee22c7f0) at src/thread_pool.cpp:198
#51 0x00005555556f2f3b in internal_thread_proc (arg=0x7fffee22c7f0) at src/threading.cpp:611
#52 0x00007ffff7fbf9d2 in start (p=0x7fffed547a40) at src/thread/pthread_create.c:207
#53 0x00007ffff7fc1314 in __clone () at src/thread/x86_64/clone.s:22
Backtrace stopped: frame did not save the PC
When inspecting the stack, the text being parsed was from an unrelated part of the project's codebase.