[Mono-bugs] [Bug 668905] New: ARM: converting decimal to float produces garbage

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Feb 2 10:17:53 EST 2011



           Summary: ARM: converting decimal to float produces garbage
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.8.x
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: jkovach at arl.army.mil
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

Description of Problem:
Converting a "decimal" value to a "float" value using Mono 2.8.2 (and 2.6.7) on
ARM, using either a cast or Convert.ToSingle, results in a garbage value. This
problem does not occur with Mono on x86.

Steps to reproduce the problem: Compile and run this test case.
using System;

namespace foo
  class bar
    public static void Main()
        decimal d = 0;
        double dd = Convert.ToDouble(d);
        float f = Convert.ToSingle(d);
        float ff = Convert.ToSingle(dd);

        byte[] fbytes = BitConverter.GetBytes(f);

        Console.WriteLine("d = {0} dd = {1} f = {2} ff = {3}", d, dd, f, ff);
        Console.Write("bytes = ");
        foreach(byte b in fbytes)
                Console.Write("{0:x2}", b);
        if (f != ff)

Actual Results:
d = 0 dd = 0 f = 3.198151E+09 ff = 0
bytes = e89f3e4f

(The exact value of f is different each time you run the program)

Expected Results:
d = 0 dd = 0 f = 0 ff = 0
bytes = 00000000

How often does this happen? Consistently 

Additional Information:
This is Mono 2.8.2, built by me from the source tarball, running on a
Beagleboard with a TI DM3730 ARM processor, using Debian 6 testing. Mono
version information is as follows:
root at bbtest:~# mono -V
Mono JIT compiler version 2.8.2 (tarball Tue Feb  1 22:21:37 UTC 2011)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,soft-float
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)

The problem also occurs with Mono 2.6.7 as shipped by Debian.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list