-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Infinite loop enabling optimization and debugging #13238
Comments
So I'm really confused here. What's the issue? You have unconditional recursion, so an infinite loop existing isn't a problem. And I assume that compilation finished, so it's not compilation that's going in an infinite loop. I'm not sure where the bug is here, and if there is one, it seems like it'd be in LLVM, not Rust... |
@Aatch the code is taken from the test (run-pass/out-of-stack.rs) and if you happen to have RUSTFLAGS='-g' when running tests, they'll never finish because of this. I think that this issue might have something to do with the way debug info is generated. Or it might not - in this case the test will probably have to be modified to ensure that it doesn't compile to tail call even with '-g -O' |
I agree with @Aatch, I don't think this is a bug. I think that test just needs to get rewritten in a way that LLVM won't optimize to an infinite loop. |
Discussed this with @erickt on IRC. Based on my understanding on LLVM's optimizations, it's likely that debugging is preventing the inlining of Marking Unless somebody has any objections, I'm going to close this issue. |
This fixes rust-lang#13238. It avoids an infinite loop when compiling the tests with `-g`. Without this change, the debuginfo on `black_box` prevents the method from being inlined, which allows llvm to convert `silent_recurse` into a tail-call. This then loops forever instead of consuming all the stack like it is supposed to. This patch forces inlining `black_box`, which triggers the right error.
This fixes rust-lang#13238. It avoids an infinite loop when compiling the tests with `-g`. Without this change, the debuginfo on `black_box` prevents the method from being inlined, which allows llvm to convert `silent_recurse` into a tail-call. This then loops forever instead of consuming all the stack like it is supposed to. This patch forces inlining `black_box`, which triggers the right error.
Compiling this code with both
-O
and-g
gets into an infinite loop:The problem is that enabling debugging seems to optimize
silent_recurse
into a tail call. Here's the optimized-but-not-debugged function:Here's the optimized-and-debugged function:
The text was updated successfully, but these errors were encountered: