You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DS-AdamMilazzo
changed the title
decompilation of (decimal)uint.MaxValue is incorrect
decompilation of large uint values cast to decimal is incorrect
Apr 5, 2023
DS-AdamMilazzo
changed the title
decompilation of large uint values cast to decimal is incorrect
decompilation of large uint constants cast to decimal is incorrect
Apr 5, 2023
Steps to reproduce
(decimal)uint.MaxValue
under .NET Core 6 or later (or otherwise produce the following IL)ldc.i4.m1; newobj System.Decimal::.ctor(uint32)
-1m
instead of something like4294967295m
Note, this affects any uint constant > int.MaxValue. E.g.
(decimal)(uint.MaxValue-1000)
ldc.i4 -1001; newobj System.Decimal::.ctor(uint32)
-1001m
I haven't tested the behavior of large ulong constants cast to decimal, but it'd be worth looking at.
Screenshot
Details
The text was updated successfully, but these errors were encountered: