[nem-bug] [Nemerle 0000828]: Mono doesn't implement conv.ovf.u4.un; Nemerle generates it

feedback at nemerle.org feedback at nemerle.org
Fri Jan 19 23:39:36 CET 2007


A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=828> 
======================================================================
Reported By:                Evin Robertson
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   828
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     feedback
======================================================================
Date Submitted:             01-19-2007 02:45 CET
Last Modified:              01-19-2007 23:39 CET
======================================================================
Summary:                    Mono doesn't implement conv.ovf.u4.un; Nemerle
generates it
Description: 
Mono doesn't implement conv.ovf.u4.un.  See
http://bugzilla.ximian.com/show_bug.cgi?id=70355 where this is marked
WONTFIX.

Nemerle generates this opcode on code like the following:

def x = '\n' :> uint
def y = (0 : ushort) :> uint

These casts could never fail, so they don't need to be checked for
overflow.  Attached is a patch to generate the unchecked opcode instead.

======================================================================

----------------------------------------------------------------------
 nazgul - 01-19-07 17:57 
----------------------------------------------------------------------
I checked with mono (Mono JIT compiler version 1.2.2) and it generates the
same opcode, which works very well:

[nazgul at lilith ~]$ mono --version
Mono JIT compiler version 1.2.2, (C) 2002-2006 Novell, Inc and
Contributors. www.mono-project.com
        TLS:           normal
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       normal
        Disabled:      none
[nazgul at lilith ~]$ cat t.cs 
class A {
static void Main () {
ulong x = ulong.MaxValue;
uint y = 33;
y = (uint) x;
}
}
[nazgul at lilith ~]$ mcs t.cs /checked
t.cs(4,6): warning CS0219: The variable `y' is assigned but its value is
never used
Compilation succeeded - 1 warning(s)
[nazgul at lilith ~]$ ./t.exe 

Unhandled Exception: System.OverflowException: Number overflow.
  at A.Main () [0x00000] 
[nazgul at lilith ~]$ monodis t.exe | grep conv.ovf.u4.un
        IL_0007:  conv.ovf.u4.un 


Note that ncc runs in /checked mode by default. 

The bugreport you refer to looks quite old, probably they changed their
mind and implemented the opcode, since it is needed (e.g. in above
program)

----------------------------------------------------------------------
 nazgul - 01-19-07 17:58 
----------------------------------------------------------------------
Which version of mono do you use? I guess we should close it as NOTABUG

----------------------------------------------------------------------
 Evin Robertson - 01-19-07 23:39 
----------------------------------------------------------------------
I'm using mono 1.2.2.1.

Your sample program converts from a ulong to a uint.  The bug report was
for conversion from char and ushort to uint, for which mcs doesn't issue a
conv instruction at all.  Try compiling and running the lines in the bug
report.

My patch wasn't quite right.  Nemerle should generate that opcode for
conversion from ulong to uint, but not for the other cases.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
01-19-07 02:45 Evin Robertson New Issue                                    
01-19-07 02:45 Evin Robertson File Added: conv_u4.patch                    
01-19-07 17:57 nazgul         Note Added: 0001610                          
01-19-07 17:58 nazgul         Note Added: 0001611                          
01-19-07 17:58 nazgul         Status                   new => feedback     
01-19-07 17:58 nazgul         Summary                  Mono doesn't implement
conv.ovf.u4.un; Nemerle generates it => Mono doesn\'t implement conv.ovf.u4.un;
Nemerle generates it
01-19-07 17:58 nazgul         Description Updated                          
01-19-07 23:39 Evin Robertson Note Added: 0001615                          
======================================================================




More information about the bugs mailing list