[Mono-bugs] [Bug 514099] New: Tiny console program that exposes JIT oder runtime error, -10, int to char

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jun 17 14:18:16 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=514099


           Summary: Tiny console program that exposes JIT oder runtime
                    error, -10, int to char
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.4.x
          Platform: i386
        OS/Version: Windows Vista
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: novellbugzilla at c-hett.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Description of Problem:

I have a tiny program here that I compiled with Visual Studio 2008
(mono-compiler also works, Reflector dissasembly of IL looked fine) that
produces different results when run with mono2.2 or mono2.4 under Linux (suse)
or Windows than when started with Microsoft .NET 3.5

Steps to reproduce the problem:
1. Compile this programm:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        public static string Day2Str2(int day)
        {
            Console.Error.WriteLine("after sub1:"+day);
            if (day<10)
                return ((char)('0'+day)).ToString();
            Console.Error.WriteLine("long:"+day);
            day-=10;
//Insert a debug output here and error goes away!       
//Console.Error.WriteLine("long:"+day);
            return ((char)('A'+day)).ToString();
        }

        static void Main(string[] args)
        {
            Console.WriteLine(Day2Str2(28));
            Console.ReadLine();
        }
    }
}

2. Run on Windows and with Mono and on linux:

C:\>ConsoleApplication1.exe
after sub1:28
long:28
S

This is correct! 28 minus 10 is 18 and the 18th letter (counting from zero) is
S

Running with mono:
C:\>"c:\Program Files\Mono-2.2\bin\mono.exe" ConsoleApplication1.exe
after sub1:28
long:28
I

This is 10 too less.

C:\>"c:\Program Files\Mono-2.2\bin\mono.exe" -V
Mono JIT compiler version 2.2 (tarball)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
        TLS:           normal
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       normal
        Notification:  Thread + polling
        Architecture:  x86
        Disabled:      none

On Linux:

xxx:~# /usr/local/mono-2.4/bin/mono /a.exe
after sub1:28
long:28
I


xxx:~# /usr/local/mono-2.4/bin/mono -V
Mono JIT compiler version 2.4 (tarball Fri Mar 13 15:50:22 UTC 2009)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none
archive:~#


Actual Results:

I

Expected Results:

S

How often does this happen? 

Always

Additional Information:

-- 
Configure bugmail: http://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