[Mono-bugs] [Bug 79027][Wis] New - Call to a vararg method with no variables arg incorrectly generated

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Aug 7 12:29:48 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by roberto.costa at st.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79027

--- shadow/79027	2006-08-07 12:29:48.000000000 -0400
+++ shadow/79027.tmp.11634	2006-08-07 12:29:48.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 79027
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: JIT
+AssignedTo: massi at ximian.com                            
+ReportedBy: roberto.costa at st.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Call to a vararg method with no variables arg incorrectly generated
+
+*** Explanation ***
+
+As the title says, in some cases a call to a vararg method with no variable
+arg is incorrectly generated.
+I can reproduce the problem with Mono 1.1.16.1 (+ patch for bug 78972,
+otherwise an earlier misbehavior masks this problem) on my x86 machine.
+I haven't tried Mono from svn repository, I believe it should behave in the
+same way.
+
+*** How to reproduce it ***
+
+Here is test.c, a very small example that shows the problem:
+
+--------------------------
+#include <stdio.h>
+
+int main()
+{
+    fprintf(sdtout, "Hello\n");
+    return 0;
+}
+--------------------------
+
+test.exe has to be compiled with gcc4cil:
+cil32-gcc -O2 test.c -o test.exe
+
+In order to avoid recompiling the test, attached you can find test.exe and
+all the needed libraries to run it.
+
+Mono crashes running the test.
+
+*** Suggested patch ***
+
+I think the problem is due to the fact that the signature cookie is not
+initialized if the sentinel follows the last method parameter (which means
+that there are no variable paramters).
+mono_arch_call_opcode(...) function should it, but it does it only in the
+presence of variable arguments.
+As a matter of fact, by inspecting internal call
+mono_ArgIterator_Setup(...) with gdb, the contents of 'argsp' parameter are
+uninitialized.
+
+A proposed patch for x86 jit follows.
+I suggest a jit expert reviews it because it may be sub-optimal (but
+hopefully safe). Basically, some code within a 'for' statement is
+duplicated at the end of the 'for' statement; there might be occasions for
+simplifications in this special case. Look at the patch file and everything
+will be clear. :-)
+
+By looking at the other jits' source code, I believe (without testing) this
+bug also affects the following jits: amd64, arm, ia64, ppc, s390, s390x, sparc.
+Conceptually similar patches should fix them all.


More information about the mono-bugs mailing list