Bug 313842 (MONO54063) - the switch instruction supposes an empty stack
Summary: the switch instruction supposes an empty stack
Status: RESOLVED FIXED
Alias: MONO54063
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Major
Target Milestone: ---
Assignee: Zoltan Varga
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords: blocking
Depends on:
Blocks:
 
Reported: 2004-02-09 11:08 UTC by Manuel Serrano
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:27:02 UTC


---- Reported by Manuel.Serrano@inria.fr 2004-02-09 04:08:11 MST ----

The .NET switch instruction supposes an empty stack.

We are developping a compiler that produces sequences of bytecode such as:

.method public virtual hidebysig instance class System.Object
funcall1(class System.Object) cil managed {
	.maxstack	3
	ldarg.0
	ldarg.1
	ldarg.0
	ldfld	int32 bigloo.procedure::'index'
	switch	(L0,L1,err)
err:	call instance	class System.Object bigloo.procedure::'funcall1'(class
System.Object)
	ret
L0:	call	class System.Object 'foo'::'BgL_zc3anonymousza31019ze3z83'(class
'bigloo.procedure',class System.Object)
	ret
L1:	call	class System.Object 'foo'::'BgL_zc3anonymousza31007ze3z83'(class
'bigloo.procedure',class System.Object)
	ret
}


If this runs correctly with CLR, ROTOR and PNET, this crashes with
MONO0.29. We have had to change of code generator for:

.method public virtual hidebysig instance class System.Object
funcall1(class System.Object) cil managed {
	.maxstack	3
	ldarg.0
	ldfld	int32 bigloo.procedure::'index'
	switch	(L0,L1,err)
err:	ldarg.0
	ldarg.1
	call instance	class System.Object bigloo.procedure::'funcall1'(class
System.Object)
	ret
L0:	ldarg.0
	ldarg.1
	call	class System.Object 'foo'::'BgL_zc3anonymousza31019ze3z83'(class
'bigloo.procedure',class System.Object)
	ret
L1:	ldarg.0
	ldarg.1
	call	class System.Object 'foo'::'BgL_zc3anonymousza31007ze3z83'(class
'bigloo.procedure',class System.Object)
	ret
}


I hope that this bug report will help.



---- Additional Comments From vargaz@freemail.hu 2004-02-10 14:28:47 MST ----

Fixed in CVS.


Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>Linux 2.4, gcc 3.3.2</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".