-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
arc bug using iterator parentDirs returning inside a try #22001
Comments
It's quite infuriating to bisect this problem because I have to switch to 1.6.12 compiler and do some git stash tricks constantly. Nevertheless, here is probably the regression that causes this issue => #20471 |
Thank you for having the patience to track that down (to an admittedly large set of changes). |
Nonsense, the new move analyser is perfect. The problem is Kauffman's string tunneling device. |
Reduced to: proc finOp2(path, name: string): (string,File) = # Find & open FIRST `name`
var current = path
while true:
if current.isRootDir: break # <- current=="" => current.isRootDir
current = current.parentDir
let dir = current
echo dir # Commenting out try/except below hides bug
try: result[0] = dir/name; result[1] = open(result[0]); return
except CatchableError: discard
let (path, f) = finOp2("/1/2/3", "4") # All same if this->inside a proc |
The control flow graph move analyser misinterprets the |
I am glad you looked into it! FWIW, I cannot get current nim-devel to break with that same code. So, we may need a more robustly breaking test case. I suppose one could bisect again the current head with one of those two revisions I mentioned to see what perturbed things, but unless it was intentionally fixed there is probably still a bug lurking. |
It's all trivial to reproduce for me and a fix is in the CI now. No worries. |
* fixes nim-lang#22001 * added test case
Description
Nim Version
I tried both Nim-devel f552618 as well as Nim-devel 767fec1 .
Current Output
Expected Output
Possible Solution
I just worked around this by not doing some of the things where the comments say it hides the bug.
Additional Information
The problem does not seem to manifest on Nim-1.6.12 or with either
--mm:markAndSweep
or--mm:refc
.So, someone with more patience than I have at the moment could run
nim c --expandArc:finOp --mm:arc this.nim
or maybe do agit bisect
first.EDIT: I first tested this code about 3..4 weeks prior to this issue filing and I did not notice this problem then.
The text was updated successfully, but these errors were encountered: