Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
The following program works on 3.10.1 but fails on trunk:
public class Class1
static void Main()
decimal value = 100;
if (value < (decimal) Int32.MinValue || value > (decimal) Int32.MaxValue)
I've narrowed it down to the use of FCallCompare (mono_decimal_compare) that returns an incorrect value on arm and s390x. The code in question is the comparison of signs:
@@ -2242,9 +2242,9 @@ mono_decimal_compare (MonoDecimal *left, MonoDecimal *right)
- // Signs are different. Used signed byte compares
+ // Signs are different. Use signed byte comparison
- if ((char)left_sign > (char)right_sign)
+ if ((signed char)left_sign > (signed char)right_sign)
Note the comment said "Used signed byte compares". However, it assumes that (char) == (signed chars) which for s390x is not true (it defaults to unsigned). By explicitly using (signed char) casting, the problem is fixed.
I pushed this change under commit ca5bebb67ce72ab267bee11685dcb5db13885474.
The purpose of this report is to highlight that some architectures default to unsigned char instead of signed.