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

Compiler stack overflow with nested lambda functions #4890

Open
pventuzelo opened this issue Apr 23, 2024 · 0 comments
Open

Compiler stack overflow with nested lambda functions #4890

pventuzelo opened this issue Apr 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pventuzelo
Copy link

Aim

We (https://github.com/FuzzingLabs) found that the compiler ends up overflowing its stack when you nest too many lambda functions.

Expected Behavior

No panic should occur.

Bug

In the given example, after 18 nested lambda functions, the compiler ends up overflowing its stack. 18 was the minimum needed to trigger the overflow with 64GB of RAM. Only lambda functions seem to have this issue. Things like for loops or function calls can be nested as much as desired.

The issue occurs with the latest compiler version on the master branch. The error message is as follows:

thread '<unknown>' has overflowed its stack
fatal runtime error: stack overflow
Abandon (core dumped)

To Reproduce

fn main() {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
let lambda = || {
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}

Project Impact

None

Impact Context

No response

Workaround

None

Workaround Description

No response

Additional Context

The computer used has 64GB of RAM. This may impact how many lambda functions are needed to trigger the overflow of the stack.

Installation Method

None

Nargo Version

No response

NoirJS Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@pventuzelo pventuzelo added the bug Something isn't working label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant