Bug 318311 (MONO75317) - CS0162 (unreachable code) incorrectly reported for code using goto statement
Summary: CS0162 (unreachable code) incorrectly reported for code using goto statement
Status: RESOLVED MOVED
Alias: MONO75317
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other All
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-19 16:17 UTC by Gert Driesen
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:21:52 UTC


---- Reported by gert.driesen@pandora.be 2005-06-19 09:17:13 MST ----

mcs incorrectly reports CS0162 (Unreachable code detected) for the 
following code snippet:

using System;

public class FlowControlTest
{
  public static void Main ()
  {
    DateTime currentDate = DateTime.Now;

    if (currentDate.Year > 2000) {
      goto check_year;
    }

    return;

check_year:
    Console.WriteLine ("check year");
    return;
  }
}

Actual result:

test.cs(6) warning CS0162: Unreachable code detected
Compilation succeeded - 1 warning(s)

Expected result:

Succesful compilation without warnings

This is the result you get when you use csc.



---- Additional Comments From john.luke@gmail.com 2005-08-22 21:42:53 MST ----

I think this is a dupe of https://bugzilla.novell.com/show_bug.cgi?id=MONO75255



---- Additional Comments From grompf@sublimeintervention.com 2006-01-06 19:09:09 MST ----

*** https://bugzilla.novell.com/show_bug.cgi?id=MONO77161 has been marked as a duplicate of this bug. ***



---- Additional Comments From martin@ximian.com 2006-03-21 18:53:47 MST ----



*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO77869 ***


This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"