odin-lang / Odin

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

Non-deterministic build failures with -debug flag #3028

Closed iansimonson closed 10 months ago

iansimonson commented 10 months ago

Context

I have been running into non-deterministic build failures on MacOS when compiling with the -debug flag. This seems to have started when I set the context.allocator in a test case but that is probably unrelated.

It also occasionally hangs

Odin report:

        Odin: dev-2023-12:67d02043f
        OS:   macOS Monterey 12.5 (build: 21G83, kernel: 21.6.0)
        CPU:  Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
        RAM:  8192 MiB

Expected Behavior

The compiler should build successfully with debug information

Current Behavior

There are non-deterministic failures that are occurring, and different ones each time. The ones I've seen are:

MDNode context does not match Module context!
!4393 = !DIDerivedType(tag: DW_TAG_typedeffish: Job 1, 'odin build . -debug' terminated by signal SIGSEGV (Address boundary error)
fish: Job 1, 'odin build . -debug' terminated by signal SIGSEGV (Address boundary error)
invalid base type
!4355 = !DIDerivedType(tag: DW_TAG_member, name: "less", file: !4348, baseType: !"fish: Job 1, 'odin build . -debug' terminated by signal SIGSEGV (Address boundary error)

also in some instances the compiler just hangs (deadlocked?)

Failure Information (for bugs)

I have not seen this on other files, so for the record this is the file producing the issue: (txt because github doesn't allow uploading .odin files) day17.txt

Steps to Reproduce

odin build . -debug or odin test . -debug both cause the issue to occur

Failure Logs

failure_1_backtrace.txt failure_2_backtrace.txt hang_backtrace.txt

Odin part of backtrace 1

  * frame #30: 0x0000000100295694 odin`lb_llvm_module_pass_worker_proc(data=0x0000000118bba540) at llvm_backend.cpp:1941:26
    frame #31: 0x00000001001d50e6 odin`lb_llvm_module_passes(gen=0x0000000117deb440, do_threading=false) at llvm_backend.cpp:2050:4
    frame #32: 0x000000010003a1a5 odin`lb_generate_code(gen=0x0000000117deb440) at llvm_backend.cpp:2939:2
    frame #33: 0x000000010001e4be odin`main(arg_count=4, arg_ptr=0x00007ff7bfeff4e8) at main.cpp:2690:7
    frame #34: 0x000000010045552e dyld`start + 462

Odin part of backtrace 2

    frame #9: 0x0000000100292d2d odin`lb_debug_complete_types(m=0x000000011828a950) at llvm_backend_debug.cpp:784:36
    frame #10: 0x00000001001d4d21 odin`lb_debug_info_complete_types_and_finalize(gen=0x000000011828a850) at llvm_backend.cpp:2016:4
    frame #11: 0x0000000100039fb8 odin`lb_generate_code(gen=0x000000011828a850) at llvm_backend.cpp:2919:3
    frame #12: 0x000000010001e4be odin`main(arg_count=4, arg_ptr=0x00007ff7bfeff4e8) at main.cpp:2690:7
    frame #13: 0x000000010045552e dyld`start + 462

Odin part of hang backtrace:

    frame #11: 0x00000001001d6053 odin`lb_llvm_object_generation(gen=0x00000001182c7860, do_threading=false) at llvm_backend.cpp:2229:8
    frame #12: 0x000000010003a5d2 odin`lb_generate_code(gen=0x00000001182c7860) at llvm_backend.cpp:2981:7
    frame #13: 0x000000010001e4be odin`main(arg_count=4, arg_ptr=0x00007ff7bfeff4e8) at main.cpp:2690:7
    frame #14: 0x000000010045552e dyld`start + 462
laytan commented 10 months ago

Duplicate of https://github.com/odin-lang/Odin/issues/2945 I assume

iansimonson commented 10 months ago

Looks like it, I'll copy these backtraces over to that issue and close this one