Bug 14515 - ParallelEnumerable.Range() yields incorrect values when "start" parameter > 1
Summary: ParallelEnumerable.Range() yields incorrect values when "start" parameter > 1
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Core (show other bugs)
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-09-07 01:11 UTC by karlvonl
Modified: 2013-09-09 03:15 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description karlvonl 2013-09-07 01:11:10 UTC
When calling ParallelEnumerable.Range(start, count) where start > 1, the enumerator yields incorrect values. Specifically, any value that would be greater than count is replaced by -1.

This program illustrates the error:

// ---------------------------------------------------------
using System;
using System.Linq;

public class Test
{
  static public void Main ()
  {
    Console.WriteLine("start = 0:");
    foreach (int n in ParallelEnumerable.Range(0, 10)) {
      Console.WriteLine(n);
    }

    Console.WriteLine("start = 5:");
    foreach (int n in ParallelEnumerable.Range(5, 10)) {
      Console.WriteLine(n);
    }

    Console.WriteLine("start = 30:");
    foreach (int n in ParallelEnumerable.Range(30, 10)) {
      Console.WriteLine(n);
    }
  }
}
// ---------------------------------------------------------

And this is the output:

start = 0:
0
5
1
2
3
4
6
7
8
9
start = 5:
5
6
7
8
9
10
-1
-1
-1
-1
start = 30:
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

I am using Mono 3.2.1 on Mac OS X 10.7.5 (Lion).

Mono JIT compiler version 3.2.1 ((no/f3f789e Tue Jul 30 00:31:23 EDT 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.3svn-mono)
	GC:            sgen
Comment 1 Marek Safar 2013-09-09 03:13:03 UTC
Fixed in master

Note You need to log in before you can comment on or make changes to this bug.