Bug 55604 - Incorrect struct size when using property setter
Summary: Incorrect struct size when using property setter
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 5.0.0 (2017-02)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2017-04-26 04:47 UTC by Wonyoung Choi
Modified: 2017-05-23 06:43 UTC (History)
1 user (show)

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


Attachments

Description Wonyoung Choi 2017-04-26 04:47:48 UTC
If build with mcs following code including struct type with property setter, 
the size of the struct "MyStruct" is awalys to "1". 

Test.cs
============================================================================
namespace Test {
	public struct MyStruct {
		public int X {get; set;}
  }
}
============================================================================

# mcs -target:library Test.cs
# monodis Test.dll
============================================================================
...
.namespace Test
{
  .class public sequential ansi sealed beforefieldinit MyStruct
  	extends [mscorlib]System.ValueType
  {
    .pack 0
    .size 1
    .field  private  int32 '<X>k__BackingField'
    .custom instance void class [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::'.ctor'() =  (01 00 00 00 ) // ....
...
============================================================================
Comment 1 Marek Safar 2017-05-23 06:43:15 UTC
Fixed in master

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