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

Tracking issue for -C overflow-checks #33134

Closed
alexcrichton opened this issue Apr 21, 2016 · 4 comments
Closed

Tracking issue for -C overflow-checks #33134

alexcrichton opened this issue Apr 21, 2016 · 4 comments
Labels
B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. E-help-wanted Call for participation: Help is requested to fix this issue.

Comments

@alexcrichton
Copy link
Member

Tracking issue for rust-lang/rfcs#1535

@alexcrichton alexcrichton added B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. T-tools labels Apr 21, 2016
@alexcrichton
Copy link
Member Author

FWIW this should be a relatively easy bug to knock out!

The force_overflow_checks option is defined with other debugging options and we'd just want to add a new flag to the associated codegen options (we'll delete the -Z flag once everyone's migrated).

There's a few uses throughout the codebase which I believe will need an update:

After that we'd just need to add a test which validates this behavior, likely a src/test/run-pass/*.rs addition with a // compile-flags: ... annotation at the top.

Likewise the Cargo support should be relatively easy:

@alexcrichton alexcrichton added the E-help-wanted Call for participation: Help is requested to fix this issue. label Feb 16, 2017
@froydnj
Copy link
Contributor

froydnj commented Feb 16, 2017

I'd like to tackle this!

@froydnj
Copy link
Contributor

froydnj commented Feb 17, 2017

OK, so this is pretty straightforward. Couple questions after actually implementing this:

  • The RFC says the option is -C overflow-checks, but comments on the RFC suggest that people expect this to be -C overflow-checks(=on/off), so one could have (I guess) -C debug-assertions -C overflow-checks=off. Which variant should be supported?
  • It seems better to make the value in CodegenOptions the single source of truth to be used throughout the compiler by setting it based on the value of -C debug-assertions or -Z force-overflow-checks; this makes the uses easier to read and also makes any future removal of -Z force-overflow-checks straightforward. How should -C overflow-checks interact with -Z force-overflow-checks? Should we just consider any explicit setting of -C overflow-checks to "win" and only consult -Z force-overflow-checks if the -C option was not explicitly provided? I guess that would mean that we'd almost have to implement the -C overflow-checks(=on/off) variant above?

@alexcrichton
Copy link
Member Author

@froydnj I think it's fine to just reuse the existing parse_opt_bool which accepts a "standard variety" of boolean options.

It seems better to make the value in CodegenOptions the single source of truth

Makes sense to me to have a single source of truth! Right now I don't think we have a lot of precedent for modifying CodegenOptions after creation so this may not be easy. Perhaps a helper method on Session though? That's what a few other codegen-like options do.

How should -C overflow-checks interact with -Z force-overflow-checks?

Yeah let's just have -C trump -Z. The precise semantics likely don't matter too much anyway as we'll quickly phase out the -Z version anyway.

eddyb pushed a commit to eddyb/rust that referenced this issue Feb 25, 2017
In addition to defining and handling the new option, we also add a
method on librustc::Session for determining the necessity of overflow
checks.  This method provides a single point to sort out the three (!)
different ways for turning on overflow checks: -C debug-assertions, -C
overflow-checks, and -Z force-overflow-checks.

Fixes rust-lang#33134.
eddyb added a commit to eddyb/rust that referenced this issue Feb 25, 2017
…hton

add `-C overflow-checks` option

In addition to defining and handling the new option, we also add a method on librustc::Session for determining the necessity of overflow checks.  This method provides a single point to sort out the three (!) different ways for turning on overflow checks: -C debug-assertions, -C overflow-checks, and -Z force-overflow-checks.

I was seeing a [run-pass/issue-28950.rs](https://github.com/rust-lang/rust/blob/b1363a73ede57ae595f3a1be2bb75d308ba4f7f6/src/test/run-pass/issue-28950.rs) failure on my machine with these patches, but I was also seeing the failure without the changes to the core compiler.  We'll see what travis says.

Fixes rust-lang#33134.  r? @alexcrichton
eddyb added a commit to eddyb/rust that referenced this issue Feb 25, 2017
…hton

add `-C overflow-checks` option

In addition to defining and handling the new option, we also add a method on librustc::Session for determining the necessity of overflow checks.  This method provides a single point to sort out the three (!) different ways for turning on overflow checks: -C debug-assertions, -C overflow-checks, and -Z force-overflow-checks.

I was seeing a [run-pass/issue-28950.rs](https://github.com/rust-lang/rust/blob/b1363a73ede57ae595f3a1be2bb75d308ba4f7f6/src/test/run-pass/issue-28950.rs) failure on my machine with these patches, but I was also seeing the failure without the changes to the core compiler.  We'll see what travis says.

Fixes rust-lang#33134.  r? @alexcrichton
camelid added a commit to camelid/rust that referenced this issue Nov 24, 2021
It was replaced several years ago by the stable option `-C
overflow-checks`. The goal was to delete the `-Z` flag once users had
migrated [1]. Now that it's been several years, it makes sense to delete
the old flag.

See also the discussion on Zulip [2].

[1]: rust-lang#33134 (comment)
[2]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/overflow.20checks/near/262497224
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 25, 2021
…=wesleywiser

Remove `-Z force-overflow-checks`

It was replaced several years ago by the stable option `-C overflow-checks`.
The goal was to delete the `-Z` flag once users had migrated [1].
Now that it's been several years, it makes sense to delete the old flag.

See also the discussion on Zulip [2].

[1]: rust-lang#33134 (comment)
[2]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/overflow.20checks/near/262497224

r? `@wesleywiser`
cc `@RalfJung`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 25, 2021
…=wesleywiser

Remove `-Z force-overflow-checks`

It was replaced several years ago by the stable option `-C overflow-checks`.
The goal was to delete the `-Z` flag once users had migrated [1].
Now that it's been several years, it makes sense to delete the old flag.

See also the discussion on Zulip [2].

[1]: rust-lang#33134 (comment)
[2]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/overflow.20checks/near/262497224

r? ``@wesleywiser``
cc ``@RalfJung``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 25, 2021
…=wesleywiser

Remove `-Z force-overflow-checks`

It was replaced several years ago by the stable option `-C overflow-checks`.
The goal was to delete the `-Z` flag once users had migrated [1].
Now that it's been several years, it makes sense to delete the old flag.

See also the discussion on Zulip [2].

[1]: rust-lang#33134 (comment)
[2]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/overflow.20checks/near/262497224

r? ```@wesleywiser```
cc ```@RalfJung```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. E-help-wanted Call for participation: Help is requested to fix this issue.
Projects
None yet
Development

No branches or pull requests

2 participants