Bug 60539 - mini-codegen.c:1265, condition `reginfo [sreg].born_in > 0' not met
Summary: mini-codegen.c:1265, condition `reginfo [sreg].born_in > 0' not met
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler (show other bugs)
Version: 8.1 (15.5)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2017-11-06 20:01 UTC by Jerome Laban
Modified: 2018-02-27 20:35 UTC (History)
2 users (show)

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

VS version (3.45 KB, text/plain)
2017-11-06 20:01 UTC, Jerome Laban
Repro (7.98 KB, application/x-zip-compressed)
2017-11-08 13:28 UTC, Jerome Laban

Description Jerome Laban 2017-11-06 20:01:03 UTC
Created attachment 25568 [details]
VS version

When debugging an android application, the crash at the end of this issue happens. It does not happen when no debugger is attached.

It's happening on VS2017 15.5 Pre3, but has been happening since Pre1, and I do not yet have a simple repro to provide.

The only log that appears consistently before crashing is :

   Loaded assembly: System.Numerics.dll [External]

The following stack trace appears on a X86 Api 24 simulator :

A/(7131): * Assertion at /Users/builder/jenkins/workspace/xamarin-android/xamarin-android/external/mono/mono/mini/mini-codegen.c:1265, condition `reginfo [sreg].born_in > 0' not met
A/libc(7131): Fatal signal 6 (SIGABRT), code -6 in tid 7131 (XXXX.XXXX)
W/(1235): debuggerd: handling request: pid=7131 uid=10088 gid=10088 tid=7131
A/DEBUG(7163): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
A/DEBUG(7163): Build fingerprint: 'google/sdk_google_phone_x86/generic_x86:7.0/NYC/4310596:userdebug/dev-keys'
A/DEBUG(7163): Revision: '0'
A/DEBUG(7163): ABI: 'x86'
A/DEBUG(7163): pid: 7131, tid: 7131, name: ive.XXXX  >>> com.XXXX.XXXX <<<
A/DEBUG(7163): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
A/DEBUG(7163): Abort message: '* Assertion at /Users/builder/jenkins/workspace/xamarin-android/xamarin-android/external/mono/mono/mini/mini-codegen.c:1265, condition `reginfo [sreg].born_in > 0' not met
A/DEBUG(7163): '
A/DEBUG(7163):     eax 00000000  ebx 00001bdb  ecx 00001bdb  edx 00000006
A/DEBUG(7163):     esi b60eb58c  edi b60eb534
A/DEBUG(7163):     xcs 00000073  xds 0000007b  xes 0000007b  xfs 0000003b  xss 0000007b
A/DEBUG(7163):     eip b6018424  ebp bfff04f8  esp bfff049c  flags 00000292
A/DEBUG(7163): backtrace:
A/DEBUG(7163):     #00 pc ffffe424  [vdso:b6018000] (__kernel_vsyscall+16)
A/DEBUG(7163):     #01 pc 0007a00c  /system/lib/libc.so (tgkill+28)
A/DEBUG(7163):     #02 pc 00075855  /system/lib/libc.so (pthread_kill+85)
A/DEBUG(7163):     #03 pc 0002782a  /system/lib/libc.so (raise+42)
A/DEBUG(7163):     #04 pc 0001ee06  /system/lib/libc.so (abort+86)
A/DEBUG(7163):     #05 pc 00277905  /data/app/com.XXXX.XXXX-1/lib/x86/libmonosgen-2.0.so
Comment 1 Jerome Laban 2017-11-07 15:12:45 UTC
Also, this does not seem to happen on a ARM64 device.
Comment 2 Zoltan Varga 2017-11-07 19:12:26 UTC
Does this happen consistently, or is it random ?
Comment 3 Jerome Laban 2017-11-07 19:35:50 UTC
It's happening consistently, always with System.Numerics.dll loaded right before.
Comment 4 Jerome Laban 2017-11-08 13:28:26 UTC
Created attachment 25604 [details]
Comment 5 Jerome Laban 2017-11-08 13:29:51 UTC
Here's the crashing part: 

Vector2.Transform(Vector2.One, Matrix3x2.Identity);

Executing this will make the error mentioned above.

Does this have any relation with the fact that System.Numerics are now intrinsics?
Comment 6 Zoltan Varga 2017-11-08 15:51:56 UTC
It probably does.
Comment 7 Zoltan Varga 2017-11-08 16:54:55 UTC
I can reproduce with the testcase using xam.android Version: (Visual Studio Community).
Comment 8 Zoltan Varga 2017-11-09 23:31:03 UTC
As a workaround, you can execute:

adb shell setprop debug.mono.runtime_args "-O=-simd"

Where adb is in

Unfortunately, this needs to be executed every time the emulator is restarted.
Comment 9 Zoltan Varga 2017-11-09 23:31:16 UTC
Comment 10 Jerome Laban 2017-11-10 01:50:20 UTC
That's good enough of a workaround, thanks for the fast turnaround!
Comment 11 Ludovic Henry 2018-02-27 20:35:39 UTC
Merged in master with https://github.com/mono/mono/commit/d59f8a64ae0f8994c2ce9087019e7a1070733ab6

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