Bug 4210 - Mono Compiler crash when struct's are bigger than assumed
Summary: Mono Compiler crash when struct's are bigger than assumed
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
: 10776 16287 ()
Depends on:
Blocks:
 
Reported: 2012-04-03 15:54 UTC by Marco Cunha
Modified: 2013-11-24 08:16 UTC (History)
3 users (show)

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


Attachments
Struct Size Stress Test Case (938 bytes, application/octet-stream)
2012-04-03 15:54 UTC, Marco Cunha
Details
Proposed fix (581 bytes, patch)
2012-04-03 15:55 UTC, Marco Cunha
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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Marco Cunha 2012-04-03 15:54:08 UTC
Created attachment 1617 [details]
Struct Size Stress Test Case

The attached test case compiles normally with CSC and the sample prints "Hello World!" when run.

Under Mono 2.10.8, 2.10.9 and 2.11 MCS fails due to the hardwired [4096] estimated number of AssignableSlots. CSC also has an upper limit however it goes up to at least 16812 before crashing. Adding one more field to struct Charlie would cause CSC to crash with an internal compiler error.

Submitted patch is a hack to raise compability level until MCS is able to calculate the number of assignable slots correctly.

Errors under 2.10.[89]:
$ mcs structstress2.cs 
structstress2.cs(34,21): error CS0584: Internal compiler error: Argument is out of range.
Parameter name: flow-analysis
structstress2.cs(34,21): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
structstress2.cs(35,23): error CS0165: Use of unassigned local variable `c'
structstress2.cs(35,23): error CS0584: Internal compiler error: Argument is out of range.
Parameter name: flow-analysis
structstress2.cs(35,13): error CS1502: The best overloaded method match for `StructSizeStress.MainClass.TestParam(StructSizeStress.Charlie)' has some invalid arguments
structstress2.cs(27,28): (Location of the symbol related to previous error)
structstress2.cs(35,13): error CS1503: Argument `#1' cannot convert `object' expression to type `StructSizeStress.Charlie'
Compilation failed: 6 error(s), 0 warnings

Errors under 2.11.0:
structstress2.cs(34,21): error CS0584: Internal compiler error: Argument is out of range.
Parameter name: flow-analysis
structstress2.cs(34,21): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
structstress2.cs(35,23): error CS0165: Use of unassigned local variable `c'
structstress2.cs(35,23): error CS0584: Internal compiler error: Argument is out of range.
Parameter name: flow-analysis
Compilation failed: 4 error(s), 0 warnings
Comment 1 Marco Cunha 2012-04-03 15:55:14 UTC
Created attachment 1618 [details]
Proposed fix

Workaround until MCS knows how to calculate the correct number of slots.
Comment 2 Marek Safar 2013-03-11 11:59:35 UTC
*** Bug 10776 has been marked as a duplicate of this bug. ***
Comment 3 Marek Safar 2013-11-16 03:22:08 UTC
*** Bug 16287 has been marked as a duplicate of this bug. ***
Comment 4 Marek Safar 2013-11-24 08:16:27 UTC
Fixed in master