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

Recursion hell #1422

Closed
DutchGhost opened this issue Aug 26, 2018 · 3 comments
Closed

Recursion hell #1422

DutchGhost opened this issue Aug 26, 2018 · 3 comments
Milestone

Comments

@DutchGhost
Copy link

DutchGhost commented Aug 26, 2018

Not sure if this is really a bug or not...

fn recur() [@maxValue(usize)]u8 {
    return recur();
}

pub fn main() void {
    @import("std").debug.warn("starting ...\n");
    
    var loophole = recur();

    @import("std").debug.warn("{}\n", loophole);
}

Compiles fine, but once runned, nothing gets printed to the screen. I expected it to at least print 'starting ...' to the screen, and then stackoverflow. This happens on build-exe and build-exe --release-fast.

On my machine I dont see any segfault or stack overflow message, but maybe that's just my machine.

https://bugs.llvm.org/show_bug.cgi?id=965 might be the root of this?

@andrewrk
Copy link
Member

I see a segfault:

$ ./test
Segmentation fault

@DutchGhost
Copy link
Author

Can be closed then. I suppose Windows doesn't care about segfaults?

@andrewrk
Copy link
Member

andrewrk commented Aug 26, 2018

OK, at least we got issue #1424 out of it. I believe the problem has to do with creating an array that large and overflowing the stack, rather than the recursion.

@andrewrk andrewrk modified the milestones: 0.4.0, 0.3.0 Sep 28, 2018
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