[Mono-bugs] [Bug 447721] gmcs miscompiles pos increment over captured variable

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Nov 21 13:43:28 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=447721

User rkumpera at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=447721#c1





--- Comment #1 from Rodrigo Kumpera <rkumpera at novell.com>  2008-11-21 11:43:27 MST ---
Created an attachment (id=254460)
 --> (https://bugzilla.novell.com/attachment.cgi?id=254460)
Test case

To understand the problem, let's check the stack effects of Driver::Repro:

IL_001c:  ldarg.0 
[arg0]
IL_001d:  ldloc.1 
[arg0, loc1]
IL_001e:  ldfld int32 Driver/'<Repro>c__AnonStorey0'::b
[arg0, int32]
IL_0023:  ldloc.1 
[arg0, int32, loc1]
IL_0024:  ldloc.1 
[arg0, int32, loc1, loc1]
IL_0025:  ldfld int32 Driver/'<Repro>c__AnonStorey0'::a
[arg0, int32, loc1, int32]
IL_002a:  dup 
[arg0, int32, loc1, int32, int32]
IL_002b:  stloc.2  <<<==== This stores the pre increment value
[arg0, int32, loc1, int32]
IL_002c:  ldc.i4.1
[arg0, int32, loc1, int32, int32]
IL_002d:  add 
[arg0, int32, loc1, int32]
IL_002e:  stfld int32 Driver/'<Repro>c__AnonStorey0'::a
[arg0, int32]
IL_0033:  call instance void class Driver::P(int32, int32) <<<=== OPS, stack
not as big as it should be.

Note that the missing value is the value of 'a' before the increment, which is
stored in the local 2. 

The fix is to emit a ldloc.2 at after the stfld.


Happy hacking!


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list