Bug 319336 (MONO76485) - [GMCS] assertion failed in monodis
Summary: [GMCS] assertion failed in monodis
Status: RESOLVED FIXED
Alias: MONO76485
Product: Mono: Tools
Classification: Mono
Component: tools (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Major
Target Milestone: ---
Assignee: Raja R Harinath
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-20 00:47 UTC by Michal Moskal
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:35:27 UTC


---- Reported by malekith@pld-linux.org 2005-10-19 17:47:46 MST ----

Description of Problem:

When trying to disasemble the Nemerle std library monodis chokes with


** ERROR **: file metadata.c: line 1883
(mono_metadata_parse_generic_param): assertion failed: (generic_context)
aborting...

It verfies and dissembles fine on ms.net aug ctp.

You can find it here: http://nemerle.org/svn/nemerle/trunk/boot/Nemerle.dll


Additional Information:

I'm using mono svn trunk.



---- Additional Comments From rharinath@novell.com 2005-11-28 14:38:46 MST ----

I believe that with SVN r53560, monodis runs without crashing on the
dll you mention.  However, I think there are still some issues with
the actual monodis output -- Ankit will be working on them.




---- Additional Comments From jankit@novell.com 2006-01-16 11:21:01 MST ----

monodis seems to be working with Nemerle.dll fine. ilasm2(svn) can
roundtrip it also now. But am not sure whether there might be any
issues with the roundtripped assembly. It would be nice if nemerle's
test-suite could be tried on this and let us know if there are issues
with that. Thanks.



---- Additional Comments From malekith@pld-linux.org 2006-01-18 05:36:22 MST ----

So the good news: it works fine with the testsuite.

There is a single tiny problem: monodis says special-name, while ilasm
accepts only specialname. I think ilasm is right.

However there are issues with PEVerify run on the resulting assemblies:

[IL]: Error: [C:\cygwin\home\malekith\boot\Nemerle.dll :
Nemerle.Collections.Set`1['a]::Sum['a]][offset 0x00000006] Unable to
resolve token.
[token  0x0200002F] Type load failed.
2 Errors Verifying Nemerle.dll

(similar errors occur in Nemerle.Compiler.dll).

Offending method, when disassembled by MS ildasm:
  .method public hidebysig instance class
Nemerle.Collections.Set`1<!'\'a'>
          Sum(class Nemerle.Collections.Set`1<!'\'a'> s) cil managed
  {
    // Code size       30 (0x1e)
    .maxstack  4
    .locals init (class Nemerle.Builtins.Function`3<!'\'a',class
Nemerle.Collections.Tree/Node`1<!'\'a'>,
             class Nemerle.Collections.Tree/Node`1<!'\'a'>> V_0)
    IL_0000:  ldarg.1
    IL_0001:  ldfld      class Nemerle.Collections.Tree/Node`1<!0>
class Nemerle.Collections.Set`1<!'\'a'>::root
    IL_0006:  ldarg.0
    IL_0007:  ldfld      class Nemerle.Collections.Tree/Node`1<!0>
class Nemerle.Collections.Set`1<!'\'a'>::root
    IL_000c:  newobj     instance void class
Nemerle.Collections.Set`1/_N__N_l10568_10578<!'\'a'>::.ctor()
    IL_0011:  stloc.0
    IL_0012:  ldloc.0
    IL_0013:  call       !!1
Nemerle.Collections.Tree::Fold<!'\'a',class
Nemerle.Collections.Tree/Node`1<!'\'a'>>(class
Nemerle.Collections.Tree/Node`1<!!0>,!!1,class
Nemerle.Builtins.Function`3<!!0,
                                                                     
                                            !!1,
                                                                     
                                            !!1>)
    IL_0018:  newobj     instance void class
Nemerle.Collections.Set`1<!'\'a'>::.ctor(class
Nemerle.Collections.Tree/Node`1<!0>)
    IL_001d:  ret
  } // end of method Set`1::Sum

and by monodis:

    // method line 610
    .method public hidebysig
           instance default class Nemerle.Collections.Set`1<!'\'a'>
Sum (class Nemerle.Collections.Set`1<!'\'a'> s) -> cil managed
    {
        // Method begins at RVA 0xcd0c
        // Code size 30 (0x1e)         .maxstack 4
        .locals init (
                class Nemerle.Builtins.Function`3<!'\'a', class
Nemerle.Collections.Tree/Node`1<!'\'a'>, class ->
Nemerle.Collections.Tree/Node`1<!'\'a'>>        V_0)
        IL_0000:  ldarg.1
        IL_0001:  ldfld  class Nemerle.Collections.Tree/Node`1<!0>
class Nemerle.Collections.Set`1<!0>::root
        IL_0006:  ldarg.0
        IL_0007:  ldfld  class Nemerle.Collections.Tree/Node`1<!0>
class Nemerle.Collections.Set`1<!0>::root
        IL_000c:  newobj instance void class
Nemerle.Collections.Set`1/_N__N_l10577_10587<!'\'a'>::.ctor()        
IL_0011:  stloc.0
        IL_0012:  ldloc.0         IL_0013:  call !!1 class
Nemerle.Collections.Tree::Fold<!0, class
Nemerle.Collections.Tree/Node`1<!0>> -> (class
Nemerle.Collections.Tree/Node`1<!!0>, !!1, class
Nemerle.Builtins.Function`3<!!0,!!1,!!1>)
        IL_0018:  newobj instance void class
Nemerle.Collections.Set`1<!'\'a'>::.ctor(class
Nemerle.Collections.Tree/-> Node`1<!0>)
        IL_001d:  ret
    } // end of method Set`1::instance default class
Nemerle.Collections.Set`1<!'\'a'> Sum (class Nemerle. ->
Collections.Set`1<!'\'a'> s)


Also when trying to ms.ilasm monodis produced assembly, it assembles
fine, but later PEVerify screams:
[IL]: Error: [C:\cygwin\home\malekith\stage3\n.dll :
Nemerle.Utility.Getopt::Usage] Type load failed.
[IL]: Error: [C:\cygwin\home\malekith\stage3\n.dll :
Nemerle.Utility.Getopt::Parse] Type load failed.
[IL]: Error: [C:\cygwin\home\malekith\stage3\n.dll :
Nemerle.Utility.Getopt::Parse] Type load failed.
[IL]: Error: [C:\cygwin\home\malekith\stage3\n.dll :
Nemerle.Utility.Getopt::_N_concat4729] Type load failed.

and so on, but it can be something wrong with my setup here.




---- Additional Comments From jankit@novell.com 2006-01-25 07:28:00 MST ----

The PEVerify errors in the mono roundtripped Nemerle.dll was because
the call site's enclosing type had two type parameters with identical
names (<'a, 'a>), which monodis emitted as !'a for references to any
of them, which further got miscompiled by ilasm (mono). 

monodis has now been fixed to use !number for such ambiguous type
parameters. Now, the mono roundtripped Nemerle.dll doesn't have any
PEVerify errors.


Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>amd 64 pld linux</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".