Created attachment 24042 [details]
~6MB Single file program.cs compressed in a zip file
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:
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.
This looks like flowanalysis issue caused by few recursive goto(s)
Great that it is confirmed
Since I'm generating code from bytecode, those gotos probably are generating irreductible CFGs in some cases