runtime: Turn on CheckForOverflowUnderflow on all projects in Debug
Right now, only System.Reflection.Metadata has CheckForOverflowUnderflow on in Debug.
I think there’s value in doing this across the board. Expressions that are allowed to overflow by design should be explicitly marked unchecked.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 37 (23 by maintainers)
Commits related to this issue
- Marking code as unchecked (pt 1) (#15805) Marking code that may intentionally lead to over or underflows with unchecked in preparation of turning on CheckForOverflowUnderflow for all projects (issu... — committed to dotnet/corefx by dennisdietrich 7 years ago
- Marking code as unchecked (pt 2) (#15885) Marking code that may intentionally lead to over or underflows with unchecked in preparation of turning on CheckForOverflowUnderflow for all projects (issu... — committed to dotnet/corefx by dennisdietrich 7 years ago
- Marking code as unchecked (pt 3) (#15938) Marking code that may intentionally lead to over or underflows with unchecked in preparation of turning on CheckForOverflowUnderflow for all projects (issu... — committed to dotnet/corefx by dennisdietrich 7 years ago
- Marking code as unchecked (pt 4) (#15976) Marking code that may intentionally lead to over or underflows with unchecked in preparation of turning on CheckForOverflowUnderflow for all projects (issu... — committed to dotnet/corefx by dennisdietrich 7 years ago
- Marking code as unchecked (pt 6) (#16048) Marking code that may intentionally lead to over or underflows with unchecked in preparation of turning on CheckForOverflowUnderflow for all projects (issu... — committed to dotnet/corefx by dennisdietrich 7 years ago
- Marking code as unchecked (pt 7) (#16079) * Marking code as unchecked (pt 7) Marking code that may intentionally lead to over or underflows with unchecked in preparation of turning on CheckForOve... — committed to dotnet/corefx by dennisdietrich 7 years ago
- Marking code as unchecked (pt 8) (#16117) Marking code that may intentionally lead to over or underflows with unchecked in preparation of turning on CheckForOverflowUnderflow for all projects (issu... — committed to dotnet/corefx by dennisdietrich 7 years ago
thanks @dennisdietrich this is awesome!
Quick update: Including some code changes I haven’t committed yet I’m down to about 50 failing inner loop test projects on Windows so it’ll probably be a few more days until I’m done with that, after which I’ll take a look at running inner loop on Linux (and after that, obviously, I’ll check outer loop).
I am pretty sure that turning this on for release builds is non-starter.
If you do it across all projects, it’s very likely that there’d be a very large number of regressions, so you’d have to change all of those regressions, so it would likely be a massive one-shot PR. If you do it project by project it’s more likely to lead to small easier-to-review PRs, and then the setting could be moved up to being global after that.
I’m 100% sure there will be errors / regressions if/when we enable this everywhere. 😉 That’s not to say we shouldn’t do it, but I don’t think it’s as simple as changing a build configuration entry.