Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casting `nfloat` to `nint` crashes when running under `--interpreter` #5809

Open
rdavisau opened this Issue Mar 27, 2019 · 0 comments

Comments

3 participants
@rdavisau
Copy link

rdavisau commented Mar 27, 2019

I reproduced this on two builds of Xamarin.iOS - the current preview from the recent interpreter announcement, and an earlier build from a few months back that I built from source. My original usage was not this simple, but I was able to isolate the crash to a cast of an nfloat to nint, which is (happily) easy to work around.

Steps to Reproduce

  1. Create new iOS single view app

  2. Add --interpreter to mtouch arguments

  3. Add below code to FinishedLaunching before the return statement

        var notOof = (int)(float)1;
        var notOof2 = (nint)(float)(nfloat)1;
        var notOof3 = (nint)(int)(nfloat)1;
    
        var oof = (nint)(nfloat)1;
    
  4. Add breakpoint on first line, begin debugging and step each statement.

Expected Behavior

All statements execute without issue, as occurs when running without the --interpreter flag.

Actual Behavior

First three statements execute without issue. Final statement causes crash:

=================================================================
	Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Basic Fault Adddress Reporting
=================================================================
Memory around native instruction pointer (0x100b5a274):0x100b5a264  00 01 1f d6 db 82 5f f8 1b 01 00 b4 28 07 40 79  ......_.....(.@y
0x100b5a274  68 6b 68 f8 c8 82 1f f8 39 13 00 91 28 03 40 79  hkh.....9...(.@y
0x100b5a284  88 7a 68 f8 00 01 1f d6 fa 03 14 aa 60 d6 00 94  .zh.........`...
0x100b5a294  e1 03 00 aa 04 00 80 52 76 4e 40 f9 e0 03 16 aa  .......RvN@.....

=================================================================
	Native stacktrace:
=================================================================
	0x100e482bc - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
	0x100e3e2c8 - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libmonosgen-2.0.dylib : mono_handle_native_crash
	0x100e4cd04 - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler
	0x1f5a299ec - /usr/lib/system/libsystem_platform.dylib : <redacted>
	0x100b54a00 - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : interp_exec_method_full
	0x100b5589c - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : interp_exec_method_full
	0x100b5589c - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : interp_exec_method_full
	0x100b53c6c - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : interp_runtime_invoke
	0x100e50150 - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
	0x100ef6a08 - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libmonosgen-2.0.dylib : mono_runtime_invoke_checked
	0x100efa378 - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libmonosgen-2.0.dylib : mono_runtime_invoke
	0x100b51b64 - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : _ZL30native_to_managed_trampoline_4P11objc_objectP13objc_selectorPP11_MonoMethodP13UIApplicationP12NSDictionaryj
	0x100b518a4 - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : -[AppDelegate application:didFinishLaunchingWithOptions:]
	0x2229088e4 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x22290a048 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x22290f7d4 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x2221d3e34 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x2221dc3dc - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x2221d3ab8 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x2221d43a8 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x2221d26f4 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x2221d23bc - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x2221d6efc - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x2221d7ce0 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : _performActionsWithDelayForTransitionContext
	0x2221d6db4 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x2221dbac4 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x22290dddc - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x22250ab68 - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : <redacted>
	0x1f8795d94 - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1f879f7a4 - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1f879efac - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1f585d7d4 - /usr/lib/system/libdispatch.dylib : <redacted>
	0x1f58351ec - /usr/lib/system/libdispatch.dylib : <redacted>
	0x1f87d010c - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1f87cfda8 - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1f87d0360 - /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices : <redacted>
	0x1f5daa258 - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : <redacted>
	0x1f5daa1d8 - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : <redacted>
	0x1f5da9ac0 - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : <redacted>
	0x1f5da49f8 - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : <redacted>
	0x1f5da42dc - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : CFRunLoopRunSpecific
	0x1f7fa679c - /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices : GSEventRunModal
	0x22291142c - /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
	0x100b630a8 - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : do_icall
	0x100b55258 - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : interp_exec_method_full
	0x100b5589c - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : interp_exec_method_full
	0x100b5589c - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : interp_exec_method_full
	0x100b5589c - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : interp_exec_method_full
	0x100b5589c - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : interp_exec_method_full
	0x100b53c6c - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : interp_runtime_invoke
	0x100e50150 - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
	0x100ef6a08 - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libmonosgen-2.0.dylib : mono_runtime_invoke_checked
	0x100efccb8 - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libmonosgen-2.0.dylib : mono_runtime_exec_main_checked
	0x100e2dd9c - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libmonosgen-2.0.dylib : mono_jit_exec
	0x100cf1168 - /private/var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/libxamarin-debug.dylib : xamarin_main
	0x100b52ff4 - /var/containers/Bundle/Application/F4FDAC70-BED4-4632-972D-55DED365F59F/interp.app/interp : main
	0x1f586db80 - /usr/lib/system/libdyld.dylib : <redacted>

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at UIKit.UIApplication:UIApplicationMain <0x000bc>
	  at UIKit.UIApplication:Main <0x0002a>
	  at UIKit.UIApplication:Main <0x0006a>
	  at interp.Application:Main <0x00016>
	  at <Module>:runtime_invoke_direct_void_string[] <0x00088>
=================================================================

Environment

=== Visual Studio Community 2017 for Mac ===

Version 7.8.3 (build 2)
Installation UUID: 878dd934-e422-4da6-a7ed-281dfe787f4a
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 5.0.0.0 ( / b40230c0)

	Package version: 516010000

=== Mono Framework MDK ===

Runtime:
	Mono 5.16.1.0 (2018-06/a76b50e5faa) (64-bit)
	Package version: 516010000

=== NuGet ===

Version: 4.8.2.5835

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	2.1.9
	2.1.2
	2.1.1
	2.1.0-preview1-26216-03
	2.0.5
	2.0.3
SDK: /usr/local/share/dotnet/sdk/2.1.505/Sdks
SDK Versions:
	2.1.505
	2.1.302
	2.1.301
	2.1.300-preview1-008174
	2.1.4
	2.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.16.1/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 10.1 (14460.46)
Build 10B61

=== Xamarin.Mac ===

Version: 5.2.1.16 (Visual Studio Community)
Hash: 2dc06c71
Branch: 
Build date: 2019-02-12 23:09:50-0500

=== Xamarin.iOS ===

Version: 12.7.1.74 (Visual Studio Community)
Hash: b80d20ac
Branch: xi-interpreter
Build date: 2019-03-03 13:35:21-0500

=== Xamarin.Android ===

Version: 9.1.8.0 (Visual Studio Community)
Android SDK: /Users/rdavis/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		5.1 (API level 22)
		8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.0
SDK Build Tools Version: 27.0.3

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/rdavis/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android Device Manager ===

Version: 7.8.1.0
Hash: 8924ea4a

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 708030002
Git revision: fd02e670fdd6b101bc9c08b1cc5b7710d9f58cd8
Build date: 2019-03-08 10:30:21+00
Build branch: release-7.8
Xamarin extensions: 1f72f0a3737128552336f27e189d3c4f0cdebd00

=== Operating System ===

Mac OS X 10.13.6
Darwin 17.7.0 Darwin Kernel Version 17.7.0
    Thu Jun 21 22:53:14 PDT 2018
    root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

Continuous Coding 2.0.6
Redth's Addins 1.0.9

Build Logs

https://gist.github.com/rdavisau/e1dd04dd9df40a416b4b277767cdbaf4

Example Project (If Possible)

interp-nfloat_nint.zip

@lewurm lewurm added this to Inbox in Interpreter via automation Mar 27, 2019

@lewurm lewurm self-assigned this Mar 27, 2019

@spouliot spouliot added bug iOS labels Mar 27, 2019

@spouliot spouliot added this to the Future milestone Mar 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.