Bug 56194 - SIGSEGV on System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray()
Summary: SIGSEGV on System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray()
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Rodrigo Kumpera
URL:
Depends on:
Blocks:
 
Reported: 2017-05-10 20:16 UTC by Evgeni
Modified: 2017-11-06 23:02 UTC (History)
5 users (show)

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


Attachments
Memory dump of the error and VS sample project (6.34 KB, application/x-zip-compressed)
2017-05-10 20:16 UTC, Evgeni
Details

Description Evgeni 2017-05-10 20:16:51 UTC
Created attachment 22072 [details]
Memory dump of the error and VS sample project

I'm trying to run the following code on Linux Bash Shell on Windows 10 x64, but it also fails the same way on Ubuntu. 

class Program
{
        int[] _testArray = { 3, 49, 40, 58, 32 };

        static void Main(string[] args)
        {
            var arr = new int[5];
            var type = Assembly.GetExecutingAssembly().GetTypes().Where(x => x.Name.Contains("<PrivateImplementationDetails>")).Single();
            var fieldInfo = type.GetFields(BindingFlags.NonPublic | BindingFlags.Static).Single();
            RuntimeHelpers.InitializeArray(arr, fieldInfo.FieldHandle);
        }
}

The code above runs perfectly on Windows .NET and Mono versions for Windows. 

If I make _testArray static the problem goes away.

Mono JIT compiler version 4.8.1 (Stable 4.8.1.0/22a39d7 Wed Apr 12 12:00:40 UTC 2017)

Please find attached memory dump and a sample project for Visual Studio.

Any help is much appreciated!
Comment 1 Bernhard Urban 2017-09-06 15:33:22 UTC
can reproduce on 5.4.0, MacOS (amd64):

> % mono --version
> Mono JIT compiler version 5.4.0.147 (2017-06/28a417c Fri Aug  4 13:27:50 EDT 2017)
> Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
> 	TLS:           normal
> 	SIGSEGV:       altstack
> 	Notification:  kqueue
> 	Architecture:  amd64
> 	Disabled:      none
> 	Misc:          softdebug
> 	LLVM:          yes(3.6.0svn-mono-master/8b1520c)
> 	GC:            sgen (concurrent by default)
Comment 2 Ludovic Henry 2017-10-06 20:36:54 UTC
I can reproduce with Mono 5.8.0.2 (2017-10/a3943e28cf8)
Comment 3 Rodrigo Kumpera 2017-10-09 21:21:24 UTC
PR against master: https://github.com/mono/mono/pull/5746
Comment 4 Rodrigo Kumpera 2017-10-11 17:01:36 UTC
Fixed in master

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

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