-
Notifications
You must be signed in to change notification settings - Fork 248
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
Stack overflow in parser #6975
Comments
I just noticed that the first line in
as expected. |
@asterite I believe your new parser fixed this? |
I think this was reported against the new parser, but I was never able to reproduce it. |
I just tried it again on master with a Also looks like I get a stack overflow in both cases mentioned in this comment: #6975 (comment). |
Oh, you are right. I had |
Aim
I want the user to be able to repeat the same token many times (essentially unlimited times as it should be up to the user), without triggering a stack overflow.
Expected Behavior
The compiler should not stack overflow.
Bug
For our example we are just going to comment out
EXPONENTIATE
inregression_4709
. You could even comment out the entire file. This will result in a stack overflow:This overflow looks to be due to recursion being utilized for parsing a list of items
noir/compiler/noirc_frontend/src/parser/parser/parse_many.rs
Line 9 in 74ec723
For comments
parse_many
is used here.This is an edge case and seems unlikely to be hit but I did not test under what circumstances we hit the stack limit. It would be good to know under what circumstances we may hit the stack limit as
parse_many
is utilized in many locations. I could see this stack overflow being hit by a use tree in larger programs with many imports.To Reproduce
src/main.nr
inregression_4709
Workaround
Yes
Workaround Description
The workaround is to not have so many repeated tokens.
Additional Context
No response
Project Impact
Nice-to-have
Blocker Context
I would be surprised this would block any user and that they could not work around by manually splitting up their large token list.
Nargo Version
nargo version = 1.0.0-beta.1 noirc version = 1.0.0-beta.1+2e5d91f3d69ce629d07eb6041736b5a8e8ed2013 (git version hash: 2e5d91f, is dirty: false)
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: