Skip to content

[release/5.0] Backport Fix for Issue 46529 incorrect 64-bit shift result with cast to int #47724

@briansull

Description

@briansull

Incorrect behavior a 64-bit long with shift of 32 or more combined with a cast to int

The JIT generates incorrect code for this code pattern:

(int) (X << C)

where C >= 32 and
and X is anything with a potential side-effect and is 64-bit integer type

Customer Impact

Reported by customer who was migrating to .Net Core from the Desktop runtime.

Regression?

This is a regression that was introduced in the .Net 3.X timeframe by
dotnet/coreclr#19899

Testing

SuperPMI, new unit test, CLR outerloop, asm diffs.

Risk

Low

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions