Bug 321450 (MONO78729) - [verifier] Multi dimensional array invalid IL code
Summary: [verifier] Multi dimensional array invalid IL code
Status: RESOLVED FIXED
Alias: MONO78729
Product: Mono: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: 1.1
Hardware: Other Windows XP
: P3 - Medium : Major
Target Milestone: ---
Assignee: Paolo Molaro
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-29 16:51 UTC by George Hara
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
This is a simple VS2005 console application which reproduces the bug (17.98 KB, application/octet-stream)
2006-06-29 17:33 UTC, Thomas Wiest
Details
This is a simple executable console application (compiled with VS2005) which reproduces the bug (16.00 KB, application/octet-stream)
2006-06-29 17:34 UTC, Thomas Wiest
Details
Source code, the executable which fails, and the trace log file (24.81 KB, application/octet-stream)
2006-08-31 22:36 UTC, Thomas Wiest
Details

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


---- Reported by georgegabrielhara@fastmail.fm 2006-06-29 09:51:49 MST ----

Please fill in this template when reporting a bug, unless you know what 
you are doing.


Description of Problem:
I am trying to run some C# code under Mono (version 1.1.15, under 
WindowsXP), code which uses multidimensional arrays, but it fails with the 
message "Invalid IL code in AxiomaticIdTesterConsole.Program:test (): 
IL_001e: stloc.0"

If, in the provided example, you'll call the "test" method from a console 
application, using the multidimensional array "key2", you'll see it throws 
an exception with the message from above. If the single dimensional array 
"key1" is used, the code works.


Steps to reproduce the problem:
----------------------------------------
private static int[] key1 = new int[] { 5, 7, 6, 8 };
private static int[ , ] key2 = new int[ , ] { { 5, 7 }, { 6, 8 } };
private static int sum = 0;

private static void test()
{
	unsafe 
	{
		fixed( int* k = key2 ) // Works with "key1", but not with 
"key2".
		{
			sum += *k; // No cycle here, so NO broken bounds.
		}
	}
	
	Console.WriteLine( sum );
}
----------------------------------------


Actual Results:
Application crashes


Expected Results:
5

How often does this happen? 
Always


Additional Information:
-



---- Additional Comments From vargaz@gmail.com 2006-06-29 10:16:42 MST ----

I can't repro this. Please attach a complete test case and its exe
file too.




---- Additional Comments From georgegabrielhara@fastmail.fm 2006-06-29 10:33:19 MST ----

Created an attachment (id=170022)
This is a simple VS2005 console application which reproduces the bug




---- Additional Comments From georgegabrielhara@fastmail.fm 2006-06-29 10:34:56 MST ----

Created an attachment (id=170023)
This is a simple executable console application (compiled with VS2005) which reproduces the bug




---- Additional Comments From vargaz@gmail.com 2006-06-29 12:37:35 MST ----

That exe runs fine for me under SVN HEAD.. It might be a bug in 1.1.15
which got fixed in the meantime. I suggest waiting till 1.1.16 is
released and check against that version.




---- Additional Comments From vargaz@gmail.com 2006-07-08 12:01:25 MST ----

Could you try again with our shiny new 1.1.16 release ?



---- Additional Comments From miguel@ximian.com 2006-07-15 16:36:09 MST ----

It fails with trunk as of Jul 15th (post 1.1.16)

This is a verifier bug:

4107                            --sp;
4108                            handle_loaded_temps (cfg, bblock,
stack_start, sp);
4109                            NEW_LOCSTORE (cfg, ins, n, *sp);
4110                            ins->cil_code = ip;
4111                            if (!dont_verify_stloc &&
target_type_is_incompatible (cfg, header->locals [n], *sp))
4112                                    UNVERIFIED;
4113                            if (ins->opcode == CEE_STOBJ) {
4114                                    NEW_LOCLOADA (cfg, ins, n);
4115                                    handle_stobj (cfg, bblock,
ins, *sp, ip, ins->klass, FALSE, FALSE, FALSE);
4116                            } else
(gdb)

Fails in "UNVERIFIED"





---- Additional Comments From georgegabrielhara@fastmail.fm 2006-07-18 17:41:38 MST ----

Yes, it still fails on Mono 1.1.16.1 with the same exception, on 2
WinXp systems and on Vista Beta 2.



---- Additional Comments From miguel@ximian.com 2006-08-29 16:51:02 MST ----

It works for me with 1.1.17, can you try that one?

It just got released

Am closing the bug, but please reopen if it fails.



---- Additional Comments From georgegabrielhara@fastmail.fm 2006-08-31 15:36:47 MST ----

Created an attachment (id=170024)
Source code, the executable which fails, and the trace log file




---- Additional Comments From georgegabrielhara@fastmail.fm 2006-08-31 15:37:25 MST ----

The same error occurs. I've tested on two computers with WindXP Pro 
SP2, one with AMD Athlon XP, one with Intel P4. On each, I've 
compiled the program with a different installation of Visual Studio, 
one Standard edition, one Pro.

Here is what I do to run the program:

* Command line:
----------------------------------------
"C:\Program Files\Mono-1.1.17\bin\mono.exe" --trace 
MultiDimArrayMono.exe > log.txt
----------------------------------------

* This is displayed in the console, after the program is executed:
----------------------------------------
Unhandled Exception: System.InvalidProgramException: Invalid IL code 
in MultiDim
ArrayMono.Program:Main (string[]): IL_001e: stloc.0
----------------------------------------


Attached, you'll find the source code simplified to the max (so as to 
generate the smallest trace log), the executable which fails, and the 
trace log file.




---- Additional Comments From vargaz@gmail.com 2006-08-31 16:25:40 MST ----

Fixed in SVN.


Imported an attachment (id=170022)
Imported an attachment (id=170023)
Imported an attachment (id=170024)

Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>XP Pro SP2</cf_op_sys_details>