[nem-bug] [Nemerle 0000678]: A successful compilation yields invalid IL

feedback at nemerle.org feedback at nemerle.org
Fri Jan 19 18:00:34 CET 2007


The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=678> 
======================================================================
Reported By:                d
Assigned To:                nazgul
======================================================================
Project:                    Nemerle
Issue ID:                   678
Category:                   Compiler (blocked by framework)
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     resolved
Resolution:                 fixed
Fixed in Version:           
======================================================================
Date Submitted:             05-15-2006 14:47 CEST
Last Modified:              01-19-2007 18:00 CET
======================================================================
Summary:                    A successful compilation yields invalid IL
Description: 
$ cat test.n
using Nemerle.Collections;
using SC = System.Console;

def rl1 = RList.FromList ($[0..10]);
SC.WriteLine ($"$rl1")
$ ncc test.n
$ mono out.exe

Unhandled Exception: System.InvalidProgramException: Invalid IL code in
Nemerle.Collections.RList`1:_FromList
(Nemerle.Core.list`1,int,Nemerle.Builtins.Function`2): IL_0051: call     
0x2b00007a


in <0x00000> <unknown method>
in <0x00050> Nemerle.Collections.RList`1[System.Int32]:FromList
(Nemerle.Core.list`1 , Int32 )
in <0x0004c> Nemerle.Collections.RList`1[System.Int32]:FromList
(Nemerle.Core.list`1 , Int32 )
in <0x00034> Nemerle.Collections.RList`1[System.Int32]:FromList
(Nemerle.Core.list`1 )
in <0x00190> _N_AutoModule:Main ()
$
======================================================================

----------------------------------------------------------------------
 nazgul - 05-15-06 18:34 
----------------------------------------------------------------------
It verifies and works fine on MS.NET. So it must be a bug in mono.

----------------------------------------------------------------------
 nazgul - 05-16-06 00:04 
----------------------------------------------------------------------
A bit more self-contained example, still needs cutting and reporting in
mono:

using System;
using SC = System.Console;
using SCG = System.Collections.Generic;

  [Record] 
  public class Pair ['a] { 
    public fst : 'a; 
    public snd : 'a; 
  }
  
  public variant RList ['a] {
    | Nil
    | Zero { 
      arg : RList [Pair ['a]] 
    }
    | One { 
      arg1 : 'a; 
      arg2 : RList [Pair ['a]] 
    }
  
    public static Empty : RList ['a] = Nil ();

    public static FromList (xs : SCG.List ['a]) : RList ['a] {
      def f = fun (l) {
        if (l.Count == 0)
          throw Exception ("Empty")
        else
          (l[0], l)
      };
      _FromList (xs, f)  
    }
      
    static _FromList ['b] (xs : SCG.List ['b], f : SCG.List ['b] -> 'a *
SCG.List ['b]) : RList ['a] {
      def f' (l) { 
        def (elem1, rest1) = f (l); 
        def (elem2, rest2) = f (rest1);
        (Pair (elem1, elem2), rest2)
      }
      def (elem, rest) = f (xs);
      One (elem, RList [Pair ['a]]._FromList (rest, f'))
    }

  }

  def l = SCG.List ();
  l.Add (1);
def rl1 = RList.FromList (l);
SC.WriteLine ($"$rl1")

----------------------------------------------------------------------
 d - 05-16-06 22:28 
----------------------------------------------------------------------
$ cat rlist-test.n 
using Nemerle.Collections;
using Nemerle.Collections.RList;

def r = One (1, One (Pair (2, 3), One (Pair (Pair (4, 5), Pair (6, 7)),
Nil ())));
def _ = r.Update (4, 666);
$ ncc rlist-test.n
$ mono out.exe

Unhandled Exception: System.InvalidProgramException: Invalid IL code in
Nemerle.Collections.RList`1:_Update
(Nemerle.Builtins.Function`2,int,Nemerle.Collections.RList`1): IL_004a:
call      0x0a00071a


in <0x00000> <unknown method>
in <0x00078> Nemerle.Collections.RList`1[System.Int32]:Update (Int32 ,
Int32 , Nemerle.Collections.RList`1 )
in <0x00074> Nemerle.Collections.RList`1[System.Int32]:Update (Int32 ,
Int32 , Nemerle.Collections.RList`1 )
in <0x00024> Nemerle.Collections.RList`1[System.Int32]:Update (Int32 ,
Int32 )
in <0x0010c> _N_AutoModule:Main ()
$

# Guess there will be more trouble with other methods as well..

----------------------------------------------------------------------
 d - 05-16-06 22:53 
----------------------------------------------------------------------
# Yup, as I expected.
$ cat rlist-test.n
using Nemerle.Collections.RList;
Nil ().Length
$ ncc rlist-test.n
$ mono out.exe

Unhandled Exception: System.InvalidProgramException: Invalid IL code in
Nemerle.Collections.RList`1:_Length (Nemerle.Collections.RList`1,int,int):
IL_001c: call      0x0a000712


in <0x00000> <unknown method>
in <0x00020> Nemerle.Collections.RList`1[System.Object]:get_Length ()
in <0x0001c> Nemerle.Collections.RList`1[System.Object]:get_Length ()
in <0x00024> _N_AutoModule:Main ()
$

----------------------------------------------------------------------
 nazgul - 05-17-06 19:14 
----------------------------------------------------------------------
http://bugzilla.ximian.com/show_bug.cgi?id=78431

----------------------------------------------------------------------
 nazgul - 01-19-07 18:00 
----------------------------------------------------------------------
Looks like mono folks finally fixed the issue. Thus resolving this one.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
05-15-06 14:47 d              New Issue                                    
05-15-06 18:34 nazgul         Note Added: 0001296                          
05-16-06 00:04 nazgul         Note Added: 0001297                          
05-16-06 21:36 d              Issue Monitored: d                           
05-16-06 22:28 d              Note Added: 0001300                          
05-16-06 22:53 d              Note Added: 0001301                          
05-17-06 19:14 nazgul         Note Added: 0001302                          
05-17-06 19:14 nazgul         Status                   new => confirmed    
05-17-06 19:14 nazgul         Category                 Compiler => Compiler
(blocked by framework)
05-17-06 19:14 nazgul         Description Updated                          
01-19-07 18:00 nazgul         Status                   confirmed => resolved
01-19-07 18:00 nazgul         Resolution               open => fixed       
01-19-07 18:00 nazgul         Assigned To               => nazgul          
01-19-07 18:00 nazgul         Note Added: 0001612                          
======================================================================




More information about the bugs mailing list