Bug 58600 - Mono C# compiler 5.0.1.0 hangs
Summary: Mono C# compiler 5.0.1.0 hangs
Status: CONFIRMED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: PC All
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2017-08-05 09:56 UTC by soywiz
Modified: 2017-08-08 21:24 UTC (History)
1 user (show)

Tags: hang
Is this bug a regression?: Yes
Last known good build:


Attachments
~6MB Single file program.cs compressed in a zip file (626.79 KB, application/x-zip-compressed)
2017-08-05 09:56 UTC, soywiz
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

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.


Please create a new report for Bug 58600 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description soywiz 2017-08-05 09:56:46 UTC
Created attachment 24042 [details]
~6MB Single file program.cs compressed in a zip file

Brief:
Mono C# compiler hangs on a generated program.cs ~6MB while microsoft C# compiler compiles it in 1 second or so.
It happens on older versions of the compiler too, but worked on even older versions (the one that comes from ubuntu 12.04 seems to work fine).

I have attached the program.cs file.

How to reproduce on windows:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc" /unsafe+ program.cs # compiles in 1 second
"c:\Program Files\Mono\lib\mono\4.5\mcs" /unsafe+ program.cs # hangs forever. Probably an infinite loop somewhere.

In linux happens too (reproduced on travis on ubuntu 14.04):
https://travis-ci.org/jtransc/jtransc/builds/261263534#L9099 # Ubuntu 14.04 - hangs
https://travis-ci.org/jtransc/jtransc/builds/257048300#L5361 # Ubuntu 12.04 - works

---

Context (probably not necessary):

The file is generated from this Java/Kotlin code:
https://github.com/jtransc/jtransc/blob/de8ced7a02a1212d3d6857decf287590d5f5d3fa/jtransc-main/test/big/BigTest.kt#L37

Into C# sourcecode. Works like IKVM but generates sourcecode and strips unused dependencies (tree shaking) generating a single cs that later is converted into a single exe. So the 6MB program.cs contains everywhing necessary to compile that program. Since it uses pointers to improve performance in specific places it requires /unsafe+ flag.

And I'm trying to upadte travis to trusty: https://github.com/jtransc/jtransc/pull/226 but hangs

I have tried to figure out why it hangs (probably an specific syntax or something), but probably you will find it faster if you can debug the compiler and pause on the infinite loop.
Comment 1 Marek Safar 2017-08-08 15:46:26 UTC
This looks like flowanalysis issue caused by few recursive goto(s)
Comment 2 soywiz 2017-08-08 21:24:45 UTC
Great that it is confirmed

Since I'm generating code from bytecode, those gotos probably are generating irreductible CFGs in some cases