This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 9186 - ulong/float comparison miscompiled on 64bit Macs
: ulong/float comparison miscompiled on 64bit Macs
Product: Runtime
Classification: Mono
Component: JIT
: unspecified
: PC Mac OS
: --- normal
: ---
Assigned To: Bugzilla
  Show dependency treegraph
Reported: 2013-01-02 11:38 EST by Marek Safar
Modified: 2013-01-03 12:54 EST (History)
3 users (show)

See Also:


Description Marek Safar 2013-01-02 11:38:33 EST
float b = 0f;
            if (b < ulong.MaxValue)
                Console.WriteLine ("hit");

"hit" is never hit when mono is compiled as 64 bit on mac
Comment 1 Zoltan Varga 2013-01-03 00:04:22 EST
I can't reproduce this. Can you attach a complete testcase plus the generated
.exe ?
Comment 2 Marek Safar 2013-01-03 11:33:24 EST
This is actually AOT issue

class C
    public static void Main ()
        ulong ul = ulong.MaxValue;
        System.Console.WriteLine ((float) ul);

When compiled and run with mono JIT I get
when using --aot I get

My log

mono test-mcs.exe
[mono] ~/git/mono/mcs/mcs$ mono --aot test-mcs.exe
Mono Ahead of Time compiler - compiling assembly
Code: 163 Info: 5 Ex Info: 8 Unwind Info: 17 Class Info: 34 PLT: 3 GOT Info: 17
GOT: 28 Offsets: 48
Compiled: 2/2 (100%), No GOT slots: 1 (50%), Direct calls: 0 (100%)
Executing the native assembler: as -arch i386 -W  -o
Executing the native linker: gcc -m32 -dynamiclib -o
Generating debug symbols: dsymutil
JIT time: 0 ms, Generation time: 0 ms, Assembly+Link time: 32 ms.
[mono] ~/git/mono/mcs/mcs$ mono test-mcs.exe
Comment 3 Zoltan Varga 2013-01-03 12:54:24 EST
Fixed in master.

Note You need to log in before you can comment on or make changes to this bug.