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

Internal error: encountered unexpected error in runtime: StackOverflowError() in has_safe_def #43254

Closed
thofma opened this issue Nov 29, 2021 · 3 comments
Assignees

Comments

@thofma
Copy link
Contributor

thofma commented Nov 29, 2021

One of our packages started to produce the following error:

Internal error: encountered unexpected error in runtime:
StackOverflowError()
has_safe_def at ./compiler/ssair/passes.jl:98
has_safe_def at ./compiler/ssair/passes.jl:113
[...]
has_safe_def at ./compiler/ssair/passes.jl:101 [inlined]
sroa_mutables! at ./compiler/ssair/passes.jl:873
[...]

see https://github.com/oscar-system/Oscar.jl/runs/4352506233?check_suite_focus=true#step:5:426.

This is with master I built a few minutes ago:

julia> versioninfo()
Julia Version 1.8.0-DEV.1081
Commit 43bc48b1f8 (2021-11-29 13:12 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin20.6.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, cyclone)

I have not done a bisect yet, but there are some obvious commits to look at.

@thofma
Copy link
Contributor Author

thofma commented Nov 29, 2021

And the winner is 1a1f3d7, congratulations @aviatesk :)

@aviatesk
Copy link
Member

Agh, is it possible to reduce the reproducer a bit further?

@aviatesk aviatesk self-assigned this Nov 29, 2021
@vtjnash
Copy link
Member

vtjnash commented Nov 29, 2021

That code is just walking the predecessor list recursively?? The predecessor list is not a DAG, it is cyclic.

aviatesk added a commit that referenced this issue Nov 30, 2021
…ion analysis

Since CFG can be cyclic, the previous implementation of `has_safe_def`
that walks predecessors recursively was just wrong.

This commit fixes it by making it `has_safe_def` maintain a single set that
keeps the identities of basic blocks that have been examined already.

Since we still examine each predecessor recursively, this approach doesn't
handle cycles very nicely (this commit doesn't come with any sort of fancy
tags that indicates a basic block is "being examined", as opposed to inference).
But I don't see much motivation to make `has_safe_def` more accurate while
keeping it correct, since it's called only in rare cases.
aviatesk added a commit that referenced this issue Nov 30, 2021
…ion analysis

Since CFG can be cyclic, the previous implementation of `has_safe_def`
that simply walks predecessors recursively was just wrong.

This commit fixes it by making it `has_safe_def` maintain a single set that
keeps the identities of basic blocks that have been examined already.

This commit doesn't come with any sort of fancy tags that indicates a
basic block is "being examined" or such, as opposed to inference,
and thus this approach doesn't handle cycles very nicely.
But still I don't see much motivation to make `has_safe_def` more accurate
while keeping it correct, since it's called only in rare cases.
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Feb 22, 2022
…s domination analysis (JuliaLang#43265)

Since CFG can be cyclic, the previous implementation of `has_safe_def`
that simply walks predecessors recursively was just wrong.

This commit fixes it by making `has_safe_def` maintain a single set that
keeps the identities of basic blocks that have been examined already.
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Mar 8, 2022
…s domination analysis (JuliaLang#43265)

Since CFG can be cyclic, the previous implementation of `has_safe_def`
that simply walks predecessors recursively was just wrong.

This commit fixes it by making `has_safe_def` maintain a single set that
keeps the identities of basic blocks that have been examined already.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants