Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struct containing a maybe of the same type leads to hung compilation #4504

Open
Bambo-Borris opened this issue Nov 20, 2024 · 6 comments
Open
Labels
bug checker hang replicated We were able to replicate the bug. triaged Bug has been looked at.

Comments

@Bambo-Borris
Copy link

Context

Whilst implementing something in a project I noticed that the below snippet of code would not generate a compilation error, but would instead leave the build in a hung state. The code itself (from my perspective) is nonsensical and I only discovered the issue when the build hung after mistakenly providing the same type to a struct field of type Maybe where the Maybe wraps the same type as the struct it's within.

package test

Test :: struct {
	t: Maybe(Test),
}

main :: proc() {}
Odin:    dev-2024-11:e6475fec4
OS:      Windows 11 Home Basic (version: 23H2), build 22631.4460
CPU:     12th Gen Intel(R) Core(TM) i7-12700KF
RAM:     32487 MiB
Backend: LLVM 18.1.8

Expected Behavior

Compilation failure similar to if you attempt to:

Error: Illegal declaration cycle of `Test`

Current Behavior

Compilation hangs and will not halt unless the user forces it to.

@Kelimion
Copy link
Member

Might be related to #4498.

@Kelimion Kelimion added bug replicated We were able to replicate the bug. checker hang triaged Bug has been looked at. labels Nov 20, 2024
@gingerBill gingerBill pinned this issue Nov 26, 2024
@gingerBill
Copy link
Member

gingerBill commented Nov 26, 2024

Possibly fixed in 9115c7a

@Bambo-Borris
Copy link
Author

I'll give this a test locally and confirm.

@Bambo-Borris
Copy link
Author

Seems like the issue is resolved, I now get a compiler error and the failing to halt issue is gone.

@gingerBill
Copy link
Member

So it's not fixed because it's now a race condition. Which is "better"?

@Kelimion
Copy link
Member

So it's not fixed because it's now a race condition. Which is "better"?

The hanging compile may ironically be better because it's consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug checker hang replicated We were able to replicate the bug. triaged Bug has been looked at.
Projects
None yet
Development

No branches or pull requests

3 participants