Bug 39775 - DynamicMethod creation explodes on valid multiplication
Summary: DynamicMethod creation explodes on valid multiplication
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: 4.2.0 (C6)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-03-18 18:56 UTC by Dan Shechter
Modified: 2016-03-23 18:17 UTC (History)
3 users (show)

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

mulbug.cs (817 bytes, text/x-csharp)
2016-03-18 18:56 UTC, Dan Shechter

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Dan Shechter 2016-03-18 18:56:52 UTC
Created attachment 15461 [details]

I have a short program that creates a delegate.

When the program is run on Windows/MS.NET everything works.
When run on mono, the delegate creation explodes.
If the multplication within the program is slightly changed, everything works properly.

Steps to reproduce:
Run mcs mulbug.cs (attaached)
Comment 1 Zoltan Varga 2016-03-19 11:10:38 UTC
This is not valid il, the mul instruction requires two arguments with the same type.
Comment 2 Dan Shechter 2016-03-20 09:51:44 UTC
Wow, so this is actually a Microsoft bug that they accept this?

I assume that you are referring to:

Page 302 (Table III.2: Binary Numeric Operations)

I ask this because I intend in opening a bug in CoreCLR, so I would like to verify that I'm referring to the correct part of the spec...
Comment 3 Zoltan Varga 2016-03-20 09:59:13 UTC
Its not a bug in ms, a runtime can accept more code than the spec allows, but its not required, and mono is more strict in this matter.
Comment 4 Dan Shechter 2016-03-20 20:14:53 UTC
I'm not used to MSIL / CLR being so relaxed.

Can't this lead though to unexpected results (as in generate completely unsafe code / subvert the type system etc.)?
Comment 5 Zoltan Varga 2016-03-20 23:24:27 UTC
Not in this case, ms just inserts the conversion by itself.
Comment 6 Zoltan Varga 2016-03-23 18:17:00 UTC