[Mono-bugs] [Bug 619228] New: Compiler fails with error on valid code

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jul 1 12:05:42 EDT 2010


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

http://bugzilla.novell.com/show_bug.cgi?id=619228#c0


           Summary: Compiler fails with error on valid code
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: dans at houmus.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.2 (KHTML, like Gecko) Chrome/6.0.447.0 Safari/534.2

using System;
using System.Runtime.InteropServices;

  internal unsafe struct Header
  {
    public fixed byte Sha1Signature[20];

    public static Header Default
    {
      get
      {
        Header v;
        for (var i = 0; i < 20; i++)
          v.Sha1Signature[i] = 0xCC;
        return v;
      }
    }
  }

when this code is compiled with:
gmcs -unsafe -out:x.dll -t:library b.cs

The compiler reports:
error CS0165: Use of unassigned local variable `v'


As you can see from the code, v is fully assigned/initialized.


Reproducible: Always

Steps to Reproduce:
1. Download the code to b.cs
2. Compile
3. Profit!
Actual Results:  
Compiler Error

Expected Results:  
Compiler Success!

-- 
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