Skip to content

Commit

Permalink
Remove CheckForOverflowUnderflow (#63825)
Browse files Browse the repository at this point in the history
* Remove set false to CheckForOverflowUnderflow due to it is disabled by default

* Use checked instead of CheckForOverflowUnderflow
  • Loading branch information
Marusyk authored Jan 29, 2022
1 parent 8471eec commit 874d6a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@

<!-- Language configuration -->
<PropertyGroup>
<!-- We decided to keep this disabled by default: https://github.com/dotnet/runtime/issues/15152 -->
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<GenFacadesIgnoreBuildAndRevisionMismatch>true</GenFacadesIgnoreBuildAndRevisionMismatch>
<!-- Disable analyzers for tests and unsupported projects -->
<RunAnalyzers Condition="'$(IsTestProject)' != 'true' and '$(IsSourceProject)' != 'true'">false</RunAnalyzers>
Expand Down
7 changes: 5 additions & 2 deletions src/tests/JIT/Regression/Dev11/dev11_4421/Dev11_4421.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ private static int Main()
int Var1, Temp;
try
{
for (Temp = int.MaxValue - 3; Temp <= int.MaxValue - 1; Temp++)
Var1 = (int)(2 + Temp);
checked
{
for (Temp = int.MaxValue - 3; Temp <= int.MaxValue - 1; Temp++)
Var1 = (int)(2 + Temp);
}
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<PropertyGroup>
<DebugType>PdbOnly</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Compile Include="Dev11_4421.cs" />
Expand Down

2 comments on commit 874d6a3

@Xyncgas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it mean checking overflow by default as instead of not checking by default

@stephentoub
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it mean checking overflow by default as instead of not checking by default

no. the default is false. the prop being set to false was redundant.

Please sign in to comment.