[Mono-bugs] [Bug 502582] System.InvalidProgramException thrown on some unsafe code with stackalloc.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon May 11 10:31:01 EDT 2009


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

User rkumpera at novell.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=502582#c7


Rodrigo Kumpera <rkumpera at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
          Component|JIT                         |C#
            Version|2.4.x                       |SVN
         AssignedTo|lupus at novell.com            |mono-bugs at lists.ximian.com
            Product|Mono: Runtime               |Mono: Compilers




--- Comment #7 from Rodrigo Kumpera <rkumpera at novell.com>  2009-05-11 08:31:00 MDT ---
Actually this is a gmcs bug.

Given this code:
public static unsafe void NotWorking ()
{
   double * to = stackalloc double [2];
  to[0] = to[1] = 0;
}

It generates the following IL. I annotated it with stack effects to make the
issue clear.

 .method public static  hidebysig 
   default void NotWorking ()  cil managed 
{
    .maxstack 5
    .locals init (
        float64*    V_0,
        float64*    V_1)
    IL_0000:  ldc.i4.2 
[i4]
    IL_0001:  ldc.i4.8 
[i4, i4]
    IL_0002:  mul.ovf.un 
[i4]
    IL_0003:  localloc 
[*]
    IL_0005:  stloc.0 
[]
    IL_0006:  ldloc.0 
[*]
    IL_0007:  ldloc.0 
[*,*]
    IL_0008:  ldc.i4.8 
[*,*,i4]
    IL_0009:  add 
[*,*]
    IL_000a:  ldc.r8 0.
[*,*,r]
    IL_0013:  dup 
[*,*,r, r]
    IL_0014:  stloc.1 
>>>OPS tried to store a float into a pointer local
    IL_0015:  stind.r8 
    IL_0016:  ldloc.1 
    IL_0017:  stind.r8 
    IL_0018:  ret 
}

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list