Skip to content

Infinite recursion in TailRec #1603

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

Closed
OlivierBlanvillain opened this issue Oct 17, 2016 · 4 comments
Closed

Infinite recursion in TailRec #1603

OlivierBlanvillain opened this issue Oct 17, 2016 · 4 comments

Comments

@OlivierBlanvillain
Copy link
Contributor

The TailRec phase goes into an infinit loop when processing a tree: Apply such that tree.symbol != tree.fun. This is the loop I observed with jstack:

Unfortunately I don't see how I could derive a minimized test case from the very large scalatest code base, if someone has an idea on how to pinpoint the issue in source please let me know!

@DarkDimius
Copy link
Contributor

DarkDimius commented Oct 17, 2016

I don't think that making tailrec have less guards would be a proper way to resolve this.
There are several locations in Dotty & Liker where extraction similar to https://github.com/lampepfl/dotty/blob/75f4400/src/dotty/tools/dotc/transform/TailRec.scala#L198-L206 is happening, where symbol equality test is the way to detect when curried function application is entirely deconstructed.

It would be better to find how this irregular Apply node was created in first place. Did you try running with Ycheck enabled?

@OlivierBlanvillain
Copy link
Contributor Author

Did you try running with Ycheck enabled?

No, so far I could only reproduce this by compiling the entirety of scalatest, and I don't really have an idea on how to reduce the search space...

@DarkDimius
Copy link
Contributor

@OlivierBlanvillain, you should still be able to run under "-Ycheck:firstTransform" and see if Ycheck complains, even before minimization.

@OlivierBlanvillain
Copy link
Contributor Author

I minimized this issue in #1687. Turns out it was not an infinite recursion but just a very large code explosion which looked infinite thought jstack :)

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

2 participants