Bug 59330 - "(UInt64)2 ** (UInt16)2" expression compilation cause "System.InvalidProgramException : float conv.ovf.un opcodes not supported."
Summary: "(UInt64)2 ** (UInt16)2" expression compilation cause "System.InvalidProgramE...
Status: NEEDINFO
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-09-08 12:36 UTC by Denis Zykov
Modified: 2017-09-21 20:53 UTC (History)
4 users (show)

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


Attachments
travis.log (219.34 KB, text/plain)
2017-09-08 12:36 UTC, Denis Zykov
Details
bug59330.cs (804 bytes, text/plain)
2017-09-21 20:53 UTC, Ludovic Henry
Details

Description Denis Zykov 2017-09-08 12:36:26 UTC
Created attachment 24647 [details]
travis.log

This expression run fine on .NET and older and Windows version of Mono:

#################################################
// #(System.UInt64)(#(System.Double)(#(System.UInt64)2)) ** (#(System.Double)((System.UInt64)(#(System.UInt16)2)))
Expression.Lambda<Func<ulong>>(
	Expression.Convert(
		Expression.Power(
			Expression.Convert(
				Expression.Convert(
					Expression.Constant(2), 
					typeof(ulong)
				), 
				typeof(double)
			),
			Expression.Convert(
				Expression.Convert(
					Expression.Convert(Expression.Constant(2), typeof(ushort)), 
					typeof(ulong)
				), 
				typeof(double)
			)
		),
		typeof(ulong)
	)
).Compile().Invoke();
#################################################

and fails this error on Linux:

#################################################
      System.InvalidProgramException : float conv.ovf.un opcodes not supported.
      Stack Trace:
          at (wrapper managed-to-native) System.Delegate:CreateDelegate_internal (System.Type,object,System.Reflection.MethodInfo,bool)
          at System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure, System.Boolean allowClosed) [0x002f0] in <204f770036d441bb8dfd3daba3550e83>:0 
          at System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0 
          at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type delegateType, System.Object target) [0x0001a] in <204f770036d441bb8dfd3daba3550e83>:0 
          at System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate () [0x00022] in <e3fb361e66bb4797b6f56fd88e04971e>:0 
          at System.Linq.Expressions.Compiler.LambdaCompiler.Compile (System.Linq.Expressions.LambdaExpression lambda) [0x00013] in <e3fb361e66bb4797b6f56fd88e04971e>:0 
          at System.Linq.Expressions.Expression`1[TDelegate].Compile (System.Boolean preferInterpretation) [0x00000] in <e3fb361e66bb4797b6f56fd88e04971e>:0 
          at System.Linq.Expressions.Expression`1[TDelegate].Compile () [0x00000] in <e3fb361e66bb4797b6f56fd88e04971e>:0 
          at System.Linq.Expressions.ExpressionExtensions.CompileAot[TResult] (System.Linq.Expressions.Expression`1[TDelegate] expression, System.Boolean forceAot) [0x00034] in <53187d0acee546aea5d61a19c92f9870>:0 
          at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
          at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <204f770036d441bb8dfd3daba3550e83>:0 
#################################################

Travis log attached. Project and tests are in https://github.com/deniszykov/csharp-eval-unity3d
Comment 1 Ludovic Henry 2017-09-21 20:53:44 UTC
Created attachment 24872 [details]
bug59330.cs

I tried to reproduce on Ubuntu 14.04 32bits with Mono 5.2.0.224 (d15-3/14f2c814) with no luck. I also tried on Ubuntu 16.04 64bits and macOS 64bits.

Attached is the repro case I made from the code provided in https://bugzilla.xamarin.com/show_bug.cgi?id=59330#c0.

Could you please check if you can reproduce the attached test case, and if you can please attach the output of `mono -v -v -v -v bug59330.exe`.

Thank you

Note You need to log in before you can comment on or make changes to this bug.