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

Stack Overflow with Specific Optimization Levels When Running Test Cases in toml Crate #122692

Closed
cicilzx opened this issue Mar 18, 2024 · 2 comments

Comments

@cicilzx
Copy link

cicilzx commented Mar 18, 2024

Hi, I'm not sure if it is a optimization bug of rustc.

I've noticed that when running test cases for toml crate (https://github.com/toml-rs/toml), I get a stack overflow when using certain specific optimization level (-C opt-level=0), but for other opt-level, the test cases will pass.

I am using cargo version: cargo 1.77.0-nightly (7bb7b5395 2024-01-20), the detailed discussion can be found in: toml-rs/toml#702

The developer have fixed the overflow by changing the limit value to a smaller value, but I still want to confirm why it doesn't overflow with rustc optimization turned on, but does overflow without it?

This is the fixing patch (changing the LIMIT to a smaller value):
image

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 18, 2024
@workingjubilee
Copy link
Member

The developer have fixed the overflow by changing the limit value to a smaller value, but I still want to confirm why it doesn't overflow with rustc optimization turned on, but does overflow without it?

The tests in question involve a recursive case, and reducing the amount of stack memory used is a legal optimization of Rust code, as the exact amount of stack memory used is not considered part of Rust's program semantics.

What would the bug be, here?

@workingjubilee
Copy link
Member

I am going to close this, please feel free to reopen this if you remember what the bug per se was.

@workingjubilee workingjubilee closed this as not planned Won't fix, can't repro, duplicate, stale Mar 18, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 18, 2024
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

4 participants