-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[win/x86] (uint)double.MaxValue produces different value with optimizations on vs. off #13651
Comments
cc @dotnet/jit-contrib This is fallout from VS2017->VS2019 update for official builds. The bug is likely in gtFoldExprConst. |
Disabling CoreFX tests against this issue: dotnet/corefx@f9ececd |
Tier 0 code: C5FB1005883E7907 vmovsd xmm0, qword ptr [@RWD00]
83EC08 sub esp, 8
C5FB110424 vmovsd qword ptr [esp], xmm0
E8F97DA44D call CORINFO_HELP_DBL2UINT
8BC8 mov ecx, eax
E8F6F9FFFF call System.Console:WriteLine(int) Tier 1 code: B9FFFFFFFF mov ecx, -1
E8DB90FFFF call System.Console:WriteLine(int) The 5415D6E6 F2 0F 10 45 F0 movsd xmm0,mmword ptr [d1]
5415D6EB E8 B5 7D 0F 00 call _dtoui3 (542554A5h)
5415D6F0 89 45 D8 mov dword ptr [ebp-28h],eax The JIT helper and the VC++ helper behave differently. Tiering aside, this is also an inconsistency between x64 (which always generates 0) and x86 (which generates when optimizing 4294967295). I wonder if the JIT could simply call |
This does not work for cross-compilation. The JIT designs should be compatible with cross-compilation. |
Yes, so that leaves the JIT with the following choices:
The first is probably going to be safer, the second may just move the problem somewhere else - VM's own helpers aren't all written in ASM so they too may sometimes be affected by C++ compiler changes. And even if the JIT copies the VM helper implementation, due to cross-compiling it is not guaranteed that the behavior will be the same. Hopefully such cases are rare. |
That looks like a more stable solution. Sounds similar to #10905 |
This no longer repros, the code consistently prints 0: Tier 0 code:
Tier 1 code:
|
Possibly caused by dotnet/coreclr#27384 commit c322db1
And possibly fixed with commit: 75421f7 |
This issue is fixed |
Repro:
Result
category:correctness
theme:optimization
skill-level:beginner
cost:small
The text was updated successfully, but these errors were encountered: