[Mono-bugs] [Bug 363791] New: mcs exception in switch statement with enumeration and duplicate case

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 21 14:37:18 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=363791

User webring at ndatech.it added comment
https://bugzilla.novell.com/show_bug.cgi?id=363791#c1

           Summary: mcs exception in switch statement with enumeration and
                    duplicate case
           Product: Mono: Compilers
           Version: 1.2.6
          Platform: i686
               URL: http://www.ndatech.it
        OS/Version: openSUSE 10.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: webring at ndatech.it
         QAContact: mono-bugs at lists.ximian.com
          Found By: Other


Created an attachment (id=196413)
 --> (https://bugzilla.novell.com/attachment.cgi?id=196413)
The test case causing the bug

- Bug description:
Mcs throws an exception if the following conditions:
) use a switch statement (switching on an enumerate variable)
) a switch case was duplicate
It's worth to note that this is not the rule, but applies to my particular test
case that I attached. I tried with other piece of code to reproduce the bug,
but with no effect.

- Expected output:
A compiler error regarding a duplicate switch case.

- Actual output:
 ndellamico at openSUSE-Dev:~/test> mcs Main.cs
Exception caught by the compiler while compiling:
   Block that caused the problem begin at: Main.cs(34,29):
                     Block being compiled: [Main.cs(54,33):,Internal(1,1):]
System.NullReferenceException: Object reference not set to an instance of an
object
Internal compiler error at Main.cs(34,29):: exception caught while emitting
MethodBuilder [MainClass::Parse]

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
  at Mono.CSharp.EnumMember.get_Value () [0x00000]
  at Mono.CSharp.Enum.GetDefinition (System.Object value) [0x00000]
  at Mono.CSharp.TypeManager.CSharpEnumValue (System.Type t, System.Object
value) [0x00000]
  at Mono.CSharp.SwitchLabel.Erorr_AlreadyOccurs (System.Type switch_type,
Mono.CSharp.SwitchLabel collision_with) [0x00000]
  at Mono.CSharp.Switch.CheckSwitch (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Switch.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.While.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.EmitContext.ResolveTopBlock (Mono.CSharp.EmitContext
anonymous_method_host, Mono.CSharp.ToplevelBlock block, Mono.CSharp.Parameters
ip, IMethodData md, System.Boolean& unreachable) [0x00000]

- How to reproduce the bug:
Simple run mcs Main.cs (see attached file)

- System environment:
ndellamico at openSUSE-Dev:~/test> mono --version
Mono JIT compiler version 1.2.6 (tarball)
Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  x86
        Disabled:      none

ndellamico at openSUSE-Dev:~/test> uname -a
Linux openSUSE-Dev 2.6.22.17-0.1-default #1 SMP 2008/02/10 20:01:04 UTC i686
athlon i386 GNU/Linux


-- 
Configure bugmail: https://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